Search in sources :

Example 1 with IWizardDescriptor

use of org.eclipse.ui.wizards.IWizardDescriptor in project meclipse by flaper87.

the class MeclipsePlugin method openWizard.

/**
	 * Stolen from
	 * http://torkildr.blogspot.com/2010/07/invoking-eclipse-wizard.html
	 * 
	 * @param id
	 */
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(PlatformUI.getWorkbench().getDisplay().getActiveShell(), wizard);
            wd.setTitle(wizard.getWindowTitle());
            wd.open();
        }
    } catch (CoreException e) {
        e.printStackTrace();
    }
}
Also used : IWizardDescriptor(org.eclipse.ui.wizards.IWizardDescriptor) CoreException(org.eclipse.core.runtime.CoreException) IWizard(org.eclipse.jface.wizard.IWizard) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Example 2 with IWizardDescriptor

use of org.eclipse.ui.wizards.IWizardDescriptor in project translationstudio8 by heartsome.

the class ApplicationWorkbenchWindowAdvisor method getAllWizards.

private IWizardDescriptor[] getAllWizards(IWizardCategory... categories) {
    List<IWizardDescriptor> results = new ArrayList<IWizardDescriptor>();
    for (IWizardCategory wizardCategory : categories) {
        results.addAll(Arrays.asList(wizardCategory.getWizards()));
        results.addAll(Arrays.asList(getAllWizards(wizardCategory.getCategories())));
    }
    return results.toArray(new IWizardDescriptor[0]);
}
Also used : IWizardDescriptor(org.eclipse.ui.wizards.IWizardDescriptor) ArrayList(java.util.ArrayList) IWizardCategory(org.eclipse.ui.wizards.IWizardCategory)

Aggregations

IWizardDescriptor (org.eclipse.ui.wizards.IWizardDescriptor)2 ArrayList (java.util.ArrayList)1 CoreException (org.eclipse.core.runtime.CoreException)1 IWizard (org.eclipse.jface.wizard.IWizard)1 WizardDialog (org.eclipse.jface.wizard.WizardDialog)1 IWizardCategory (org.eclipse.ui.wizards.IWizardCategory)1