Search in sources :

Example 1 with Launch

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

the class DockerComposeUpJob method run.

@Override
protected IStatus run(final IProgressMonitor monitor) {
    final String dockerComposeInstallDir = Activator.getDefault().getPreferenceStore().getString(PreferenceConstants.DOCKER_COMPOSE_INSTALLATION_DIRECTORY);
    final Thread commandThread = new Thread(() -> {
        // open console view
        ConsolePlugin.getDefault().getConsoleManager().showConsoleView(dockerComposeConsole);
        try {
            // run the 'docker-compose up' command
            final Process dockerComposeSystemProcess = DockerCompose.getInstance().up(this.connection, dockerComposeInstallDir, this.workingDir);
            final ILaunch launch = new Launch(launchConfiguration, ILaunchManager.RUN_MODE, null);
            final IProcess dockerComposeProcess = DebugPlugin.newProcess(launch, dockerComposeSystemProcess, // $NON-NLS-1$
            "docker-compose up");
            dockerComposeConsole.setDockerComposeProcess(// $NON-NLS-1$
            dockerComposeProcess);
            final int exitCode = dockerComposeSystemProcess.waitFor();
            if (exitCode != 0) {
                Display.getDefault().asyncExec(() -> MessageDialog.openError(Display.getDefault().getActiveShell(), JobMessages.getString(// $NON-NLS-1$
                "DockerCompose.dialog.title"), JobMessages.getString(// $NON-NLS-1$
                "DockerComposeUp.start.error")));
            }
        } catch (DockerCommandNotFoundException e) {
            // just display the error to the user, there's no need to report
            // an error in the log and in AERI for that.
            Display.getDefault().asyncExec(() -> MessageDialog.openError(Display.getCurrent().getActiveShell(), JobMessages.getString(// $NON-NLS-1$
            "DockerCompose.dialog.title"), e.getMessage()));
        } catch (DockerException | InterruptedException e) {
            Display.getDefault().asyncExec(() -> MessageDialog.openError(Display.getCurrent().getActiveShell(), JobMessages.getString(// $NON-NLS-1$
            "DockerCompose.dialog.title"), e.getMessage()));
            Activator.log(e);
        }
    });
    commandThread.start();
    return Status.OK_STATUS;
}
Also used : DockerException(org.eclipse.linuxtools.docker.core.DockerException) DockerCommandNotFoundException(org.eclipse.linuxtools.docker.core.DockerCommandNotFoundException) ILaunch(org.eclipse.debug.core.ILaunch) IProcess(org.eclipse.debug.core.model.IProcess) Launch(org.eclipse.debug.core.Launch) ILaunch(org.eclipse.debug.core.ILaunch) IProcess(org.eclipse.debug.core.model.IProcess)

Example 2 with Launch

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

the class TestLaunching method testDefaultLaunch.

@Test
public void testDefaultLaunch() throws CoreException {
    TestingOprofileLaunchConfigurationDelegate delegate = new TestingOprofileLaunchConfigurationDelegate();
    ILaunch launch = new Launch(config, ILaunchManager.PROFILE_MODE, null);
    LaunchTestingOptions options = new LaunchTestingOptions();
    options.setOprofileProject(proj.getProject());
    options.loadConfiguration(config);
    assertTrue(options.isValid());
    assertTrue(options.getBinaryImage().isEmpty());
    assertTrue(options.getKernelImageFile().isEmpty());
    assertEquals(OprofileDaemonOptions.SEPARATE_NONE, options.getSeparateSamples());
    Oprofile.OprofileProject.setProfilingBinary(Oprofile.OprofileProject.OPERF_BINARY);
    delegate.launch(config, ILaunchManager.PROFILE_MODE, launch, null);
}
Also used : LaunchTestingOptions(org.eclipse.linuxtools.oprofile.launch.tests.utils.LaunchTestingOptions) TestingOprofileLaunchConfigurationDelegate(org.eclipse.linuxtools.oprofile.launch.tests.utils.TestingOprofileLaunchConfigurationDelegate) ILaunch(org.eclipse.debug.core.ILaunch) Launch(org.eclipse.debug.core.Launch) ILaunch(org.eclipse.debug.core.ILaunch) Test(org.junit.Test) AbstractTest(org.eclipse.linuxtools.profiling.tests.AbstractTest)

