use of org.eclipse.linuxtools.internal.vagrant.ui.wizards.CreateVMWizard in project linuxtools by eclipse.
the class CreateVmCommandHandler method execute.
@Override
public Object execute(final ExecutionEvent event) {
if (VagrantConnection.findVagrantPath() == null) {
Display.getDefault().syncExec(() -> MessageDialog.openError(Display.getCurrent().getActiveShell(), // $NON-NLS-1$
WizardMessages.getString("VagrantCommandNotFound.title"), // $NON-NLS-1$
WizardMessages.getString("VagrantCommandNotFound.msg")));
} else {
final IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
final List<IVagrantBox> selectedBoxes = CommandUtils.getSelectedImages(activePart);
if (selectedBoxes.size() <= 1) {
IVagrantBox selectedBox = selectedBoxes.isEmpty() ? null : selectedBoxes.get(0);
final CreateVMWizard wizard = new CreateVMWizard(selectedBox);
final boolean finished = CommandUtils.openWizard(wizard, HandlerUtil.getActiveShell(event));
if (finished) {
performCreateVM(wizard.getVMName(), wizard.getBoxReference(), wizard.getVMFile(), wizard.getVMEnvironment());
}
}
}
return null;
}
Aggregations