Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 371285 | Differences between
and this patch

Collapse All | Expand All

(-)a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/launch/PerfDefaultLaunchConfig.java (-1 / +66 lines)
Added Link Here
0
- 
1
/*******************************************************************************
2
 * Copyright (c) 2012 Red Hat, Inc.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    Camilo Bernal <cabernal@redhat.com> - Initial Implementation.
10
 *******************************************************************************/
11
package org.eclipse.linuxtools.internal.perf.launch;
12
13
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
14
import org.eclipse.core.runtime.CoreException;
15
import org.eclipse.debug.core.ILaunchConfiguration;
16
import org.eclipse.debug.core.ILaunchConfigurationType;
17
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
18
import org.eclipse.debug.ui.IDebugUIConstants;
19
import org.eclipse.linuxtools.internal.perf.PerfPlugin;
20
import org.eclipse.linuxtools.profiling.launch.ProfileLaunchShortcut;
21
22
public class PerfDefaultLaunchConfig extends ProfileLaunchShortcut {
23
24
	@Override
25
	protected ILaunchConfigurationType getLaunchConfigType() {
26
		return getLaunchManager().getLaunchConfigurationType(
27
				PerfPlugin.LAUNCHCONF_ID);
28
	}
29
30
	@Override
31
	protected void setDefaultProfileAttributes(
32
			ILaunchConfigurationWorkingCopy wc) {
33
		wc.setAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, false);
34
		wc.setAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE, true);
35
	}
36
37
	protected void setProjectNameAttribute(ILaunchConfigurationWorkingCopy wc,
38
			String projName) {
39
		wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME,
40
				projName);
41
	}
42
43
	/**
44
	 * Create an ILaunchConfiguration instance given the project's name.
45
	 * 
46
	 * @param projectName
47
	 * @return ILaunchConfiguration based on String projectName
48
	 */
49
	public ILaunchConfiguration createDefaultConfiguration(String projectName) {
50
		ILaunchConfiguration config = null;
51
		try {
52
			ILaunchConfigurationType configType = getLaunchConfigType();
53
			ILaunchConfigurationWorkingCopy wc = configType.newInstance(
54
					null,
55
					getLaunchManager().generateLaunchConfigurationName(
56
							projectName));
57
			setDefaultProfileAttributes(wc);
58
			setProjectNameAttribute(wc, projectName);
59
			config = wc;
60
61
		} catch (CoreException e) {
62
			e.printStackTrace();
63
		}
64
		return config;
65
	}
66
}

Return to bug 371285