Created
May 5, 2011 06:47
-
-
Save turesheim/956648 to your computer and use it in GitHub Desktop.
Invoking Eclipse Wizard programmatically
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See the original blog post at http://torkildr.blogspot.com/2010/07/invoking-eclipse-wizard.html