Search in sources :

Example 1 with DockerComposeUpJob

use of org.eclipse.linuxtools.internal.docker.ui.jobs.DockerComposeUpJob in project linuxtools by eclipse.

the class DockerComposeUpLaunchConfigurationDelegate method launch.

@Override
public void launch(final ILaunchConfiguration configuration, final String mode, final ILaunch launch, final IProgressMonitor monitor) throws CoreException {
    final String sourcePathLocation = configuration.getAttribute(WORKING_DIR, (String) null);
    final boolean sourcePathWorkspaceRelativeLocation = configuration.getAttribute(WORKING_DIR_WORKSPACE_RELATIVE_LOCATION, false);
    final IPath sourcePath = BuildDockerImageUtils.getPath(sourcePathLocation, sourcePathWorkspaceRelativeLocation);
    final String connectionName = configuration.getAttribute(DOCKER_CONNECTION, (String) null);
    final IDockerConnection connection = DockerConnectionManager.getInstance().getConnectionByName(connectionName);
    if (connection != null && sourcePath != null) {
        final Job dockerComposeUpJob = new DockerComposeUpJob(connection, sourcePath.toOSString(), configuration);
        dockerComposeUpJob.schedule();
    } else {
        final ILaunchGroup launchGroup = DebugUITools.getLaunchGroup(configuration, // $NON-NLS-1$
        "run");
        // prompt the user with the launch configuration editor
        Display.getDefault().syncExec(() -> DebugUITools.openLaunchConfigurationDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), configuration, launchGroup.getIdentifier(), null));
    }
}
Also used : IPath(org.eclipse.core.runtime.IPath) DockerComposeUpJob(org.eclipse.linuxtools.internal.docker.ui.jobs.DockerComposeUpJob) IDockerConnection(org.eclipse.linuxtools.docker.core.IDockerConnection) ILaunchGroup(org.eclipse.debug.ui.ILaunchGroup) Job(org.eclipse.core.runtime.jobs.Job) DockerComposeUpJob(org.eclipse.linuxtools.internal.docker.ui.jobs.DockerComposeUpJob)

Aggregations

IPath (org.eclipse.core.runtime.IPath)1 Job (org.eclipse.core.runtime.jobs.Job)1 ILaunchGroup (org.eclipse.debug.ui.ILaunchGroup)1 IDockerConnection (org.eclipse.linuxtools.docker.core.IDockerConnection)1 DockerComposeUpJob (org.eclipse.linuxtools.internal.docker.ui.jobs.DockerComposeUpJob)1