Java Code Examples for org.eclipse.ui.IWorkbenchWizard#init()
The following examples show how to use
org.eclipse.ui.IWorkbenchWizard#init() .
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: GamaNavigatorMenu.java From gama with GNU General Public License v3.0 | 6 votes |
public static void openWizard(final String id, final IStructuredSelection selection) { // First see if this is a "new wizard". IWizardDescriptor descriptor = PlatformUI.getWorkbench().getNewWizardRegistry().findWizard(id); // If not check if it is an "import wizard". if (descriptor == null) { descriptor = PlatformUI.getWorkbench().getImportWizardRegistry().findWizard(id); } // Or maybe an export wizard if (descriptor == null) { descriptor = PlatformUI.getWorkbench().getExportWizardRegistry().findWizard(id); } try { // Then if we have a wizard, open it. if (descriptor != null) { final IWorkbenchWizard wizard = descriptor.createWizard(); wizard.init(PlatformUI.getWorkbench(), selection); final WizardDialog wd = new WizardDialog(WorkbenchHelper.getDisplay().getActiveShell(), wizard); wd.setTitle(wizard.getWindowTitle()); wd.open(); } } catch (final CoreException e) { e.printStackTrace(); } }
Example 2
Source File: CreateNewN4JSElementInModuleHandler.java From n4js with Eclipse Public License 1.0 | 5 votes |
/** * Opens the wizard with the given id and passes it the selection. * * @param wizardId * The wizard id of the eclipse newWizard registry * @param selection * The selection */ private void openWizardForModule(String wizardId, IStructuredSelection selection, boolean nested) { // Retrieve wizard from registry IWizardDescriptor wizardDescriptor = PlatformUI.getWorkbench().getNewWizardRegistry().findWizard(wizardId); if (wizardDescriptor == null) { return; } try { IWorkbenchWizard wizard = wizardDescriptor.createWizard(); // Inject wizard members injector.injectMembers(wizard); // Create and open a new wizard dialog WizardDialog wizardDialog = new WizardDialog(UIUtils.getShell(), wizard); // If the wizard supports it, enable in module option if (wizard instanceof N4JSNewClassifierWizard<?>) { ((N4JSNewClassifierWizard<?>) wizard).init(PlatformUI.getWorkbench(), selection, nested); } else { // Otherwise just pass it the initial selection wizard.init(PlatformUI.getWorkbench(), selection); } // wizardDialog.setTitle(wizard.getWindowTitle()); wizardDialog.open(); } catch (CoreException e) { /** Failed to create the wizard */ Shell workbenchShell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); MessageDialog.open(MessageDialog.ERROR, workbenchShell, "Failed to launch wizard", String.format("Failed to launch wizard %s", wizardId), SWT.SHEET); return; } }
Example 3
Source File: WriteAttributesOperationAction.java From neoscada with Eclipse Public License 1.0 | 5 votes |
@Override public void run ( final IAction action ) { if ( this.selection == null ) { return; } final IWorkbenchWizard wiz = new WriteAttributesOperationWizard (); wiz.init ( this.site.getWorkbenchWindow ().getWorkbench (), this.selection ); // Embed the wizard into a dialog final WizardDialog dialog = new WizardDialog ( this.site.getShell (), wiz ); dialog.open (); }
Example 4
Source File: WriteOperationAction.java From neoscada with Eclipse Public License 1.0 | 5 votes |
@Override public void run ( final IAction action ) { if ( this.selection == null ) { return; } final IWorkbenchWizard wiz = new WriteOperationWizard (); wiz.init ( this.site.getWorkbenchWindow ().getWorkbench (), this.selection ); // Embed the wizard into a dialog final WizardDialog dialog = new WizardDialog ( this.site.getShell (), wiz ); dialog.open (); }
Example 5
Source File: CreateTargetQueries.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
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; }