|
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.core.runtime.CoreException; |
| 14 |
import org.eclipse.debug.core.ILaunchConfiguration; |
| 15 |
import org.eclipse.debug.core.ILaunchConfigurationType; |
| 16 |
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; |
| 17 |
import org.eclipse.debug.ui.IDebugUIConstants; |
| 18 |
import org.eclipse.linuxtools.internal.perf.PerfPlugin; |
| 19 |
import org.eclipse.linuxtools.profiling.launch.ProfileLaunchShortcut; |
| 20 |
|
| 21 |
public class PerfDefaultLaunchConfig extends ProfileLaunchShortcut { |
| 22 |
|
| 23 |
@Override |
| 24 |
protected ILaunchConfigurationType getLaunchConfigType() { |
| 25 |
return getLaunchManager().getLaunchConfigurationType( |
| 26 |
PerfPlugin.LAUNCHCONF_ID); |
| 27 |
} |
| 28 |
|
| 29 |
@Override |
| 30 |
protected void setDefaultProfileAttributes( |
| 31 |
ILaunchConfigurationWorkingCopy wc) throws CoreException { |
| 32 |
wc.setAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, false); |
| 33 |
wc.setAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE, true); |
| 34 |
} |
| 35 |
|
| 36 |
/** |
| 37 |
* Create an ILaunchConfiguration instance given the project's name. |
| 38 |
* |
| 39 |
* @param projectName |
| 40 |
* @return ILaunchConfiguration based on String projectName |
| 41 |
*/ |
| 42 |
public ILaunchConfiguration createDefaultConfiguration(String projectName) { |
| 43 |
ILaunchConfiguration config = null; |
| 44 |
try { |
| 45 |
ILaunchConfigurationType configType = getLaunchConfigType(); |
| 46 |
ILaunchConfigurationWorkingCopy wc = configType.newInstance( |
| 47 |
null, |
| 48 |
getLaunchManager().generateLaunchConfigurationName( |
| 49 |
projectName)); |
| 50 |
config = (ILaunchConfiguration) wc; |
| 51 |
|
| 52 |
} catch (CoreException e) { |
| 53 |
e.printStackTrace(); |
| 54 |
} |
| 55 |
return config; |
| 56 |
} |
| 57 |
} |