Java 类org.eclipse.ui.wizards.IWizardDescriptor 实例源码

项目:Open_Source_ECOA_Toolset_AS5    文件:ServicesWizardCommand.java   
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    IWizardDescriptor descriptor = PlatformUI.getWorkbench().getNewWizardRegistry().findWizard(ID);
    if (descriptor == null) {
        descriptor = PlatformUI.getWorkbench().getImportWizardRegistry().findWizard(ID);
    }
    if (descriptor == null) {
        descriptor = PlatformUI.getWorkbench().getExportWizardRegistry().findWizard(ID);
    }
    try {
        if (descriptor != null) {
            IWizard wizard = descriptor.createWizard();
            WizardDialog wd = new WizardDialog(Display.getDefault().getActiveShell(), wizard);
            wd.setTitle(wizard.getWindowTitle());
            wd.open();
        }
    } catch (CoreException e) {
        e.printStackTrace();
    }
    return null;
}
项目:Open_Source_ECOA_Toolset_AS5    文件:CompDefWizardCommand.java   
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    IWizardDescriptor descriptor = PlatformUI.getWorkbench().getNewWizardRegistry().findWizard(ID);
    if (descriptor == null) {
        descriptor = PlatformUI.getWorkbench().getImportWizardRegistry().findWizard(ID);
    }
    if (descriptor == null) {
        descriptor = PlatformUI.getWorkbench().getExportWizardRegistry().findWizard(ID);
    }
    try {
        if (descriptor != null) {
            IWizard wizard = descriptor.createWizard();
            WizardDialog wd = new WizardDialog(Display.getDefault().getActiveShell(), wizard);
            wd.setTitle(wizard.getWindowTitle());
            wd.open();
        }
    } catch (CoreException e) {
        e.printStackTrace();
    }
    return null;
}
项目:Open_Source_ECOA_Toolset_AS5    文件:InitAssmblWizardCommand.java   
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    IWizardDescriptor descriptor = PlatformUI.getWorkbench().getNewWizardRegistry().findWizard(ID);
    if (descriptor == null) {
        descriptor = PlatformUI.getWorkbench().getImportWizardRegistry().findWizard(ID);
    }
    if (descriptor == null) {
        descriptor = PlatformUI.getWorkbench().getExportWizardRegistry().findWizard(ID);
    }
    try {
        if (descriptor != null) {
            IWizard wizard = descriptor.createWizard();
            WizardDialog wd = new WizardDialog(Display.getDefault().getActiveShell(), wizard);
            wd.setTitle(wizard.getWindowTitle());
            wd.open();
        }
    } catch (CoreException e) {
        e.printStackTrace();
    }
    return null;
}
项目:Open_Source_ECOA_Toolset_AS5    文件:LogicalSysWizardCommand.java   
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    IWizardDescriptor descriptor = PlatformUI.getWorkbench().getNewWizardRegistry().findWizard(ID);
    if (descriptor == null) {
        descriptor = PlatformUI.getWorkbench().getImportWizardRegistry().findWizard(ID);
    }
    if (descriptor == null) {
        descriptor = PlatformUI.getWorkbench().getExportWizardRegistry().findWizard(ID);
    }
    try {
        if (descriptor != null) {
            IWizard wizard = descriptor.createWizard();
            WizardDialog wd = new WizardDialog(Display.getDefault().getActiveShell(), wizard);
            wd.setTitle(wizard.getWindowTitle());
            wd.open();
        }
    } catch (CoreException e) {
        e.printStackTrace();
    }
    return null;
}
项目:Open_Source_ECOA_Toolset_AS5    文件:CompImplWizardCommand.java   
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    IWizardDescriptor descriptor = PlatformUI.getWorkbench().getNewWizardRegistry().findWizard(ID);
    if (descriptor == null) {
        descriptor = PlatformUI.getWorkbench().getImportWizardRegistry().findWizard(ID);
    }
    if (descriptor == null) {
        descriptor = PlatformUI.getWorkbench().getExportWizardRegistry().findWizard(ID);
    }
    try {
        if (descriptor != null) {
            IWizard wizard = descriptor.createWizard();
            WizardDialog wd = new WizardDialog(Display.getDefault().getActiveShell(), wizard);
            wd.setTitle(wizard.getWindowTitle());
            wd.open();
        }
    } catch (CoreException e) {
        e.printStackTrace();
    }
    return null;
}
项目:Open_Source_ECOA_Toolset_AS5    文件:FinalAssmblWizardCommand.java   
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    IWizardDescriptor descriptor = PlatformUI.getWorkbench().getNewWizardRegistry().findWizard(ID);
    if (descriptor == null) {
        descriptor = PlatformUI.getWorkbench().getImportWizardRegistry().findWizard(ID);
    }
    if (descriptor == null) {
        descriptor = PlatformUI.getWorkbench().getExportWizardRegistry().findWizard(ID);
    }
    try {
        if (descriptor != null) {
            IWizard wizard = descriptor.createWizard();
            WizardDialog wd = new WizardDialog(Display.getDefault().getActiveShell(), wizard);
            wd.setTitle(wizard.getWindowTitle());
            wd.open();
        }
    } catch (CoreException e) {
        e.printStackTrace();
    }
    return null;
}
项目:Open_Source_ECOA_Toolset_AS5    文件:DeployWizardCommand.java   
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    IWizardDescriptor descriptor = PlatformUI.getWorkbench().getNewWizardRegistry().findWizard(ID);
    if (descriptor == null) {
        descriptor = PlatformUI.getWorkbench().getImportWizardRegistry().findWizard(ID);
    }
    if (descriptor == null) {
        descriptor = PlatformUI.getWorkbench().getExportWizardRegistry().findWizard(ID);
    }
    try {
        if (descriptor != null) {
            IWizard wizard = descriptor.createWizard();
            WizardDialog wd = new WizardDialog(Display.getDefault().getActiveShell(), wizard);
            wd.setTitle(wizard.getWindowTitle());
            wd.open();
        }
    } catch (CoreException e) {
        e.printStackTrace();
    }
    return null;
}
项目:Open_Source_ECOA_Toolset_AS5    文件:TypesWizardCommand.java   
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    IWizardDescriptor descriptor = PlatformUI.getWorkbench().getNewWizardRegistry().findWizard(ID);
    if (descriptor == null) {
        descriptor = PlatformUI.getWorkbench().getImportWizardRegistry().findWizard(ID);
    }
    if (descriptor == null) {
        descriptor = PlatformUI.getWorkbench().getExportWizardRegistry().findWizard(ID);
    }
    try {
        if (descriptor != null) {
            IWizard wizard = descriptor.createWizard();
            WizardDialog wd = new WizardDialog(Display.getDefault().getActiveShell(), wizard);
            wd.setTitle(wizard.getWindowTitle());
            wd.open();
        }
    } catch (CoreException e) {
        e.printStackTrace();
    }
    return null;
}
项目:Hydrograph    文件:SubJobUtility.java   
/**
 * Open sub graph save dialog.
 * 
 * @return the i file
 */
public IFile openSubJobSaveDialog() {
    IFile iFile = null;
    IWizardDescriptor descriptor = PlatformUI.getWorkbench().getNewWizardRegistry().findWizard(Messages.JOB_WIZARD_ID);
    if (descriptor != null) {
        IWizard wizard = null;
        try {
            wizard = descriptor.createWizard();
        } catch (CoreException coreException) {
            logger.error("Error while opening create job wizard", coreException);
        }
        WizardDialog wizardDialog = new WizardDialog(Display.getDefault().getActiveShell(), wizard);
        wizardDialog.setTitle(wizard.getWindowTitle());
        wizardDialog.open();
        JobCreationPage jobCreationPage = (JobCreationPage) wizardDialog.getSelectedPage();
        iFile = jobCreationPage.getNewFile();
    }
    return iFile;
}
项目:statecharts    文件:OpenExampleIntroAction.java   
public void openWizard(String id) {
    IWizardDescriptor descriptor = PlatformUI.getWorkbench()
            .getNewWizardRegistry().findWizard(id);
    if (descriptor == null) {
        descriptor = PlatformUI.getWorkbench().getImportWizardRegistry()
                .findWizard(id);
    }
    if (descriptor == null) {
        descriptor = PlatformUI.getWorkbench().getExportWizardRegistry()
                .findWizard(id);
    }
    try {
        if (descriptor != null) {
            IWizard wizard = descriptor.createWizard();
            WizardDialog wd = new WizardDialog(Display.getDefault()
                    .getActiveShell(), wizard);
            wd.setTitle(wizard.getWindowTitle());
            wd.open();
        }
    } catch (CoreException e) {
        e.printStackTrace();
    }
}
项目:gama    文件:GamaNavigatorMenu.java   
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();
    }
}
项目:developer-studio    文件:GetWizardIconDataFunction.java   
public String getImagaeData(String id) throws CoreException {
    // 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);
    }
    // Then if we have a wizard, open it.
    if (descriptor != null) {       
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        ImageLoader loader = new ImageLoader();
        loader.data = new ImageData[] { descriptor.getImageDescriptor().getImageData() };
        loader.save(out, SWT.IMAGE_PNG);
        String base64 = Base64.encodeBase64String(out.toByteArray());
        return base64;
    }
    return null;
}
项目:developer-studio    文件:GetWizardDescriptionFunction.java   
public String getDescription(String id) throws CoreException {
    // 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);
    }
    // Then if we have a wizard, open it.
    if (descriptor != null) {
        //IWizard wizard = descriptor.createWizard();
        return descriptor.getDescription();
    }
    return null;
}
项目:Environment    文件:OpenWizardHandler.java   
@Execute
public void execute(@Named("eu.cloudscaleproject.env.common.command.openwizard.param.id") String wizardID) {

    IWizardDescriptor descriptor = PlatformUI.getWorkbench().getNewWizardRegistry()
            .findWizard(wizardID);

    if(descriptor != null){
        try {
            IWorkbenchWizard wizard = (IWorkbenchWizard)descriptor.createWizard();
            wizard.init(PlatformUI.getWorkbench(), null);

            WizardDialog wd = new  WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), wizard);
            wd.setTitle(wizard.getWindowTitle());
            wd.open();
        } catch (CoreException e) {
            e.printStackTrace();
        }
    }

}
项目:Environment    文件:CreateNewProjectHadler.java   
@Execute
public void execute(CommandExecutor commandExecutor) {

    IWizardDescriptor descriptor = PlatformUI.getWorkbench().getNewWizardRegistry()
            .findWizard("eu.cloudscaleproject.env.product.wizard.newproject");

    if(descriptor != null){
        try {
            IWorkbenchWizard wizard = (IWorkbenchWizard)descriptor.createWizard();
            wizard.init(PlatformUI.getWorkbench(), null);

            WizardDialog wd = new  WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), wizard);
            wd.setTitle(wizard.getWindowTitle());
            wd.open();
        } catch (CoreException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}
项目:Environment    文件:CreateNewExampleProjectHandler.java   
@Execute
public void execute(CommandExecutor commandExecutor) {

    IWizardDescriptor descriptor = PlatformUI.getWorkbench().getNewWizardRegistry()
            .findWizard("eu.cloudscaleproject.env.product.wizard.exampleproject");

    if(descriptor != null){
        try {
            IWorkbenchWizard wizard = (IWorkbenchWizard)descriptor.createWizard();
            wizard.init(PlatformUI.getWorkbench(), null);

            WizardDialog wd = new  WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), wizard);
            wd.setTitle(wizard.getWindowTitle());
            wd.open();
        } catch (CoreException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}
项目:maru    文件:ApplicationWorkbenchWindowAdvisor.java   
/**
 * Remove the wizard category 'General'.
 */
private void removeDefaultNewWizards()
{
    // based on:
    // http://stackoverflow.com/questions/11307367/how-to-remove-default-wizards-from-file-new-menu-in-rcp-application
    // http://www.eclipse.org/forums/index.php/t/261462

    AbstractExtensionWizardRegistry wizardRegistry = (AbstractExtensionWizardRegistry) PlatformUI.getWorkbench().getNewWizardRegistry();
    IWizardCategory[] categories = PlatformUI.getWorkbench().getNewWizardRegistry().getRootCategory().getCategories();

    for (IWizardDescriptor wizard : getAllWizards(categories))
    {
        if(wizard.getCategory().getId().matches("org.eclipse.ui.Basic"))
        {
            WorkbenchWizardElement wizardElement = (WorkbenchWizardElement) wizard;
            wizardRegistry.removeExtension(wizardElement.getConfigurationElement().getDeclaringExtension(), new Object[] { wizardElement });
        }
    }
}
项目:NIEM-Modeling-Tool    文件:CreatesAnExampleProject.java   
@Override
protected IProject createTheProject() throws Exception {
    final IWorkbench theWorkbench = get_the_workbench();
    final IWizardRegistry theNewWizardRegistry = theWorkbench.getNewWizardRegistry();
    final IWizardDescriptor wizardDescriptor = theNewWizardRegistry.findWizard(Activator.EXAMPLE_WIZARD_ID);

    final IWorkbenchWizard theWizard = wizardDescriptor.createWizard();
    theWizard.init(theWorkbench, StructuredSelection.EMPTY);

    final WizardDialog theDialog = new WizardDialog(null, theWizard);
    theDialog.setBlockOnOpen(false);
    theDialog.open();

    select_the_default_button(theDialog);

    return get_the_project(getTheProjectName());
}
项目:MMINT    文件:EditorImpl.java   
/**
 * Gets an editor instance creation wizard for this editor type.
 * 
 * @param initialSelection
 *            The selection used to initialize the wizard.
 * @return The editor creation wizard.
 * @throws MMINTException
 *             if the editor creation wizard couln't be found or
 *             initialized.
 * @generated NOT
 */
