private void makeActions() {
    fAddAction =
        new Action(PDEUIMessages.RequiresSection_add) {
          @Override
          public void run() {
            handleAdd();
          }
        };
    fAddAction.setEnabled(isEditable());
    fGoToAction =
        new Action(PDEUIMessages.ImportPackageSection_goToPackage) {
          @Override
          public void run() {
            handleGoToPackage(fPackageViewer.getSelection());
          }
        };
    fRemoveAction =
        new Action(PDEUIMessages.RequiresSection_delete) {
          @Override
          public void run() {
            handleRemove();
          }
        };
    fRemoveAction.setEnabled(isEditable());

    fPropertiesAction =
        new Action(PDEUIMessages.ExportPackageSection_propertyAction) {
          @Override
          public void run() {
            handleOpenProperties();
          }
        };
  }
예제 #2
0
  private void makeActions() {
    action1 =
        new Action() {
          public void run() {
            showMessage("Action 1 executed");
          }
        };
    action1.setText("Action 1");
    action1.setToolTipText("Action 1 tooltip");
    action1.setImageDescriptor(
        PlatformUI.getWorkbench()
            .getSharedImages()
            .getImageDescriptor(ISharedImages.IMG_OBJS_INFO_TSK));

    action2 =
        new Action() {
          public void run() {
            showMessage("Action 2 executed");
          }
        };
    action2.setText("Action 2");
    action2.setToolTipText("Action 2 tooltip");
    action2.setImageDescriptor(
        PlatformUI.getWorkbench()
            .getSharedImages()
            .getImageDescriptor(ISharedImages.IMG_OBJS_INFO_TSK));
    doubleClickAction =
        new Action() {
          public void run() {
            ISelection selection = viewer.getSelection();
            Object obj = ((IStructuredSelection) selection).getFirstElement();
            showMessage("Double-click detected on " + obj.toString());
          }
        };
  }
  /* (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);
  }
 private void calculateUses() {
   final IProject proj = getPage().getPDEEditor().getCommonProject();
   Action action = new CalculateUsesAction(proj, (IBundlePluginModelBase) getPage().getModel());
   action.run();
 }