Example 3 with Launch

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

the class TestLaunchingExternalProject method testLaunchExternalProject.

/**
 * Testcase for Eclipse BugZilla 321905/RedHat BZ
 *
 * @throws CoreException
 */
@Test
public void testLaunchExternalProject() throws CoreException {
    LaunchTestingOptions options = new LaunchTestingOptions();
    options.setOprofileProject(externalProject);
    options.loadConfiguration(config);
    TestingOprofileLaunchConfigurationDelegate delegate = new TestingOprofileLaunchConfigurationDelegate();
    ILaunch launch = new Launch(config, ILaunchManager.PROFILE_MODE, null);
    assertTrue(options.isValid());
    assertTrue(options.getBinaryImage().isEmpty());
    assertTrue(options.getKernelImageFile().isEmpty());
    assertEquals(OprofileDaemonOptions.SEPARATE_NONE, options.getSeparateSamples());
    OprofileProject.setProfilingBinary(OprofileProject.OPERF_BINARY);
    delegate.launch(config, ILaunchManager.PROFILE_MODE, launch, null);
}
Also used : LaunchTestingOptions(org.eclipse.linuxtools.oprofile.launch.tests.utils.LaunchTestingOptions) TestingOprofileLaunchConfigurationDelegate(org.eclipse.linuxtools.oprofile.launch.tests.utils.TestingOprofileLaunchConfigurationDelegate) ILaunch(org.eclipse.debug.core.ILaunch) Launch(org.eclipse.debug.core.Launch) ILaunch(org.eclipse.debug.core.ILaunch) Test(org.junit.Test) AbstractTest(org.eclipse.linuxtools.profiling.tests.AbstractTest)

Example 4 with Launch

use of org.eclipse.debug.core.Launch 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 5 with Launch

use of org.eclipse.debug.core.Launch in project statecharts by Yakindu.

the class AbstractDebugTargetView method debugContextChanged.

public void debugContextChanged(DebugContextEvent event) {
    if ((event.getFlags() & DebugContextEvent.ACTIVATED) > 0) {
        PlatformObject object = (PlatformObject) ((IStructuredSelection) event.getContext()).getFirstElement();
        if (object == null)
            return;
        IDebugTarget newTarget = null;
        if (object instanceof Launch) {
            newTarget = ((Launch) object).getDebugTarget();
        } else {
            newTarget = (IDebugTarget) object.getAdapter(IDebugTarget.class);
        }
        changeTarget(newTarget);
    }
}
Also used : IDebugTarget(org.eclipse.debug.core.model.IDebugTarget) PlatformObject(org.eclipse.core.runtime.PlatformObject) Launch(org.eclipse.debug.core.Launch) ILaunch(org.eclipse.debug.core.ILaunch)

Aggregations

ILaunch (org.eclipse.debug.core.ILaunch)15 Launch (org.eclipse.debug.core.Launch)15 AbstractTest (org.eclipse.linuxtools.profiling.tests.AbstractTest)4 Before (org.junit.Before)4 Test (org.junit.Test)4 ILaunchConfiguration (org.eclipse.debug.core.ILaunchConfiguration)3 ILaunchConfigurationWorkingCopy (org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)3 LaunchTestingOptions (org.eclipse.linuxtools.oprofile.launch.tests.utils.LaunchTestingOptions)3 TestingOprofileLaunchConfigurationDelegate (org.eclipse.linuxtools.oprofile.launch.tests.utils.TestingOprofileLaunchConfigurationDelegate)3 DSELaunch (de.uka.ipd.sdq.dsexplore.launch.DSELaunch)2 File (java.io.File)2 IOException (java.io.IOException)2 ProjectScope (org.eclipse.core.resources.ProjectScope)2 CoreException (org.eclipse.core.runtime.CoreException)2 IConfigurationElement (org.eclipse.core.runtime.IConfigurationElement)2 IExtensionPoint (org.eclipse.core.runtime.IExtensionPoint)2 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)2 IProcess (org.eclipse.debug.core.model.IProcess)2 IStreamsProxy (org.eclipse.debug.core.model.IStreamsProxy)2 PerfLaunchConfigDelegate (org.eclipse.linuxtools.internal.perf.launch.PerfLaunchConfigDelegate)2