@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); } }
/** * 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); }
private void initialize(ISelectionProvider provider) { this.provider = provider; ISelection selection = provider.getSelection(); openExternalDartdocAction.update(selection); provider.addSelectionChangedListener(openExternalDartdocAction); }