コード例 #1
0
 public void update(final AnActionEvent event) {
   if (!DefinitionsSearch.INSTANCE.hasAnyExecutors()) {
     event.getPresentation().setVisible(false);
   } else {
     super.update(event);
   }
 }
コード例 #2
0
  @Override
  public void update(final AnActionEvent event) {
    if (event.getProject() == null
        || event.getData(EditorGutter.KEY) != null
        || Boolean.TRUE.equals(event.getData(CommonDataKeys.EDITOR_VIRTUAL_SPACE))) {
      event.getPresentation().setEnabled(false);
      return;
    }

    for (GotoDeclarationHandler handler :
        Extensions.getExtensions(GotoDeclarationHandler.EP_NAME)) {
      try {
        String text = handler.getActionText(event.getDataContext());
        if (text != null) {
          Presentation presentation = event.getPresentation();
          presentation.setText(text);
          break;
        }
      } catch (AbstractMethodError e) {
        LOG.error(handler.toString(), e);
      }
    }

    super.update(event);
  }