use of org.eclipse.linuxtools.internal.docker.ui.wizards.ImageBuild in project linuxtools by eclipse.
the class BuildImageCommandHandler method execute.
@Override
public Object execute(final ExecutionEvent event) {
final ImageBuild wizard = new ImageBuild();
final WizardDialog wizardDialog = new NonModalWizardDialog(HandlerUtil.getActiveShell(event), wizard);
wizardDialog.create();
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
IWorkbenchPage activePage = null;
IWorkbenchPart activePart = null;
if (window != null)
activePage = window.getActivePage();
if (activePage != null)
activePart = activePage.getActivePart();
IDockerConnection connection = CommandUtils.getCurrentConnection(activePart);
// connections
if (connection == null) {
connection = DockerConnectionManager.getInstance().getFirstConnection();
}
if (connection == null || !connection.isOpen()) {
// if no active connection, issue error message dialog and return
Display.getDefault().syncExec(() -> MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), // $NON-NLS-1$
WizardMessages.getString("ErrorNoActiveConnection.msg"), // $NON-NLS-1$
WizardMessages.getString("ErrorNoActiveConnection.desc")));
return null;
}
final boolean buildImage = wizardDialog.open() == Window.OK;
if (buildImage) {
performBuildImage(wizard, connection);
}
return null;
}
Aggregations