コード例 #1
0
 @Override
 public void fillContextMenu(IMenuManager menu) {
   super.fillContextMenu(menu);
   ISelection sel = getContext().getSelection();
   if (sel instanceof DartElementSelection) {
     DartElementSelection selection = (DartElementSelection) sel;
     if (openExternalDartdocAction.isEnabled()) {
       openExternalDartdocAction.update(selection);
       appendToGroup(menu, openExternalDartdocAction);
     }
   } else {
     // TODO(messick): Remove this branch.
     appendToGroup(menu, openExternalDartdocAction);
   }
 }
コード例 #2
0
 /**
  * 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
 private void initialize(ISelectionProvider provider) {
   this.provider = provider;
   ISelection selection = provider.getSelection();
   openExternalDartdocAction.update(selection);
   provider.addSelectionChangedListener(openExternalDartdocAction);
 }