コード例 #1
0
  protected void fillContextMenu(IMenuManager manager) {
    Action removeAction =
        new Action(PDEUIMessages.CategorySection_remove) {
          public void run() {
            doGlobalAction(ActionFactory.DELETE.getId());
          }
        };
    removeAction.setEnabled(isEditable());
    manager.add(removeAction);
    getPage().getPDEEditor().getContributor().contextMenuAboutToShow(manager);

    ISelection selection = fCategoryViewer.getSelection();
    if (!selection.isEmpty() && selection instanceof IStructuredSelection) {
      final ISiteFeature[] features = getFeaturesFromSelection((IStructuredSelection) selection);
      if (features.length > 0) {
        manager.add(new Separator());
        Action synchronizeAction = new SynchronizePropertiesAction(features, fModel);
        manager.add(synchronizeAction);
        Action buildAction =
            new Action(PDEUIMessages.CategorySection_build) {
              public void run() {
                ((SiteEditor) getPage().getPDEEditor()).handleBuild(features);
              }
            };
        buildAction.setEnabled(isEditable());
        manager.add(buildAction);
      }
    }
  }
コード例 #2
0
  /* (non-Javadoc)
   * @see org.eclipse.pde.internal.ui.editor.StructuredViewerSection#fillContextMenu(org.eclipse.jface.action.IMenuManager)
   */
  protected void fillContextMenu(IMenuManager manager) {
    IStructuredSelection ssel = (IStructuredSelection) fPluginTable.getSelection();
    if (ssel == null) return;

    Action openAction =
        new Action(PDEUIMessages.PluginSection_open) {
          public void run() {
            handleDoubleClick((IStructuredSelection) fPluginTable.getSelection());
          }
        };
    openAction.setEnabled(isEditable() && ssel.size() == 1);
    manager.add(openAction);

    manager.add(new Separator());

    Action removeAction =
        new Action(PDEUIMessages.PluginSection_remove) {
          public void run() {
            handleDelete();
          }
        };
    removeAction.setEnabled(isEditable() && ssel.size() > 0);
    manager.add(removeAction);

    Action removeAll =
        new Action(PDEUIMessages.PluginSection_removeAll) {
          public void run() {
            handleRemoveAll();
          }
        };
    removeAll.setEnabled(isEditable());
    manager.add(removeAll);

    manager.add(new Separator());

    getPage().getPDEEditor().getContributor().contextMenuAboutToShow(manager);
  }
コード例 #3
0
 @Override
 protected void fillContextMenu(IMenuManager manager) {
   ISelection selection = fPackageViewer.getSelection();
   manager.add(fAddAction);
   boolean singleSelection =
       selection instanceof IStructuredSelection && ((IStructuredSelection) selection).size() == 1;
   if (singleSelection) manager.add(fGoToAction);
   manager.add(new Separator());
   if (!selection.isEmpty()) manager.add(fRemoveAction);
   getPage().getPDEEditor().getContributor().contextMenuAboutToShow(manager);
   if (singleSelection)
     manager.add(
         new Action(PDEUIMessages.ExportPackageSection_findReferences) {
           @Override
           public void run() {
             doSearch(fPackageViewer.getSelection());
           }
         });
   if (shouldEnableProperties(((IStructuredSelection) fPackageViewer.getSelection()).toArray())) {
     manager.add(new Separator());
     manager.add(fPropertiesAction);
   }
 }