Search in sources :

Example 1 with EditDockerConnection

use of org.eclipse.linuxtools.internal.docker.ui.wizards.EditDockerConnection in project linuxtools by eclipse.

the class EditDockerConnectionCommandHandler method execute.

@Override
public Object execute(ExecutionEvent event) {
    final IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
    final IDockerConnection currentConnection = CommandUtils.getCurrentConnection(activePart);
    final String oldConnectionName = currentConnection.getName();
    final EditDockerConnection wizard = new EditDockerConnection(currentConnection);
    if (CommandUtils.openWizard(wizard, HandlerUtil.getActiveShell(event))) {
        // apply the changes to all launch configurations if needed
        final String newConnectionName = currentConnection.getName();
        if (!newConnectionName.equals(oldConnectionName)) {
            LaunchConfigurationUtils.updateLaunchConfigurations(IBuildDockerImageLaunchConfigurationConstants.CONFIG_TYPE_ID, IDockerImageBuildOptions.DOCKER_CONNECTION, oldConnectionName, newConnectionName);
            LaunchConfigurationUtils.updateLaunchConfigurations(IRunDockerImageLaunchConfigurationConstants.CONFIG_TYPE_ID, IRunDockerImageLaunchConfigurationConstants.CONNECTION_NAME, oldConnectionName, newConnectionName);
        }
    }
    return null;
}
Also used : EditDockerConnection(org.eclipse.linuxtools.internal.docker.ui.wizards.EditDockerConnection) IWorkbenchPart(org.eclipse.ui.IWorkbenchPart) IDockerConnection(org.eclipse.linuxtools.docker.core.IDockerConnection)

Aggregations

IDockerConnection (org.eclipse.linuxtools.docker.core.IDockerConnection)1 EditDockerConnection (org.eclipse.linuxtools.internal.docker.ui.wizards.EditDockerConnection)1 IWorkbenchPart (org.eclipse.ui.IWorkbenchPart)1