/* * (non-Javadoc) * * @see * org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands * .ExecutionEvent) */ public Object execute(ExecutionEvent event) throws ExecutionException { LoadModelInstanceWizard wizard; WizardDialog dialog; ISelection currentSelection; IStructuredSelection currentStructuredSelection; /* Get the current selection. */ IWorkbenchWindow window = ModelBusUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow(); currentSelection = window.getSelectionService().getSelection(); if (currentSelection instanceof IStructuredSelection) { currentStructuredSelection = (IStructuredSelection) currentSelection; } else { currentStructuredSelection = null; } /* Initialize and start the depending code gen wizard. */ wizard = new LoadModelInstanceWizard(); wizard.init(window.getWorkbench(), currentStructuredSelection); /* Instantiates the wizard container with the wizard and opens it. */ dialog = new WizardDialog(window.getShell(), wizard); dialog.create(); dialog.open(); return null; }
boolean addFilesToRepository(RepositoryPlugin repo, File[] files) { AddFilesToRepositoryWizard wizard = new AddFilesToRepositoryWizard(repo, files); WizardDialog dialog = new WizardDialog(getViewSite().getShell(), wizard); dialog.open(); viewer.refresh(repo); return true; }
/** * Opens dialog based on the resource selected * * @param resource * @param window */ private void openDialogBasedOnResourceSelected(IResource resource, IWorkbenchWindow window) { WizardDialog dialog = null; if (resource != null) { // in case there is a resource, go on if (resource instanceof IFile) { // get wizard for database file dialog = new WizardDialog( window.getShell(), new DatabaseManagementClassesCreationWizard(resource.getProject(), resource)); } else { // get wizard with no database file dialog = new WizardDialog( window.getShell(), new DatabaseManagementClassesCreationWizard(resource.getProject(), null)); } } else { // resource is null, set the wizard with nothing selected dialog = new WizardDialog( window.getShell(), new DatabaseManagementClassesCreationWizard(null, null)); } if (dialog != null) { // open the wizard dialog.open(); } }
@Override public void run(IAction action) { if (fSelection instanceof IStructuredSelection) { Object[] elems = ((IStructuredSelection) fSelection).toArray(); ArrayList<IProject> projects = new ArrayList<IProject>(elems.length); for (int i = 0; i < elems.length; i++) { Object elem = elems[i]; IProject project = null; if (elem instanceof IFile) { IFile file = (IFile) elem; project = file.getProject(); } else if (elem instanceof IProject) { project = (IProject) elem; } else if (elem instanceof ICProject) { project = ((ICProject) elem).getProject(); } if (project != null) { projects.add(project); } } final IProject[] projectArray = projects.toArray(new IProject[projects.size()]); UpdateMakeProjectWizard wizard = new UpdateMakeProjectWizard(projectArray); WizardDialog dialog = new WizardDialog(MakeUIPlugin.getActiveWorkbenchShell(), wizard); dialog.open(); } }
@Override public void run() { WizardDialog wd = new WizardDialog(designer.getSite().getShell(), new BMFromDBWizard_2()); if (Window.OK == wd.open() && selection != null) { addFields(); } }
@Deprecated public void promptToAddQuery(TaskRepository taskRepository) { IPreferenceStore preferenceStore = TasksUiPlugin.getDefault().getPreferenceStore(); if (!preferenceStore.getBoolean(PREF_ADD_QUERY)) { Shell shell = PlatformUI.getWorkbench().getDisplay().getActiveShell(); MessageDialogWithToggle messageDialog = MessageDialogWithToggle.openYesNoQuestion( shell, Messages.AddRepositoryAction_Add_new_query, Messages.AddRepositoryAction_Add_a_query_to_the_Task_List, Messages.AddRepositoryAction_Do_not_show_again, false, preferenceStore, PREF_ADD_QUERY); preferenceStore.setValue(PREF_ADD_QUERY, messageDialog.getToggleState()); if (messageDialog.getReturnCode() == IDialogConstants.YES_ID) { AbstractRepositoryConnectorUi connectorUi = TasksUiPlugin.getConnectorUi(taskRepository.getConnectorKind()); IWizard queryWizard = connectorUi.getQueryWizard(taskRepository, null); if (queryWizard instanceof Wizard) { ((Wizard) queryWizard).setForcePreviousAndNextButtons(true); } WizardDialog queryDialog = new WizardDialog(shell, queryWizard); queryDialog.create(); queryDialog.setBlockOnOpen(true); queryDialog.open(); } } }
/** {@inheritDoc} */ public Object execute(ExecutionEvent event) throws ExecutionException { Display current = Display.getCurrent(); if (current == null) { current = Display.getDefault(); } Shell shell = current.getActiveShell(); if (shell != null) { CustomizePropertyViewWizard wizard = new CustomizePropertyViewWizard(); WizardDialog wd = new WizardDialog(shell, wizard) { /** {@inheritDoc} */ @Override protected void configureShell(Shell newShell) { super.configureShell(newShell); newShell.setText("Customize Property View"); } }; wd.create(); // wd.getShell().setSize(640, 600); wd.open(); } else { Activator.log.error("impossible to find a shell to open the message dialog", null); } return null; }
private EClassifier getExistingEClassifiers() { final Set<EClassifier> elements = getEClassifiersFromRegistry(ePackages); final SelectModelElementWizard wizard = new SelectModelElementWizard( "Select EClassifier", //$NON-NLS-1$ Messages.NewModelElementWizard_WizardTitle_AddModelElement, Messages.ModelelementSelectionDialog_DialogTitle, Messages.ModelelementSelectionDialog_DialogMessage_SearchPattern, EObject.class); final SelectionComposite<TableViewer> tableSelectionComposite = CompositeFactory.getTableSelectionComposite(elements.toArray(), false); wizard.setCompositeProvider(tableSelectionComposite); final WizardDialog wd = new WizardDialog(Display.getDefault().getActiveShell(), wizard); EClassifier eClassifier = null; final int result = wd.open(); if (result == Window.OK) { final Object[] selection = tableSelectionComposite.getSelection(); if (selection == null || selection.length == 0) { return null; } eClassifier = (EClassifier) selection[0]; } return eClassifier; }
public void run(IAction action) { final TransformToGenModelWizard wiz = new TransformToGenModelWizard(); wiz.setWindowTitle(action.getText()); wiz.init(PlatformUI.getWorkbench(), sselection); WizardDialog wd = new WizardDialog(getShell(), wiz); wd.create(); Rectangle mb = getShell().getMonitor().getClientArea(); Point dpi = getShell().getDisplay().getDPI(); if (Platform.OS_MACOSX.equals(Platform.getOS())) { dpi = new Point(110, 110); // OSX DPI is always 72; 110 is a common value for modern LCD screens } int width = dpi.x * WIZARD_WIDTH_INCH; int height = dpi.y * WIZARD_HEIGHT_INCH; int x = mb.x + (mb.width - width) / 2; if (x < mb.x) { x = mb.x; } int y = mb.y + (mb.height - height) / 2; if (y < mb.y) { y = mb.y; } wd.getShell().setLocation(x, y); wd.getShell().setSize(width, height); wd.open(); }
public Object execute(ExecutionEvent event) throws ExecutionException { Element selectedElement = getSelection(); ServicesRegistry registry = null; try { registry = ServiceUtilsForHandlers.getInstance().getServiceRegistry(event); } catch (ServiceException e1) { e1.printStackTrace(); } ModelSet modelSet; try { modelSet = registry.getService(ModelSet.class); } catch (ServiceException e) { throw new ExecutionException("Can't get ModelSet", e); } FeatureArchitectureWizard bWizard = new FeatureArchitectureWizard(false); WizardDialog wizardDialog = new WizardDialog(new Shell(), bWizard); if (wizardDialog.open() == Window.OK) { TransactionalEditingDomain dom = modelSet.getTransactionalEditingDomain(); if (selectedElement instanceof Package) { CompleteFeaturesArchitectureSnapshotCommand comd = new CompleteFeaturesArchitectureSnapshotCommand( dom, (Package) selectedElement, bWizard.getSelectedBundle()); dom.getCommandStack().execute(comd); } } return null; }
protected int showWizard( TaskModel taskModel, final IGeneratorConfiguration generatorConfiguration) { String title = null; WizardFragment fragment = null; taskModel.putObject(TaskModel.TASK_JM2T_PROJECT, JM2TCore.create(getProject())); if (generatorConfiguration == null) { // Add New generator configuration title = Messages.wizNewGeneratorConfigurationWizardTitle; fragment = new WizardFragment() { protected void createChildFragments(List<WizardFragment> list) { list.add(new SelectGeneratorTypeWizardFragment()); list.add(new SelectModelConverterTypeWizardFragment()); list.add(WizardTaskUtil.SaveRuntimeFragment); } }; } else { // Edit selected generator configuration title = Messages.wizEditGeneratorConfigurationWizardTitle; final WizardFragment fragment2 = getEditGeneratorConfigurationWizardFragment(generatorConfiguration); taskModel.putObject(TaskModel.TASK_GENERATOR_CONFIGURATION, generatorConfiguration); fragment = new WizardFragment() { protected void createChildFragments(List<WizardFragment> list) { list.add(fragment2); list.add(WizardTaskUtil.SaveRuntimeFragment); } }; } TaskWizard wizard = new TaskWizard(title, fragment, taskModel); wizard.setForcePreviousAndNextButtons(true); WizardDialog dialog = new WizardDialog(getShell(), wizard); return dialog.open(); }
@Override protected void doRun() { RepositoryNode routineNode = getCurrentRepositoryNode(); if (isToolbar()) { if (routineNode != null && routineNode.getContentType() != ERepositoryObjectType.PIG_UDF) { routineNode = null; } if (routineNode == null) { routineNode = getRepositoryNodeForDefault(ERepositoryObjectType.PIG_UDF); } } RepositoryNode node = null; IPath path = null; if (!isToolbar()) { ISelection selection = getSelection(); Object obj = ((IStructuredSelection) selection).getFirstElement(); node = (RepositoryNode) obj; path = RepositoryNodeUtilities.getPath(node); } NewPigudfWizard routineWizard = new NewPigudfWizard(path); WizardDialog dlg = new WizardDialog(Display.getCurrent().getActiveShell(), routineWizard); if (dlg.open() == Window.OK) { try { openRoutineEditor(routineWizard.getPigudf(), false); } catch (PartInitException e) { MessageBoxExceptionHandler.process(e); } catch (SystemException e) { MessageBoxExceptionHandler.process(e); } } }
private void handleNewIntro() { boolean needNewProduct = false; if (!productDefined()) { needNewProduct = true; MessageDialog mdiag = new MessageDialog( PDEPlugin.getActiveWorkbenchShell(), PDEUIMessages.IntroSection_undefinedProductId, null, PDEUIMessages.IntroSection_undefinedProductIdMessage, MessageDialog.QUESTION, new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL}, 0); if (mdiag.open() != Window.OK) return; } ProductIntroWizard wizard = new ProductIntroWizard(getProduct(), needNewProduct); WizardDialog dialog = new WizardDialog(PDEPlugin.getActiveWorkbenchShell(), wizard); dialog.create(); if (dialog.open() == Window.OK) { String id = wizard.getIntroId(); fIntroCombo.add(id, 0); fIntroCombo.setText(id); getIntroInfo().setId(id); addDependenciesAndPlugins(); } }
protected void createNewFileFromTemplate(final TemplateElement template) { IStructuredSelection selection = getActiveSelection(); if (!selection.isEmpty()) { Object element = selection.getFirstElement(); if (element instanceof IAdaptable) { IFileStore fileStore = (IFileStore) ((IAdaptable) element).getAdapter(IFileStore.class); if (fileStore != null) { // this is a non-workspace selection String filetype = template.getFiletype(); // strips the leading * before . if there is one int index = filetype.lastIndexOf('.'); if (index > -1) { filetype = filetype.substring(index); } NewFileAction action = new NewFileAction("new_file" + filetype, template); // $NON-NLS-1$ action.updateSelection(selection); action.run(); return; } } } NewTemplateFileWizard wizard = new NewTemplateFileWizard(template); wizard.init(PlatformUI.getWorkbench(), selection); WizardDialog dialog = new WizardDialog(UIUtils.getActiveShell(), wizard); dialog.open(); }
public void run() { NewPHPClassWizard wizard = new NewPHPClassWizard(); wizard.init(window.getWorkbench(), getSelection()); WizardDialog wizardDialog = new WizardDialog(window.getShell(), wizard); wizardDialog.open(); }
/** * Adds a duplicate of the selected VM to the block * * @since 3.2 */ protected void copyVM() { IStructuredSelection selection = (IStructuredSelection) fVMList.getSelection(); Iterator<IVMInstall> it = selection.iterator(); ArrayList<VMStandin> newEntries = new ArrayList<VMStandin>(); while (it.hasNext()) { IVMInstall selectedVM = it.next(); // duplicate & add VM VMStandin standin = new VMStandin(selectedVM, createUniqueId(selectedVM.getVMInstallType())); standin.setName(generateName(selectedVM.getName())); EditVMInstallWizard wizard = new EditVMInstallWizard(standin, fVMs.toArray(new IVMInstall[fVMs.size()])); WizardDialog dialog = new WizardDialog(getShell(), wizard); int dialogResult = dialog.open(); if (dialogResult == Window.OK) { VMStandin result = wizard.getResult(); if (result != null) { newEntries.add(result); } } else if (dialogResult == Window.CANCEL) { // Canceling one wizard should cancel all subsequent wizards break; } } if (newEntries.size() > 0) { fVMs.addAll(newEntries); fVMList.refresh(); fVMList.setSelection(new StructuredSelection(newEntries.toArray())); } else { fVMList.setSelection(selection); } fVMList.refresh(true); }
@Override public void run() { File container; try { container = getSelectedContainer(); } catch (IOException e) { ExceptionUtil.handle(e); return; } if (container == null) { return; } final PublishResourceWizard publishLibrary = new PublishResourceWizard(container.getAbsolutePath()); WizardDialog dialog = new WizardDialog(UIUtil.getDefaultShell(), publishLibrary) { @Override protected void okPressed() { publishLibrary.setCopyFileRunnable( createCopyFileRunnable( publishLibrary.getSourceFile(), publishLibrary.getTargetFile())); super.okPressed(); } }; dialog.setPageSize(500, 250); if (dialog.open() == Window.OK) { fireResourceChanged(publishLibrary.getTargetFile().getAbsolutePath()); } }
/* (non-Javadoc) * @see org.eclipse.jface.action.Action#run() */ public void run() { Shell shell = getShell(); if (!doCreateProjectFirstOnEmptyWorkspace(shell)) { return; } try { INewWizard wizard = createWizard(); wizard.init(PlatformUI.getWorkbench(), getSelection()); WizardDialog dialog = new WizardDialog(shell, wizard); if (shell != null) { PixelConverter converter = new PixelConverter(shell); dialog.setMinimumPageSize( converter.convertWidthInCharsToPixels(70), converter.convertHeightInCharsToPixels(20)); } dialog.create(); int res = dialog.open(); if (res == Window.OK && wizard instanceof NewElementWizard) { fCreatedElement = ((NewElementWizard) wizard).getCreatedElement(); } notifyResult(res == Window.OK); } catch (CoreException e) { String title = NewWizardMessages.AbstractOpenWizardAction_createerror_title; String message = NewWizardMessages.AbstractOpenWizardAction_createerror_message; ExceptionHandler.handle(e, shell, title, message); } }
@Override public void run(IAction action) { try { IWorkbenchWindow windoow = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); RefactoringWizard wizard = new RefactoringWizard(); ITextSelection textSelection = getITextSelection(); int startLine = textSelection.getStartLine() + 1; int endLine = textSelection.getEndLine() + 1; InOneMethodVisitor iomv = new InOneMethodVisitor(getICompilationUnit(), startLine, endLine); if (iomv.isInOne()) { wizard.init(windoow.getWorkbench(), getICompilationUnit(), getITextSelection()); WizardDialog dialog = new WizardDialog(shell, wizard); dialog.open(); } else { throw new Exception("Selected Code Block Illegal!"); } } catch (Exception e) { // TODO Auto-generated catch block alert(e); e.printStackTrace(); } }
/* * (non-Javadoc) * * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) */ public void run(IAction action) { WizardDialog dialog = new WizardDialog( Display.getCurrent().getActiveShell(), new CreateStackWizard(filePath, Mode.EstimateCost)); dialog.open(); }
/** Performs the edit VM action when the Edit... button is pressed */ private void editVM() { IStructuredSelection selection = (IStructuredSelection) fVMList.getSelection(); VMStandin vm = (VMStandin) selection.getFirstElement(); if (vm == null) { return; } if (JavaRuntime.isContributedVMInstall(vm.getId())) { VMDetailsDialog dialog = new VMDetailsDialog(getShell(), vm); dialog.open(); } else { EditVMInstallWizard wizard = new EditVMInstallWizard(vm, fVMs.toArray(new IVMInstall[fVMs.size()])); WizardDialog dialog = new WizardDialog(getShell(), wizard); if (dialog.open() == Window.OK) { VMStandin result = wizard.getResult(); if (result != null) { // replace with the edited VM int index = fVMs.indexOf(vm); fVMs.remove(index); fVMs.add(index, result); fVMList.setSelection(new StructuredSelection(result)); fVMList.refresh(true); } } } }
/** * @see * org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent) */ public Object execute(final ExecutionEvent executionEvent) throws ExecutionException { final IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(executionEvent); final NewTriggerWizard wizard = new NewTriggerWizard(); wizard.init(window.getWorkbench(), StructuredSelection.EMPTY); final WizardDialog wizardDialog = new STEMWizardDialog(window.getShell(), wizard); wizardDialog.open(); return null; } // execute
/** * The action has been activated. The argument of the method represents the 'real' action sitting * in the workbench UI. * * @see IWorkbenchWindowActionDelegate#run */ public void run(IAction action) { DVDStylerExportWizard wizard = new DVDStylerExportWizard(); WizardDialog dialog = new WizardDialog(window.getShell(), wizard); dialog.open(); }
@Override public Object execute(ExecutionEvent event) throws ExecutionException { WizardDialog dialog = new WizardDialog( HandlerUtil.getActiveWorkbenchWindow(event).getShell(), new CreateServerWizard()); dialog.open(); return null; }
public void linkActivated(HyperlinkEvent e) { WizardDialog dialog = new WizardDialog(getShell(), new DeploymentOptionWizard(getPUT())); if (dialog.open() == Window.OK) { markDirty(); } // TODO reset if cancel }
public Object execute(ExecutionEvent event) throws ExecutionException { // TODO copied from ProxiesViewControlsComposite, does the same as clicking the Button WizardDialog wizardDialog = new WizardDialog(Display.getCurrent().getActiveShell(), new AddProxyWizard()); wizardDialog.create(); wizardDialog.open(); return null; }
@Override public void run() { TakeCompilerWizard wizard = new TakeCompilerWizard(); wizard.getWp().setTitle(getToolTip()); Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); WizardDialog dialog = new WizardDialog(shell, wizard); dialog.create(); dialog.open(); }
public void setSizeAndLocation(WizardDialog wizardDialog) { wizardDialog.getShell().setSize(600, 500); Shell activeShell = this.window.getShell(); Rectangle bounds = activeShell.getBounds(); Rectangle rect = wizardDialog.getShell().getBounds(); int x = bounds.x + (bounds.width - rect.width) / 2; int y = bounds.y + (bounds.height - rect.height) / 2; wizardDialog.getShell().setLocation(x, y); }
/** Called when the action is executed. */ public void run(IAction action) { wizard = new P5ExportWizard(); IWorkbench wb = PlatformUI.getWorkbench(); wizard.init(wb, null); Shell shell = wb.getActiveWorkbenchWindow().getShell(); WizardDialog wd = new WizardDialog(shell, wizard); wd.open(); // System.err.println("WIZARD="+wizard); }
@Override protected Object execute(ExecutionEvent event, ContextHandlerEvent contextEvent) throws ExecutionException { IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event); AbstractWizard wizard = createWizard(event, contextEvent); WizardDialog dlg = new WizardDialog(window.getShell(), wizard); dlg.open(); return null; }