Search in sources :

Example 1 with ImageBuild

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;
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) IWorkbenchPart(org.eclipse.ui.IWorkbenchPart) IDockerConnection(org.eclipse.linuxtools.docker.core.IDockerConnection) ImageBuild(org.eclipse.linuxtools.internal.docker.ui.wizards.ImageBuild) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Aggregations

WizardDialog (org.eclipse.jface.wizard.WizardDialog)1 IDockerConnection (org.eclipse.linuxtools.docker.core.IDockerConnection)1 ImageBuild (org.eclipse.linuxtools.internal.docker.ui.wizards.ImageBuild)1 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)1 IWorkbenchPart (org.eclipse.ui.IWorkbenchPart)1 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)1