use of org.eclipse.debug.core.ILaunchConfigurationWorkingCopy in project linuxtools by eclipse.
the class TestSetup method testSetupTab.
@Test
public void testSetupTab() throws CoreException {
OprofileTestingSetupTab tab = new OprofileTestingSetupTab();
tab.createControl(new Shell());
assertNotNull(tab.getImage());
assertNotNull(tab.getName());
ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
// default config
tab.setDefaults(wc);
tab.initializeFrom(config);
Button libraryCheck = tab.getLibraryCheck();
libraryCheck.setSelection(true);
libraryCheck.notifyListeners(SWT.Selection, null);
performApply(tab, wc);
assertEquals(OprofileDaemonOptions.SEPARATE_LIBRARY, config.getAttribute(OprofileLaunchPlugin.ATTR_SEPARATE_SAMPLES, -1));
libraryCheck.setSelection(false);
libraryCheck.notifyListeners(SWT.Selection, null);
performApply(tab, wc);
assertEquals(OprofileDaemonOptions.SEPARATE_NONE, config.getAttribute(OprofileLaunchPlugin.ATTR_SEPARATE_SAMPLES, -1));
Button kernelCheck = tab.getKernelCheck();
kernelCheck.setSelection(true);
kernelCheck.notifyListeners(SWT.Selection, null);
performApply(tab, wc);
assertEquals(OprofileDaemonOptions.SEPARATE_KERNEL, config.getAttribute(OprofileLaunchPlugin.ATTR_SEPARATE_SAMPLES, -1));
kernelCheck.setSelection(false);
kernelCheck.notifyListeners(SWT.Selection, null);
performApply(tab, wc);
assertEquals(OprofileDaemonOptions.SEPARATE_NONE, config.getAttribute(OprofileLaunchPlugin.ATTR_SEPARATE_SAMPLES, -1));
libraryCheck.setSelection(true);
libraryCheck.notifyListeners(SWT.Selection, null);
kernelCheck.setSelection(true);
kernelCheck.notifyListeners(SWT.Selection, null);
performApply(tab, wc);
tab.initializeFrom(config);
assertTrue(libraryCheck.getSelection());
assertTrue(kernelCheck.getSelection());
Text kernelLocationText = tab.getTextKernelImage();
// $NON-NLS-1$
kernelLocationText.setText("doesntexist");
kernelLocationText.notifyListeners(SWT.Selection, null);
performApply(tab, wc);
assertFalse(tab.isValid(config));
// $NON-NLS-1$
kernelLocationText.setText("");
kernelLocationText.notifyListeners(SWT.Selection, null);
performApply(tab, wc);
assertTrue(tab.isValid(config));
}
use of org.eclipse.debug.core.ILaunchConfigurationWorkingCopy in project linuxtools by eclipse.
the class TestSetup method testEventConfigTab.
@Test
public void testEventConfigTab() throws CoreException {
OprofileTestingEventConfigTab tab = new OprofileTestingEventConfigTab();
tab.createControl(new Shell());
assertNotNull(tab.getImage());
assertNotNull(tab.getName());
tab.setDefaults(config.getWorkingCopy());
tab.initializeFrom(config);
assertTrue(tab.isValid(config));
assertTrue(tab.getDefaultCheck().getSelection());
tab.getDefaultCheck().notifyListeners(SWT.Selection, null);
tab.getDefaultCheck().setSelection(false);
tab.getDefaultCheck().notifyListeners(SWT.Selection, null);
ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
wc.setAttribute(OprofileLaunchPlugin.ATTR_USE_DEFAULT_EVENT, false);
performApply(tab, wc);
assertFalse(tab.isValid(config));
}
use of org.eclipse.debug.core.ILaunchConfigurationWorkingCopy in project linuxtools by eclipse.
the class ProfileLaunchShortcut method createConfiguration.
/**
* Create a launch configuration based on a binary, and optionally
* save it to the underlying resource.
*
* @param bin a representation of a binary
* @param save true if the configuration should be saved to the
* underlying resource, and false if it should not be saved.
* @return a launch configuration generated for the binary.
* @since 1.2
*/
protected ILaunchConfiguration createConfiguration(IBinary bin, boolean save) {
ILaunchConfiguration config = null;
try {
String projectName = bin.getResource().getProjectRelativePath().toString();
ILaunchConfigurationType configType = getLaunchConfigType();
ILaunchConfigurationWorkingCopy wc = configType.newInstance(null, getLaunchManager().generateLaunchConfigurationName(bin.getElementName()));
wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, projectName);
wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, bin.getCProject().getElementName());
wc.setMappedResources(new IResource[] { bin.getResource(), bin.getResource().getProject() });
wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, (String) null);
setDefaultProfileAttributes(wc);
if (save) {
config = wc.doSave();
} else {
config = wc;
}
} catch (CoreException e) {
e.printStackTrace();
}
return config;
}
use of org.eclipse.debug.core.ILaunchConfigurationWorkingCopy in project linuxtools by eclipse.
the class LaunchTest method testDelegate.
@Test
public void testDelegate() throws CoreException {
ILaunchConfiguration config = createConfiguration(proj.getProject());
ProviderLaunchConfigurationDelegate delegate = new ProviderLaunchConfigurationDelegate();
ILaunch launch = new Launch(config, ILaunchManager.PROFILE_MODE, null);
ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
setProfileAttributes(wc);
delegate.launch(wc, ILaunchManager.PROFILE_MODE, launch, null);
}
use of org.eclipse.debug.core.ILaunchConfigurationWorkingCopy in project linuxtools by eclipse.
the class LaunchConfigTabTest method testTrackLockorders.
@Test
public void testTrackLockorders() throws CoreException, URISyntaxException, IOException {
ILaunchConfigurationWorkingCopy wc = initConfig();
dynamicTab.getLockordersButton().setSelection(false);
tab.performApply(wc);
wc.doSave();
// $NON-NLS-1$
ILaunch launch = saveAndLaunch(wc, "testHelgrindGeneric");
IProcess[] p = launch.getProcesses();
assertTrue("process array should not be empty", p.length > 0);
String cmd = p[0].getAttribute(IProcess.ATTR_CMDLINE);
assertEquals(0, p[0].getExitValue());
// $NON-NLS-1$
assertTrue(cmd.contains("--track-lockorders=no"));
}
Aggregations