コード例 #1
0
ファイル: WorkbenchWizardNode.java プロジェクト: oaperez/rap
 /* (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();
 }
コード例 #2
0
ファイル: NewActionProvider.java プロジェクト: eclipse/cdo
  private void fillNewWizardActions(IMenuManager menu) {
    // Fill the menu from the commonWizard contributions.
    newWizardActionGroup.setContext(getContext());
    newWizardActionGroup.fillContextMenu(menu);

    IContributionItem newResourceFolderItem = null;
    IContributionItem newModelResourceItem = null;
    IContributionItem newBinaryFileItem = null;
    IContributionItem newTextFileItem = null;

    String firstID = null;
    IContributionItem[] newWizardItems = menu.getItems();
    for (IContributionItem newWizardItem : newWizardItems) {
      if (newWizardItem instanceof ActionContributionItem) {
        IAction action = ((ActionContributionItem) newWizardItem).getAction();
        if (action instanceof IPluginContribution) {
          IPluginContribution pluginContribution = (IPluginContribution) action;
          String id = pluginContribution.getLocalId();
          if (NewFolderWizard.ID.equals(id)) {
            newResourceFolderItem = menu.remove(newWizardItem);
            continue;
          }

          if (NewResourceWizard.ID.equals(id)) {
            newModelResourceItem = menu.remove(newWizardItem);
            continue;
          }

          if (NewBinaryResourceWizard.ID.equals(id)) {
            newBinaryFileItem = menu.remove(newWizardItem);
            continue;
          }

          if (NewTextResourceWizard.ID.equals(id)) {
            newTextFileItem = menu.remove(newWizardItem);
            continue;
          }
        }

        // Filter out the dubious "Ecore Diagram" action that appears everywhere.
        if ("Ecore Diagram".equals(action.getText())) {
          menu.remove(newWizardItem);
          continue;
        }
      }

      if (firstID == null) {
        firstID = newWizardItem.getId();
      }
    }

    if (firstID == null) {
      Separator group = new Separator("cdo-new-wizards");
      menu.add(group);
      firstID = group.getId();
    }

    if (newResourceFolderItem != null) {
      menu.insertBefore(firstID, newResourceFolderItem);
    }

    if (newModelResourceItem != null) {
      menu.insertBefore(firstID, newModelResourceItem);
    }

    if (newBinaryFileItem != null) {
      menu.insertBefore(firstID, newBinaryFileItem);
    }

    if (newTextFileItem != null) {
      menu.insertBefore(firstID, newTextFileItem);
    }
  }