Java Code Examples for org.eclipse.jface.wizard.WizardDialog#create()
The following examples show how to use
org.eclipse.jface.wizard.WizardDialog#create() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NewLocationAction.java From RDFS with Apache License 2.0 | 6 votes |
@Override public void run() { WizardDialog dialog = new WizardDialog(null, new Wizard() { private HadoopLocationWizard page = new HadoopLocationWizard(); @Override public void addPages() { super.addPages(); setWindowTitle("New Hadoop location..."); addPage(page); } @Override public boolean performFinish() { page.performFinish(); return true; } }); dialog.create(); dialog.setBlockOnOpen(true); dialog.open(); super.run(); }
Example 2
Source File: AbstractPythonWizard.java From Pydev with Eclipse Public License 1.0 | 6 votes |
/** * Must be called in the UI thread. * @param sel will define what appears initially in the project/source folder/name. */ public static void startWizard(AbstractPythonWizard wizard, String title, IStructuredSelection sel) { IWorkbenchPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart(); wizard.init(part.getSite().getWorkbenchWindow().getWorkbench(), sel); wizard.setWindowTitle(title); Shell shell = part.getSite().getShell(); if (shell == null) { shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); } WizardDialog dialog = new WizardDialog(shell, wizard); dialog.setPageSize(350, 500); dialog.setHelpAvailable(false); dialog.create(); dialog.open(); }
Example 3
Source File: UpdateHandler.java From elexis-3-core with Eclipse Public License 1.0 | 6 votes |
protected void doExecute(LoadMetadataRepositoryJob job){ if (hasNoRepos) { return; } UpdateOperation operation = getProvisioningUI().getUpdateOperation(null, null); // check for updates operation.resolveModal(null); if (getProvisioningUI().getPolicy().continueWorkingWithOperation(operation, getShell())) { if (UpdateSingleIUWizard.validFor(operation)) { // Special case for only updating a single root UpdateSingleIUWizard wizard = new UpdateSingleIUWizard(getProvisioningUI(), operation); WizardDialog dialog = new WizardDialog(getShell(), wizard); dialog.create(); dialog.open(); } else { // Open the normal version of the update wizard getProvisioningUI().openUpdateWizard(false, operation, job); } } }
Example 4
Source File: EditWorkingSetAction.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@Override public void run() { Shell shell= getShell(); IWorkingSetManager manager= PlatformUI.getWorkbench().getWorkingSetManager(); IWorkingSet workingSet= fActionGroup.getWorkingSet(); if (workingSet == null || workingSet.isAggregateWorkingSet()) { setEnabled(false); return; } IWorkingSetEditWizard wizard= manager.createWorkingSetEditWizard(workingSet); if (wizard == null) { String title= WorkingSetMessages.EditWorkingSetAction_error_nowizard_title; String message= WorkingSetMessages.EditWorkingSetAction_error_nowizard_message; MessageDialog.openError(shell, title, message); return; } WizardDialog dialog= new WizardDialog(shell, wizard); dialog.create(); if (dialog.open() == Window.OK) fActionGroup.setWorkingSet(wizard.getSelection(), true); }
Example 5
Source File: WorkingSetConfigurationDialog.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private void createWorkingSet() { IWorkingSetManager manager= PlatformUI.getWorkbench().getWorkingSetManager(); IWorkingSetNewWizard wizard= manager.createWorkingSetNewWizard(new String[] {IWorkingSetIDs.JAVA}); // the wizard can't be null since we have at least the Java working set. WizardDialog dialog= new WizardDialog(getShell(), wizard); dialog.create(); if (dialog.open() == Window.OK) { IWorkingSet workingSet= wizard.getSelection(); if (WorkingSetModel.isSupportedAsTopLevelElement(workingSet)) { fAllWorkingSets.add(workingSet); fTableViewer.add(workingSet); fTableViewer.setSelection(new StructuredSelection(workingSet), true); fTableViewer.setChecked(workingSet, true); manager.addWorkingSet(workingSet); fAddedWorkingSets.add(workingSet); } } }
Example 6
Source File: AbstractOpenWizardAction.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@Override 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); PixelConverter converter= new PixelConverter(JFaceResources.getDialogFont()); 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); } }
Example 7
Source File: ProcessDiagramEditorUtil.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * Runs the wizard in a dialog. * * @generated */ public static void runWizard(Shell shell, Wizard wizard, String settingsKey) { IDialogSettings pluginDialogSettings = ProcessDiagramEditorPlugin.getInstance().getDialogSettings(); IDialogSettings wizardDialogSettings = pluginDialogSettings.getSection(settingsKey); if (wizardDialogSettings == null) { wizardDialogSettings = pluginDialogSettings.addNewSection(settingsKey); } wizard.setDialogSettings(wizardDialogSettings); WizardDialog dialog = new WizardDialog(shell, wizard); dialog.create(); dialog.getShell().setSize(Math.max(500, dialog.getShell().getSize().x), 500); dialog.open(); }
Example 8
Source File: ClasspathContainerWizard.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public static int openWizard(Shell shell, ClasspathContainerWizard wizard) { WizardDialog dialog= new WizardDialog(shell, wizard); PixelConverter converter= new PixelConverter(JFaceResources.getDialogFont()); dialog.setMinimumPageSize(converter.convertWidthInCharsToPixels(70), converter.convertHeightInCharsToPixels(20)); dialog.create(); return dialog.open(); }
Example 9
Source File: JarImportWizardAction.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * {@inheritDoc} */ public void run(final IAction action) { if (fWorkbenchPart == null || fSelection == null) return; final IImportWizard wizard= new JarImportWizard(false); final IWorkbenchWindow window= fWorkbenchPart.getSite().getWorkbenchWindow(); wizard.init(window.getWorkbench(), fSelection); final WizardDialog dialog= new WizardDialog(window.getShell(), wizard); dialog.create(); dialog.getShell().setSize(Math.max(SIZING_WIZARD_WIDTH, dialog.getShell().getSize().x), SIZING_WIZARD_HEIGHT); PlatformUI.getWorkbench().getHelpSystem().setHelp(dialog.getShell(), IJavaHelpContextIds.JARIMPORT_WIZARD_PAGE); dialog.open(); }
Example 10
Source File: EditLocationAction.java From hadoop-gpu with Apache License 2.0 | 5 votes |
@Override public void run() { final HadoopServer server = serverView.getSelectedServer(); if (server == null) return; WizardDialog dialog = new WizardDialog(null, new Wizard() { private HadoopLocationWizard page = new HadoopLocationWizard(server); @Override public void addPages() { super.addPages(); setWindowTitle("Edit Hadoop location..."); addPage(page); } @Override public boolean performFinish() { page.performFinish(); return true; } }); dialog.create(); dialog.setBlockOnOpen(true); dialog.open(); super.run(); }
Example 11
Source File: MigrateJarFileAction.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * {@inheritDoc} */ public void run(final IAction action) { if (fWindow != null) { final JarImportWizard wizard= new JarImportWizard(true); final ISelection selection= fWindow.getSelectionService().getSelection(); if (selection instanceof IStructuredSelection) wizard.init(fWindow.getWorkbench(), (IStructuredSelection) selection); final WizardDialog dialog= new WizardDialog(fWindow.getShell(), wizard); dialog.create(); dialog.getShell().setSize(Math.max(SIZING_WIZARD_WIDTH, dialog.getShell().getSize().x), SIZING_WIZARD_HEIGHT); PlatformUI.getWorkbench().getHelpSystem().setHelp(dialog.getShell(), IJavaHelpContextIds.JARIMPORT_WIZARD_PAGE); dialog.open(); } }
Example 12
Source File: OpenNewMRProjectAction.java From RDFS with Apache License 2.0 | 5 votes |
@Override public void run() { IWorkbench workbench = PlatformUI.getWorkbench(); Shell shell = workbench.getActiveWorkbenchWindow().getShell(); NewMapReduceProjectWizard wizard = new NewMapReduceProjectWizard(); wizard.init(workbench, new StructuredSelection()); WizardDialog dialog = new WizardDialog(shell, wizard); dialog.create(); dialog.open(); // did the wizard succeed? notifyResult(dialog.getReturnCode() == Window.OK); }
Example 13
Source File: JavaScriptVisualizeSelectedDiagramsHandler.java From txtUML with Eclipse Public License 1.0 | 5 votes |
@Override public Object execute(ExecutionEvent event) throws ExecutionException { JavaScriptVisualizeWizard wizard = new JavaScriptVisualizeWizard(); WizardDialog wizardDialog = new WizardDialog(null, wizard); wizardDialog.create(); VisualizeTxtUMLPage page = ((VisualizeTxtUMLPage) wizardDialog.getSelectedPage()); // get selected files ISelection selection = HandlerUtil.getCurrentSelection(event); IStructuredSelection strSelection = (IStructuredSelection) selection; List<ICompilationUnit> selectedCompilationUnits = new ArrayList<>(); Stream.of(strSelection.toArray()).forEach(s -> selectedCompilationUnits .add((ICompilationUnit) ((IAdaptable) s).getAdapter(ICompilationUnit.class))); try { List<IType> types = new ArrayList<>(); for (ICompilationUnit cu : selectedCompilationUnits) { types.addAll(Arrays.asList(cu.getTypes())); } page.selectElementsInDiagramTree(types.toArray(), false); page.setExpandedLayouts(types); } catch (JavaModelException ex) { } wizardDialog.open(); return null; }
Example 14
Source File: UpdateDetailsPresenter.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 5 votes |
@Override protected void doExecute(LoadMetadataRepositoryJob job) { try { // Save the global settings that we will modify saveSettings(); // Modify those settings prepareWizardSettings(); // Boilerplate for opening the wizard InstallWizard wizard = new InstallWizard(getProvisioningUI(), null, null, job); WizardDialog dialog = new ProvisioningWizardDialog(getShell(), wizard); dialog.create(); PlatformUI.getWorkbench().getHelpSystem().setHelp(dialog.getShell(), IProvHelpContextIds.INSTALL_WIZARD); prepareWizard(wizard); // Open it dialog.open(); } catch (Exception e) { throw new RuntimeException(e); } finally { // Restore the settings which we touched restoreSettings(); } }
Example 15
Source File: AbstractOpenWizardAction.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 5 votes |
@Override public void run() { Shell localShell = getShell(); if (!doCreateProjectFirstOnEmptyWorkspace(localShell)) { return; } try { INewWizard wizard = createWizard(); wizard.init(PlatformUI.getWorkbench(), getSelection()); WizardDialog dialog = new WizardDialog(localShell, wizard); IPixelConverter converter = PixelConverterFactory.createPixelConverter(JFaceResources.getDialogFont()); dialog.setMinimumPageSize(converter.convertWidthInCharsToPixels(70), converter.convertHeightInCharsToPixels(20)); dialog.create(); int res = dialog.open(); if (res == Window.OK && wizard instanceof NewElementWizard) { createdElement = ((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, localShell, title, message); } }
Example 16
Source File: OpenNewMRClassWizardAction.java From RDFS with Apache License 2.0 | 5 votes |
public void run(String[] params, ICheatSheetManager manager) { if ((params != null) && (params.length > 0)) { IWorkbench workbench = PlatformUI.getWorkbench(); INewWizard wizard = getWizard(params[0]); wizard.init(workbench, new StructuredSelection()); WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getShell(), wizard); dialog.create(); dialog.open(); // did the wizard succeed ? notifyResult(dialog.getReturnCode() == Window.OK); } }
Example 17
Source File: ContractConstraintExpressionWizardPageTest.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @throws java.lang.Exception */ @Before public void setUp() throws Exception { constraint = ProcessFactory.eINSTANCE.createContractConstraint(); constraint.setExpression(""); final Contract c = ProcessFactory.eINSTANCE.createContract(); c.getConstraints().add(constraint); final ContractInput name = ProcessFactory.eINSTANCE.createContractInput(); name.setName("name"); c.getInputs().add(name); composite = realm.createComposite(); final SourceViewer sourceViewer = new SourceViewer(composite, null, SWT.NONE); sourceViewer.setDocument(new Document()); when(groovyViewer.getSourceViewer()).thenReturn(sourceViewer); when(editorFactory.newInstance()).thenReturn(editor); when(groovySourceViewerFactory.createSourceViewer(any(Composite.class), any(BonitaGroovyEditor.class))).thenReturn(groovyViewer); wizardPage = new ContractConstraintExpressionWizardPage(constraint, c.getInputs(), groovySourceViewerFactory, editorFactory, browserFactory); final ContractConstraintExpressionWizard wizard = new ContractConstraintExpressionWizard(constraint, null); final WizardDialog wizardContainer = new WizardDialog(composite.getShell(), wizard) { @Override protected Control createContents(final Composite parent) { return null; } }; wizardContainer.create(); assertThat(wizardContainer.getShell()).isNotNull(); wizard.setContainer(wizardContainer); wizardPage.setWizard(wizard); }
Example 18
Source File: CreateSourceFolderAction.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
@Override public void run() { Shell shell= getShell(); try { IJavaProject javaProject= (IJavaProject)getSelectedElements().get(0); CPListElement newEntrie= new CPListElement(javaProject, IClasspathEntry.CPE_SOURCE); CPListElement[] existing= CPListElement.createFromExisting(javaProject); boolean isProjectSrcFolder= CPListElement.isProjectSourceFolder(existing, javaProject); AddSourceFolderWizard wizard= new AddSourceFolderWizard(existing, newEntrie, getOutputLocation(javaProject), false, false, false, isProjectSrcFolder, isProjectSrcFolder); wizard.init(PlatformUI.getWorkbench(), new StructuredSelection(javaProject)); WizardDialog dialog= new WizardDialog(shell, wizard); PixelConverter converter= new PixelConverter(JFaceResources.getDialogFont()); dialog.setMinimumPageSize(converter.convertWidthInCharsToPixels(70), converter.convertHeightInCharsToPixels(20)); dialog.create(); int res= dialog.open(); if (res == Window.OK) { BuildpathDelta delta= new BuildpathDelta(getToolTipText()); ArrayList<CPListElement> newEntries= wizard.getExistingEntries(); delta.setNewEntries(newEntries.toArray(new CPListElement[newEntries.size()])); IResource resource= wizard.getCreatedElement().getCorrespondingResource(); delta.addCreatedResource(resource); delta.setDefaultOutputLocation(wizard.getOutputLocation()); informListeners(delta); selectAndReveal(new StructuredSelection(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); } }
Example 19
Source File: WizardLauncher.java From codewind-eclipse with Eclipse Public License 2.0 | 4 votes |
/** * Useful when the wizard to be launched does not care about the workbench or selection. * Do not use with the Link Wizard since it requires these. */ public static void launchWizardWithoutSelection(Wizard wizard) { WizardDialog dialog = new WizardDialog(Display.getDefault().getActiveShell(), wizard); dialog.create(); dialog.open(); }
Example 20
Source File: CreateLinkedSourceFolderAction.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
@Override public void run() { Shell shell= getShell(); try { IJavaProject javaProject= (IJavaProject)getSelectedElements().get(0); CPListElement newEntrie= new CPListElement(javaProject, IClasspathEntry.CPE_SOURCE); CPListElement[] existing= CPListElement.createFromExisting(javaProject); boolean isProjectSrcFolder= CPListElement.isProjectSourceFolder(existing, javaProject); AddSourceFolderWizard wizard= new AddSourceFolderWizard(existing, newEntrie, getOutputLocation(javaProject), true, false, false, isProjectSrcFolder, isProjectSrcFolder); wizard.init(PlatformUI.getWorkbench(), new StructuredSelection(javaProject)); WizardDialog dialog= new WizardDialog(shell, wizard); PixelConverter converter= new PixelConverter(JFaceResources.getDialogFont()); dialog.setMinimumPageSize(converter.convertWidthInCharsToPixels(70), converter.convertHeightInCharsToPixels(20)); dialog.create(); int res= dialog.open(); if (res == Window.OK) { BuildpathDelta delta= new BuildpathDelta(getToolTipText()); ArrayList<CPListElement> newEntries= wizard.getExistingEntries(); delta.setNewEntries(newEntries.toArray(new CPListElement[newEntries.size()])); IResource resource= wizard.getCreatedElement().getCorrespondingResource(); delta.addCreatedResource(resource); delta.setDefaultOutputLocation(wizard.getOutputLocation()); informListeners(delta); selectAndReveal(new StructuredSelection(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); } }