Skip to content

Instantly share code, notes, and snippets.

@turesheim
Created May 5, 2011 06:47
Show Gist options
  • Save turesheim/956648 to your computer and use it in GitHub Desktop.
Save turesheim/956648 to your computer and use it in GitHub Desktop.
Invoking Eclipse Wizard programmatically
public void openWizard(String id) {
// 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) {
IWizard wizard = descriptor.createWizard();
WizardDialog wd = new WizardDialog(getStandardDisplay()
.getActiveShell(), wizard);
wd.setTitle(wizard.getWindowTitle());
wd.open();
}
} catch (CoreException e) {
e.printStackTrace();
}
}
@turesheim
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment