private void addParameterValues(Map values, IWizardCategory wizardCategory) {

    final IWizardDescriptor[] wizardDescriptors = wizardCategory.getWizards();
    for (int i = 0; i < wizardDescriptors.length; i++) {
      final IWizardDescriptor wizardDescriptor = wizardDescriptors[i];

      // Note: using description instead of label for the name
      // to reduce possibilities of key collision in the map
      // final String name = wizardDescriptor.getDescription();

      // by request
      String name = wizardDescriptor.getLabel();
      final String id = wizardDescriptor.getId();
      final String value = (String) values.get(name);
      if (value != null && !value.equals(id)) {
        name = name + " (" + id + ")"; // $NON-NLS-1$//$NON-NLS-2$
      }
      values.put(name, id);
    }

    final IWizardCategory[] childCategories = wizardCategory.getCategories();
    for (int i = 0; i < childCategories.length; i++) {
      final IWizardCategory childCategory = childCategories[i];
      addParameterValues(values, childCategory);
    }
  }
예제 #2
0
 /* (non-Javadoc)
  * @see org.eclipse.ui.IPluginContribution#getLocalId()
  */
 public String getLocalId() {
   IPluginContribution contribution =
       (IPluginContribution) Util.getAdapter(wizardElement, IPluginContribution.class);
   if (contribution != null) {
     return contribution.getLocalId();
   }
   return wizardElement.getId();
 }
 private NewPackageWizard openPackageWizard() {
   IWizardDescriptor descriptor =
       getWorkbench().getNewWizardRegistry().findWizard(PLUGIN_ID + ".newPackageWizard");
   if (descriptor != null) {
     try {
       NewPackageWizard wizard = (NewPackageWizard) descriptor.createWizard();
       wizard.init(workbench, selection);
       WizardDialog wd = new WizardDialog(Display.getCurrent().getActiveShell(), wizard);
       wd.setTitle(wizard.getWindowTitle());
       wd.open();
       return wizard;
     } catch (CoreException e) {
       e.printStackTrace();
     }
   }
   return null;
 }
예제 #4
0
    public IWorkbenchWizard createWizard() throws CoreException {
      IWorkbenchWizard wizard = delegate.createWizard();
      if (wizard instanceof NewWizard) {
        NewWizard newWizard = (NewWizard) wizard;
        newWizard.setContentProvider(contentProvider);
      }

      return wizard;
    }
  protected void createNewODProject() {
    final IWizardDescriptor descriptor =
        WizardFinder.findNewWizardDescriptor(
            "org.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(XDSMLProjectHelper.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) {
            SiriusEditorProject editorProject =
                Xdsml_baseFactoryImpl.eINSTANCE.createSiriusEditorProject();
            editorProject.setProjectName(createdProject.getName());
            addOrUpdateProjectToConf(editorProject);
          } 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);
    }
  }
 private IJavaElement openSourceFolderWizard() {
   IWizardDescriptor descriptor =
       getWorkbench()
           .getNewWizardRegistry()
           .findWizard("org.eclipse.jdt.ui.wizards.NewSourceFolderCreationWizard");
   if (descriptor != null) {
     try {
       NewSourceFolderCreationWizard wizard =
           (NewSourceFolderCreationWizard) descriptor.createWizard();
       wizard.init(workbench, selection);
       WizardDialog wd = new WizardDialog(Display.getCurrent().getActiveShell(), wizard);
       wd.setTitle(wizard.getWindowTitle());
       wd.open();
       return wizard.getCreatedElement();
     } catch (CoreException e) {
       e.printStackTrace();
     }
   }
   return null;
 }
예제 #7
0
 public String getDescription() {
   return delegate.getDescription();
 }
  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) {
            XTextEditorProject editorProject =
                Xdsml_baseFactoryImpl.eINSTANCE.createXTextEditorProject();
            editorProject.setProjectName(createdProject.getName());
            addOrUpdateProjectToConf(editorProject);
          } 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);
    }
  }
예제 #9
0
 public boolean hasPages() {
   return delegate.hasPages();
 }
예제 #10
0
 public boolean canFinishEarly() {
   return delegate.canFinishEarly();
 }
예제 #11
0
 public IWizardCategory getCategory() {
   return delegate.getCategory();
 }
예제 #12
0
 public String getHelpHref() {
   return delegate.getHelpHref();
 }
예제 #13
0
 public ImageDescriptor getDescriptionImage() {
   return delegate.getDescriptionImage();
 }
예제 #14
0
  /* (non-Javadoc)
   * @see org.eclipse.jface.wizard.IWizardNode#getWizard()
   */
  public IWizard getWizard() {
    if (wizard != null) {
      return wizard; // we've already created it
    }

    final IWorkbenchWizard[] workbenchWizard = new IWorkbenchWizard[1];
    final IStatus statuses[] = new IStatus[1];
    // Start busy indicator.
    BusyIndicator.showWhile(
        parentWizardPage.getShell().getDisplay(),
        new Runnable() {
          public void run() {
            SafeRunner.run(
                new SafeRunnable() {
                  /** Add the exception details to status is one happens. */
                  public void handleException(Throwable e) {
                    IPluginContribution contribution =
                        (IPluginContribution)
                            Util.getAdapter(wizardElement, IPluginContribution.class);
                    statuses[0] =
                        new Status(
                            IStatus.ERROR,
                            contribution != null
                                ? contribution.getPluginId()
                                : WorkbenchPlugin.PI_WORKBENCH,
                            IStatus.OK,
                            WorkbenchMessages.get().WorkbenchWizard_errorMessage,
                            e);
                  }

                  public void run() {
                    try {
                      workbenchWizard[0] = createWizard();
                      // create instance of target wizard
                    } catch (CoreException e) {
                      IPluginContribution contribution =
                          (IPluginContribution)
                              Util.getAdapter(wizardElement, IPluginContribution.class);
                      statuses[0] =
                          new Status(
                              IStatus.ERROR,
                              contribution != null
                                  ? contribution.getPluginId()
                                  : WorkbenchPlugin.PI_WORKBENCH,
                              IStatus.OK,
                              WorkbenchMessages.get().WorkbenchWizard_errorMessage,
                              e);
                    }
                  }
                });
          }
        });

    if (statuses[0] != null) {
      parentWizardPage.setErrorMessage(WorkbenchMessages.get().WorkbenchWizard_errorMessage);
      StatusAdapter statusAdapter = new StatusAdapter(statuses[0]);
      statusAdapter.addAdapter(Shell.class, parentWizardPage.getShell());
      statusAdapter.setProperty(
          StatusAdapter.TITLE_PROPERTY, WorkbenchMessages.get().WorkbenchWizard_errorTitle);
      StatusManager.getManager().handle(statusAdapter, StatusManager.SHOW);
      return null;
    }

    IStructuredSelection currentSelection = getCurrentResourceSelection();

    // Get the adapted version of the selection that works for the
    // wizard node
    currentSelection = wizardElement.adaptedSelection(currentSelection);

    workbenchWizard[0].init(getWorkbench(), currentSelection);

    wizard = workbenchWizard[0];
    return wizard;
  }
예제 #15
0
 public String[] getTags() {
   return delegate.getTags();
 }
예제 #16
0
 public <T> T getAdapter(Class<T> adapter) {
   return delegate.getAdapter(adapter);
 }
예제 #17
0
 public String getLabel() {
   return delegate.getLabel();
 }
예제 #18
0
 public IStructuredSelection adaptedSelection(IStructuredSelection selection) {
   return delegate.adaptedSelection(selection);
 }
예제 #19
0
 public ImageDescriptor getImageDescriptor() {
   return delegate.getImageDescriptor();
 }
예제 #20
0
 public String getId() {
   return delegate.getId();
 }