Search in sources :

Example 16 with ILaunchConfiguration

use of org.eclipse.debug.core.ILaunchConfiguration 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);
}
Also used : ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) ILaunch(org.eclipse.debug.core.ILaunch) ProviderLaunchConfigurationDelegate(org.eclipse.linuxtools.internal.profiling.launch.provider.launch.ProviderLaunchConfigurationDelegate) ILaunchConfigurationWorkingCopy(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) Launch(org.eclipse.debug.core.Launch) ILaunch(org.eclipse.debug.core.ILaunch) Test(org.junit.Test) AbstractTest(org.eclipse.linuxtools.profiling.tests.AbstractTest)

Example 17 with ILaunchConfiguration

use of org.eclipse.debug.core.ILaunchConfiguration in project linuxtools by eclipse.

the class ValgrindCoreParser method copyLaunchSourceLocator.

/**
 * Return a safe source locator from launch object which won't be disposed if launch object is disposed
 * @param launch - launch object
 * @return source locator
 */
public static ISourceLocator copyLaunchSourceLocator(ILaunch launch) {
    if (launch == null)
        return null;
    ISourceLocator sourceLocator = launch.getSourceLocator();
    ILaunchConfiguration launchConfiguration = launch.getLaunchConfiguration();
    // since we want to use it later we need to create a copy of it
    if (sourceLocator instanceof ISourceLookupDirector) {
        try {
            ISourceLookupDirector director = (ISourceLookupDirector) sourceLocator;
            String id = director.getId();
            String memento = director.getMemento();
            IPersistableSourceLocator sourceLocatorCopy = DebugPlugin.getDefault().getLaunchManager().newSourceLocator(id);
            if (sourceLocatorCopy instanceof IPersistableSourceLocator2) {
                ((IPersistableSourceLocator2) sourceLocatorCopy).initializeFromMemento(memento, launchConfiguration);
            } else
                sourceLocatorCopy.initializeFromMemento(memento);
            return sourceLocatorCopy;
        } catch (CoreException e) {
        // ignore
        }
    }
    return sourceLocator;
}
Also used : ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) CoreException(org.eclipse.core.runtime.CoreException) ISourceLookupDirector(org.eclipse.debug.core.sourcelookup.ISourceLookupDirector) IPersistableSourceLocator(org.eclipse.debug.core.model.IPersistableSourceLocator) IPersistableSourceLocator2(org.eclipse.debug.core.sourcelookup.IPersistableSourceLocator2) ISourceLocator(org.eclipse.debug.core.model.ISourceLocator)

Example 18 with ILaunchConfiguration

use of org.eclipse.debug.core.ILaunchConfiguration in project linuxtools by eclipse.

the class ShortcutTest method testShortcutExistingConfig.

@Test
public void testShortcutExistingConfig() throws CoreException {
    ILaunchConfiguration prev = createConfiguration(proj.getProject());
    ValgrindTestHelgrindLaunchShortcut shortcut = new ValgrindTestHelgrindLaunchShortcut();
    shortcut.launch(new StructuredSelection(proj.getProject()), ILaunchManager.PROFILE_MODE);
    ILaunchConfiguration current = shortcut.getConfig();
    assertEquals(prev, current);
}
Also used : ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) Test(org.junit.Test)

Example 19 with ILaunchConfiguration

use of org.eclipse.debug.core.ILaunchConfiguration in project linuxtools by eclipse.

the class ShortcutTest method testShortcutSelection.

@Test
public void testShortcutSelection() throws CoreException {
    ValgrindTestHelgrindLaunchShortcut shortcut = new ValgrindTestHelgrindLaunchShortcut();
    shortcut.launch(new StructuredSelection(proj.getProject()), ILaunchManager.PROFILE_MODE);
    ILaunchConfiguration config = shortcut.getConfig();
    compareWithDefaults(config);
}
Also used : ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) Test(org.junit.Test)

Example 20 with ILaunchConfiguration

use of org.eclipse.debug.core.ILaunchConfiguration in project linuxtools by eclipse.

the class BasicMassifTest method testNumSnapshots.

@Test
public void testNumSnapshots() throws Exception {
    ILaunchConfiguration config = createConfiguration(proj.getProject());
    // $NON-NLS-1$
    doLaunch(config, "testNumSnapshots");
    MassifViewPart view = (MassifViewPart) ValgrindUIPlugin.getDefault().getView().getDynamicView();
    MassifSnapshot[] snapshots = view.getSnapshots();
    assertEquals(14, snapshots.length);
    checkSnapshots(snapshots, 40, 16);
}
Also used : ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) MassifSnapshot(org.eclipse.linuxtools.internal.valgrind.massif.MassifSnapshot) MassifViewPart(org.eclipse.linuxtools.internal.valgrind.massif.MassifViewPart) Test(org.junit.Test)

Aggregations

ILaunchConfiguration (org.eclipse.debug.core.ILaunchConfiguration)266 CoreException (org.eclipse.core.runtime.CoreException)96 ILaunchConfigurationWorkingCopy (org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)76 Test (org.junit.Test)72 ILaunchConfigurationType (org.eclipse.debug.core.ILaunchConfigurationType)50 ILaunchManager (org.eclipse.debug.core.ILaunchManager)40 ArrayList (java.util.ArrayList)37 ILaunch (org.eclipse.debug.core.ILaunch)35 IProject (org.eclipse.core.resources.IProject)20 IPath (org.eclipse.core.runtime.IPath)20 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)16 IEditorPart (org.eclipse.ui.IEditorPart)15 IStatus (org.eclipse.core.runtime.IStatus)14 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)14 IFile (org.eclipse.core.resources.IFile)13 IProcess (org.eclipse.debug.core.model.IProcess)13 CachegrindViewPart (org.eclipse.linuxtools.internal.valgrind.cachegrind.CachegrindViewPart)13 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)11 Shell (org.eclipse.swt.widgets.Shell)10 ElementListSelectionDialog (org.eclipse.ui.dialogs.ElementListSelectionDialog)10