protected IWorkbenchWizard getInstanceWizard(IStructuredSelection initialSelection) throws MMINTException {

    Model modelType = MIDTypeRegistry.<Model>getType(getModelUri());
    IWorkbenchWizard wizard;
    if (getWizardId() == null) {
        EClass rootEClass = (EClass) modelType.getEMFTypeRoot().getEClassifiers().get(0);
        wizard = new DynamicModelWizard(rootEClass);
    }
    else {
        IWizardDescriptor descriptor = PlatformUI.getWorkbench().getNewWizardRegistry().findWizard(getWizardId());
        if (descriptor == null) {
            throw new MMINTException("Wizard " + getId() + " not found");
        }
        try {
            wizard = descriptor.createWizard();
        }
        catch (CoreException e) {
            throw new MMINTException("Error creating the wizard", e);
        }
    }
    wizard.init(PlatformUI.getWorkbench(), initialSelection);

    return wizard;
}
项目:olca-app    文件:ImportKmlAction.java   
@Override
public void run() {
    IWizardDescriptor descriptor = PlatformUI.getWorkbench().getImportWizardRegistry()
            .findWizard(KmlImportWizard.ID);
    if (descriptor == null)
        return;
    try {
        IWizard wizard = descriptor.createWizard();
        WizardDialog dialog = new WizardDialog(UI.shell(), wizard);
        dialog.setTitle(wizard.getWindowTitle());
        if (dialog.open() == WizardDialog.OK)
            Navigator.refresh(Navigator.findElement(ModelType.LOCATION));
    } catch (CoreException e1) {
        e1.printStackTrace();
    }
}
项目:olca-app    文件:ImportXmlKmlAction.java   
@Override
public void run() {
    IWizardDescriptor descriptor = PlatformUI.getWorkbench()
            .getImportWizardRegistry().findWizard(KmzImportWizard.ID);
    if (descriptor == null)
        return;
    try {
        IWizard wizard = descriptor.createWizard();
        WizardDialog dialog = new WizardDialog(UI.shell(), wizard);
        dialog.setTitle(wizard.getWindowTitle());
        if (dialog.open() == WizardDialog.OK)
            Navigator.refresh(Navigator.findElement(ModelType.LOCATION));
    } catch (CoreException e1) {
        e1.printStackTrace();
    }
}
项目:n4js    文件:CreateNewN4JSElementInModuleHandler.java   
/**
 * 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;
    }

}
项目:gemoc-studio    文件:WizardFinder.java   
static public IWizardDescriptor findNewWizardDescriptor(String wizardId)
{
    return PlatformUI
            .getWorkbench()
            .getNewWizardRegistry()
            .findWizard(wizardId);
}
项目:PDFReporter-Studio    文件:JSSWizardHandler.java   
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    String wizardId = getWizardIdParameterId();

    IWorkbenchWindow activeWindow = HandlerUtil.getActiveWorkbenchWindowChecked(event);

    if (wizardId == null) {
        IAction wizardAction = createWizardChooserDialogAction(activeWindow);
        wizardAction.run();
    } else {

        IWizardRegistry wizardRegistry = getWizardRegistry();
        IWizardDescriptor wizardDescriptor = wizardRegistry.findWizard(wizardId);
        if (wizardDescriptor == null) {
            throw new ExecutionException("unknown wizard: " + wizardId); //$NON-NLS-1$
        }

        try {
            IWorkbenchWizard wizard = wizardDescriptor.createWizard();
            ISelection selection = activeWindow.getSelectionService().getSelection();
            IStructuredSelection ss = selection instanceof IStructuredSelection ? (IStructuredSelection) selection
                    : StructuredSelection.EMPTY;
            wizard.init(PlatformUI.getWorkbench(), ss);

            if (wizardDescriptor.canFinishEarly() && !wizardDescriptor.hasPages()) {
                wizard.performFinish();
                return null;
            }

            Shell parent = activeWindow.getShell();
            createAndOpenWizardDialog(parent, wizard);

        } catch (CoreException ex) {
            throw new ExecutionException("error creating wizard", ex); //$NON-NLS-1$
        }

    }

    return null;
}
项目:gama    文件:CleanupHelper.java   
static private IWizardDescriptor[] getAllWizards(final IWizardCategory[] categories) {
    final List<IWizardDescriptor> results = new ArrayList<IWizardDescriptor>();
    for (final IWizardCategory wizardCategory : categories) {

        results.addAll(Arrays.asList(wizardCategory.getWizards()));
        results.addAll(Arrays.asList(getAllWizards(wizardCategory.getCategories())));
    }
    return results.toArray(new IWizardDescriptor[0]);
}
项目:CooperateModelingEnvironment    文件:CooperatePerspective.java   
private static void addNewWizards(IPageLayout layout) {
    Collection<String> cooperateWizardIds = Optional
            .ofNullable(PlatformUI.getWorkbench().getNewWizardRegistry().findCategory(WIZARD_CATEGORY_ID))
            .map(IWizardCategory::getWizards).map(Arrays::asList).map(Collection::stream)
            .map(s -> s.map(IWizardDescriptor::getId).collect(Collectors.toList())).orElse(Collections.emptyList());
    cooperateWizardIds.forEach(layout::addNewWizardShortcut);
}
项目:translationstudio8    文件:ApplicationWorkbenchWindowAdvisor.java   
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]);
}
项目:developer-studio    文件:OpenIDEWizardFunction.java   
public void openWizard(String id) throws CoreException {
    // 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);
    }
    // Then if we have a wizard, open it.
    if (descriptor != null) {
        IWizard wizard = descriptor.createWizard();
        WizardDialog wd = new WizardDialog(Display.getDefault().getActiveShell(), wizard);
        wd.setTitle(wizard.getWindowTitle());
        if (wd.open() == WizardDialog.OK) {
            try 
            {
               PlatformUI.getWorkbench().showPerspective(J2EE_PERSPECTIVE,       
                     PlatformUI.getWorkbench().getActiveWorkbenchWindow());
            } 
            catch (WorkbenchException e) 
            {
              log.error("Error while opening J2EE perspective.", e);
            }
        }
    }
}
项目:Environment    文件:OpenWizardHandler.java   
@CanExecute
public boolean canExecute(@Optional @Named("eu.cloudscaleproject.env.common.command.openwizard.param.id") String wizardID){

    if(wizardID == null){
        return false;
    }

    IWizardDescriptor descriptor = PlatformUI.getWorkbench().getNewWizardRegistry()
            .findWizard(wizardID);

    if(descriptor != null){
        return true;
    }
    return false;
}
项目:Environment    文件:CloudScaleBranding.java   
private static 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]);
}
项目:tmxeditor8    文件:ApplicationWorkbenchWindowAdvisor.java   
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]);
}
项目:maru    文件:ApplicationWorkbenchWindowAdvisor.java   
private List<IWizardDescriptor> getAllWizards(IWizardCategory[] categories)
{
    List<IWizardDescriptor> results = new ArrayList<>();

    for (IWizardCategory wizardCategory : categories)
    {
        results.addAll(Arrays.asList(wizardCategory.getWizards()));
        results.addAll(getAllWizards(wizardCategory.getCategories()));
    }
    return results;
}
项目:gemoc-studio-modeldebugging    文件:CreateEcoreProposal.java   
@Override
public String getReplacementText() {

    IWizardDescriptor descriptor = WizardFinder.findNewWizardDescriptor("org.eclipse.ecoretools.emf.design.wizardID");

    // Then if we have a wizard, open it.
    if (descriptor != null) {
        // add a listener to capture the creation of the resulting project
        NewProjectWorkspaceListener workspaceListener = new NewProjectWorkspaceListener();
        ResourcesPlugin.getWorkspace().addResourceChangeListener(
                workspaceListener);
        try {
            IWizard wizard = descriptor.createWizard();
            // this wizard need some dedicated initialization
            String newProjectName = (packageName+"."+languageName+".model").toLowerCase();
            ((EcoreModelerWizard) wizard).setInitialProjectName(newProjectName);
            ((EcoreModelerWizard) wizard).init(PlatformUI.getWorkbench(),null);
            WizardDialog wd = new WizardDialog(PlatformUI.getWorkbench()
                    .getActiveWorkbenchWindow().getShell(), wizard);
            wd.create();
            wd.setTitle(wizard.getWindowTitle());

            int res = wd.open();
            if (res == WizardDialog.OK) {
                ResourcesPlugin.getWorkspace().removeResourceChangeListener(workspaceListener);
                ecoreProject = workspaceListener.getLastCreatedProject();
            }
        } catch (CoreException e) {
            Activator.error(e.getMessage(), e);
        } finally {
            // make sure to remove listener in all situations
            ResourcesPlugin.getWorkspace().removeResourceChangeListener(
                    workspaceListener);
            if(ecoreProject != null){
                return getCreatedEcoreUri();
            }
        }
    }

    return ""; 
}
项目:gemoc-studio-modeldebugging    文件:CreateDomainModelWizardContextAction.java   
protected void createNewEMFProject() {
    // launch the appropriate wizard

    // "org.eclipse.emf.importer.ui.EMFProjectWizard" = create EMFProject
    // from existing Ecore file

    IWizardDescriptor descriptor = WizardFinder
            .findNewWizardDescriptor("org.eclipse.ecoretools.emf.design.wizardID");

    // Then if we have a wizard, open it.
    if (descriptor != null) {
        // add a listener to capture the creation of the resulting project
        NewProjectWorkspaceListener workspaceListener = new NewProjectWorkspaceListener();
        ResourcesPlugin.getWorkspace().addResourceChangeListener(
                workspaceListener);
        try {
            IWizard wizard;
            wizard = descriptor.createWizard();
            // this wizard need some dedicated initialization
            ((EcoreModelerWizard) wizard)
                    .setInitialProjectName(MelangeXDSMLProjectHelper
                            .baseProjectName(gemocLanguageIProject)
                            + ".model");
            ((EcoreModelerWizard) wizard).init(PlatformUI.getWorkbench(),
                    (IStructuredSelection) PlatformUI.getWorkbench()
                            .getActiveWorkbenchWindow()
                            .getSelectionService().getSelection());
            // ((EcoreModelWizard)wizard).init(PlatformUI.getWorkbench(),
            // (IStructuredSelection) selection);
            WizardDialog wd = new WizardDialog(PlatformUI.getWorkbench()
                    .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) {
                    addEMFProjectToConf(createdProject);
                }
            }
        } catch (CoreException e) {
            Activator.error(e.getMessage(), e);
        } finally {
            // make sure to remove listener in all situations
            ResourcesPlugin.getWorkspace().removeResourceChangeListener(
                    workspaceListener);
        }
    }
}
项目:gemoc-studio-modeldebugging    文件:CreateAnimatorProjectWizardContextAction.java   
protected void createNewODProject() {
    final IWizardDescriptor descriptor = WizardFinder
            .findNewWizardDescriptor(org.eclipse.gemoc.xdsmlframework.extensions.sirius.Activator.PLUGIN_ID
                    + ".wizards.NewGemocDebugRepresentationWizard");
    // 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();
            ((NewGemocDebugRepresentationWizard) wizard).setInitialProjectName(gemocLanguageIProject.getName());
            if(melangeLanguage != null){
                ((NewGemocDebugRepresentationWizard) wizard)
                .setInitialLanguageName(melangeLanguage.getName());
            }
            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);
                IProject createdProject = workspaceListener
                        .getLastCreatedProject();
                // update the project configuration model
                if (createdProject != null) {
                    /* SiriusAnimatorProject animatorProject = Xdsml_baseFactoryImpl.eINSTANCE
                            .createSiriusAnimatorProject();
                    animatorProject
                            .setProjectName(createdProject.getName());
                    addOrUpdateProjectToConf(animatorProject); */
                    // DVK may be we should update something the melange files ?
                } 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.gemoc.xdsmlframework.extensions.sirius.wizards.NewGemocDebugRepresentationWizard not found",
                        null);
    }
}
项目:gemoc-studio-modeldebugging    文件:CreateEditorProjectWizardContextAction.java   
protected void createNewXTextProject() {
    /*
     * MessageDialog.openWarning(
     * PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
     * "Gemoc Language Workbench UI",
     * "Action not completly implemented yet");
     */
    // create xtext project from existing ecore model
    // wizard id =
    // org.eclipse.xtext.xtext.ui.wizard.ecore2xtext.NewXtextProjectFromEcoreWizard
    // launch the appropriate wizard

    IWizardDescriptor descriptor = WizardFinder
            .findNewWizardDescriptor("org.eclipse.xtext.xtext.ui.wizard.ecore2xtext.NewXtextProjectFromEcoreWizard");
    // Then if we have a wizard, open it.
    if (descriptor != null) {
        // add a listener to capture the creation of the resulting project
        NewProjectWorkspaceListener workspaceListener = new NewProjectWorkspaceListener();
        ResourcesPlugin.getWorkspace().addResourceChangeListener(
                workspaceListener);
        try {
            IWizard wizard;
            wizard = descriptor.createWizard();
            // this wizard need some dedicated initialization
            // ((EcoreModelerWizard )wizard).init(PlatformUI.getWorkbench(),
            // (IStructuredSelection)
            // PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection());
            // ((EcoreModelWizard)wizard).init(PlatformUI.getWorkbench(),
            // (IStructuredSelection) selection);
            WizardDialog wd = new WizardDialog(PlatformUI.getWorkbench()
                    .getActiveWorkbenchWindow().getShell(), wizard);
            wd.create();
            wd.setTitle(wizard.getWindowTitle());

            int res = wd.open();
            if (res == WizardDialog.OK) {
                ResourcesPlugin.getWorkspace()
                        .removeResourceChangeListener(workspaceListener);
                ArrayList<IProject> newlyCreatedProjects = workspaceListener
                        .getNewlyCreatedProjects();
                // find the created project with xtext files in it
                FileFinderVisitor fileFinder = new FileFinderVisitor(
                        "xtext");
                for (Iterator<IProject> iterator = newlyCreatedProjects
                        .iterator(); iterator.hasNext();) {
                    IProject iProject = (IProject) iterator.next();
                    iProject.accept(fileFinder);
                    if (fileFinder.getFile() != null) {
                        createdProject = iProject;
                        break;
                    }
                }
                // update the project configuration model
                if (createdProject != null) {                       
                    // maybe we should do something in the melange file ?
                } else {
                    Activator
                            .error("not able to detect which project was created by wizard",
                                    null);
                }
            }
        } catch (CoreException e) {
            Activator.error(e.getMessage(), e);
        } finally {
            // make sure to remove listener in all situations
            ResourcesPlugin.getWorkspace().removeResourceChangeListener(
                    workspaceListener);
        }
    } else {
        Activator
                .error("wizard with id=org.eclipse.xtext.xtext.ui.wizard.ecore2xtext.NewXtextProjectFromEcoreWizard not found",
                        null);
    }
}
项目:gemoc-studio-modeldebugging    文件:CreateEditorProjectWizardContextAction.java   
protected void createNewODProject() {
    final IWizardDescriptor descriptor = WizardFinder
            .findNewWizardDescriptor("org.eclipse.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(MelangeXDSMLProjectHelper
                                                                    .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) {
                    // maybe we should do something in the melange file ?
                } 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);
    }
}
项目:egradle    文件:EGradleNewProjectWizard.java   
private void importCreatedProject(File targetFolder) throws CoreException {
    /* open import wizard with correct setup */

    IWizardDescriptor descriptor = PlatformUI.getWorkbench().getImportWizardRegistry()
            .findWizard(EGradleRootProjectImportWizard.ID);
    if (descriptor == null) {
        throw new IllegalStateException("Import was not possible, because of missing wizard!");
    }

    IWizard wizard = descriptor.createWizard();
    if (!(wizard instanceof EGradleRootProjectImportWizard)) {
        throw new IllegalStateException("Not a root project wizard but:" + wizard);
    }

    outputToSystemConsole("- start import for generated project");

    EGradleRootProjectImportWizard piw = (EGradleRootProjectImportWizard) wizard;
    piw.setCustomRootProjectpath(targetFolder.getAbsolutePath());
    piw.setCustomJavaHome(context.getJavaHome());
    piw.setImportMode(RootProjectConfigMode.NEW_PROJECT_WIZARD);

    WizardDialog wd = new WizardDialog(getShell(), piw);
    wd.setTitle("Import generated gradle project");

    EclipseUtil.safeAsyncExec(new Runnable() {

        @Override
        public void run() {
            boolean resultOkay = false;
            if (context.isSupportingHeadlessImport()) {
                /* headless usage of import wizard:*/
                piw.addPages();
                piw.createPageControls(new Shell());
                piw.setContainer(getContainer());

                resultOkay = piw.performFinish();
                if (resultOkay) {
                    outputToSystemConsole("[DONE]");
                } else {
                    outputToSystemConsole("[CANCELED]");
                }
                return;

            }else{
                int result = wd.open();
                if (MessageDialog.OK == result) {
                    resultOkay = true;
                }
            }


            if (resultOkay) {
                outputToSystemConsole("[DONE]");
            } else {
                outputToSystemConsole("[CANCELED]");
            }
        }
    });
}
项目:ModelDebugging    文件:CreateEcoreProposal.java   
@Override
public String getReplacementText() {

    IWizardDescriptor descriptor = WizardFinder.findNewWizardDescriptor("org.eclipse.ecoretools.emf.design.wizardID");

    // Then if we have a wizard, open it.
    if (descriptor != null) {
        // add a listener to capture the creation of the resulting project
        NewProjectWorkspaceListener workspaceListener = new NewProjectWorkspaceListener();
        ResourcesPlugin.getWorkspace().addResourceChangeListener(
                workspaceListener);
        try {
            IWizard wizard = descriptor.createWizard();
            // this wizard need some dedicated initialization
            String newProjectName = (packageName+"."+languageName+".model").toLowerCase();
            ((EcoreModelerWizard) wizard).setInitialProjectName(newProjectName);
            ((EcoreModelerWizard) wizard).init(PlatformUI.getWorkbench(),null);
            WizardDialog wd = new WizardDialog(PlatformUI.getWorkbench()
                    .getActiveWorkbenchWindow().getShell(), wizard);
            wd.create();
            wd.setTitle(wizard.getWindowTitle());

            int res = wd.open();
            if (res == WizardDialog.OK) {
                ResourcesPlugin.getWorkspace().removeResourceChangeListener(workspaceListener);
                ecoreProject = workspaceListener.getLastCreatedProject();
            }
        } catch (CoreException e) {
            Activator.error(e.getMessage(), e);
        } finally {
            // make sure to remove listener in all situations
            ResourcesPlugin.getWorkspace().removeResourceChangeListener(
                    workspaceListener);
            if(ecoreProject != null){
                return getCreatedEcoreUri();
            }
        }
    }

    return ""; 
}
项目:ModelDebugging    文件:CreateDomainModelWizardContextAction.java   
protected void createNewEMFProject() {
    // launch the appropriate wizard

    // "org.eclipse.emf.importer.ui.EMFProjectWizard" = create EMFProject
    // from existing Ecore file

    IWizardDescriptor descriptor = WizardFinder
            .findNewWizardDescriptor("org.eclipse.ecoretools.emf.design.wizardID");

    // Then if we have a wizard, open it.
    if (descriptor != null) {
        // add a listener to capture the creation of the resulting project
        NewProjectWorkspaceListener workspaceListener = new NewProjectWorkspaceListener();
        ResourcesPlugin.getWorkspace().addResourceChangeListener(
                workspaceListener);
        try {
            IWizard wizard;
            wizard = descriptor.createWizard();
            // this wizard need some dedicated initialization
            ((EcoreModelerWizard) wizard)
                    .setInitialProjectName(MelangeXDSMLProjectHelper
                            .baseProjectName(gemocLanguageIProject)
                            + ".model");
            ((EcoreModelerWizard) wizard).init(PlatformUI.getWorkbench(),
                    (IStructuredSelection) PlatformUI.getWorkbench()
                            .getActiveWorkbenchWindow()
                            .getSelectionService().getSelection());
            // ((EcoreModelWizard)wizard).init(PlatformUI.getWorkbench(),
            // (IStructuredSelection) selection);
            WizardDialog wd = new WizardDialog(PlatformUI.getWorkbench()
                    .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) {
                    addEMFProjectToConf(createdProject);
                }
            }
        } catch (CoreException e) {
            Activator.error(e.getMessage(), e);
        } finally {
            // make sure to remove listener in all situations
            ResourcesPlugin.getWorkspace().removeResourceChangeListener(
                    workspaceListener);
        }
    }
}