private IWizardPage[] openNewElementWizard( IWorkbenchWizard wizard, Shell shell, Object selection) { wizard.init(JavaPlugin.getDefault().getWorkbench(), new StructuredSelection(selection)); WizardDialog dialog = new WizardDialog(shell, wizard); PixelConverter converter = new PixelConverter(JFaceResources.getDialogFont()); dialog.setMinimumPageSize( converter.convertWidthInCharsToPixels(70), converter.convertHeightInCharsToPixels(20)); dialog.create(); dialog.open(); IWizardPage[] pages = wizard.getPages(); return pages; }
protected void createNewODProject() { final IWizardDescriptor descriptor = WizardFinder.findNewWizardDescriptor( "org.gemoc.xdsmlframework.extensions.sirius.wizards.NewGemocSiriusProjectWizard"); // Then if we have a wizard, open it. if (descriptor != null) { NewProjectWorkspaceListener workspaceListener = new NewProjectWorkspaceListener(); ResourcesPlugin.getWorkspace().addResourceChangeListener(workspaceListener); try { IWorkbenchWizard wizard; wizard = descriptor.createWizard(); ((NewGemocSiriusProjectWizard) wizard) .setInitialProjectName(XDSMLProjectHelper.baseProjectName(gemocLanguageIProject)); IWorkbench workbench = PlatformUI.getWorkbench(); wizard.init(workbench, null); WizardDialog wd = new WizardDialog(workbench.getActiveWorkbenchWindow().getShell(), wizard); wd.create(); wd.setTitle(wizard.getWindowTitle()); int res = wd.open(); if (res == WizardDialog.OK) { ResourcesPlugin.getWorkspace().removeResourceChangeListener(workspaceListener); createdProject = workspaceListener.getLastCreatedProject(); // update the project configuration model if (createdProject != null) { SiriusEditorProject editorProject = Xdsml_baseFactoryImpl.eINSTANCE.createSiriusEditorProject(); editorProject.setProjectName(createdProject.getName()); addOrUpdateProjectToConf(editorProject); } else { Activator.error("not able to detect which project was created by wizard", null); } } } catch (CoreException e) { Activator.error(e.getMessage(), e); } finally { ResourcesPlugin.getWorkspace().removeResourceChangeListener(workspaceListener); } } else { Activator.error( "wizard with id=org.eclipse.sirius.ui.specificationproject.wizard not found", null); } }