Пример #1
0
 @Override
 public void setContext(ActionContext context) {
   if (context.getSelection() instanceof IStructuredSelection) {
     IStructuredSelection ss = (IStructuredSelection) context.getSelection();
     if (ss.getFirstElement() instanceof IAdaptable) {
       IWaypoint wp = (IWaypoint) ((IAdaptable) ss.getFirstElement()).getAdapter(IWaypoint.class);
       if (wp != null) {
         deleteAction.setEnabled(TagSEAPlugin.getDefault().getUI().canUIDelete(wp));
       }
     }
   }
   super.setContext(context);
 }
 /**
  * This calls by {@link OpenExternalDartdocAction_OLD#updateEnabled(ISelection)} each time the
  * {@link ActionContext} is changed. This is what enables or disables the action in the context
  * menu in the Editor.
  */
 @Override
 public void setContext(ActionContext context) {
   if (context != null) {
     openExternalDartdocAction.updateEnabled(context.getSelection());
   }
   super.setContext(context);
 }
Пример #3
0
 @Override
 public void setContext(ActionContext context) {
   super.setContext(context);
   if (context != null) {
     ISelection selection = context.getSelection();
     IStructuredSelection structuredSelection =
         selection instanceof IStructuredSelection
             ? (IStructuredSelection) selection
             : StructuredSelection.EMPTY;
     removeAction.setEnabled(removeAction.updateSelection(structuredSelection));
     cutAction.setEnabled(cutAction.updateSelection(structuredSelection));
     copyAction.setEnabled(copyAction.updateSelection(structuredSelection));
     pasteAction.setEnabled(pasteAction.updateSelection(structuredSelection));
     undoAction.update();
     redoAction.update();
   }
 }