@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);
  }
 @Override
 public void update(final AnActionEvent e) {
   e.getPresentation().setIcon(myTabs.isEditorTabs() ? myNewIcon : myIcon);
   e.getPresentation().setHoveredIcon(myTabs.isEditorTabs() ? myNewHoveredIcon : myHoveredIcon);
   e.getPresentation().setVisible(UISettings.getInstance().SHOW_CLOSE_BUTTON);
   e.getPresentation().setText("Close. Alt-click to close others.");
 }
  @Override
  public void update(final AnActionEvent e) {
    if (!isFirstStart(e)) {
      return;
    }

    final DebuggerContextImpl debuggerContext = getDebuggerContext(e.getDataContext());
    final DebugProcessImpl debugProcess = debuggerContext.getDebugProcess();
    if (debugProcess == null) {
      e.getPresentation().setVisible(false);
      return;
    }

    DebuggerTreeNodeImpl selectedNode = getSelectedNode(e.getDataContext());
    if (selectedNode == null) {
      e.getPresentation().setVisible(false);
      return;
    }

    final NodeDescriptorImpl descriptor = selectedNode.getDescriptor();
    if (descriptor instanceof ValueDescriptor) {
      debugProcess
          .getManagerThread()
          .schedule(
              new EnableCommand(debuggerContext, (ValueDescriptor) descriptor, debugProcess, e));
    } else {
      e.getPresentation().setVisible(false);
    }
  }
Example #4
0
  public void update(AnActionEvent e) {
    super.update(e);

    final Project project = e.getData(DataKeys.PROJECT);
    final VirtualFile file = e.getData(DataKeys.VIRTUAL_FILE);

    boolean visible =
        project != null
            && file != null
            && !file.isDirectory()
            && file.getFileType() == CppSupportLoader.CPP_FILETYPE
            && !Communicator.isHeaderFile(file);
    boolean enabled = visible;

    if (!visible) {
      visible = ActionPlaces.MAIN_MENU.equals(e.getPlace());
    }

    e.getPresentation().setEnabled(enabled);
    e.getPresentation().setVisible(visible);

    if (visible) {
      final String s =
          "Do c&ompile for " + (file != null ? file.getName() : "selected c/c++ fileToCompile");
      e.getPresentation().setText(s);
      e.getPresentation().setDescription(s);
    }
  }
 public void update(AnActionEvent e) {
   boolean active = getHandler(e) != null;
   if (ActionPlaces.isPopupPlace(e.getPlace())) {
     e.getPresentation().setVisible(active);
   } else {
     e.getPresentation().setEnabled(active);
   }
 }
  public static boolean isFirstStart(final AnActionEvent event) {
    //noinspection HardCodedStringLiteral
    String key = "initalized";
    if (event.getPresentation().getClientProperty(key) != null) return false;

    event.getPresentation().putClientProperty(key, key);
    return true;
  }
 public void update(AnActionEvent e) {
   if (!running) {
     e.getPresentation().setEnabled(true);
     e.getPresentation().setIcon(RESOLVEIcons.CHECKMARK);
   } else {
     e.getPresentation().setEnabled(false);
   }
 }
 public void doUpdate(@NotNull AnActionEvent event) {
   try {
     this.enable(event.getPresentation());
   } catch (Throwable t) {
     LOG.error("User's action doUpdate method failed. Action:" + "ImportXml", t);
     this.disable(event.getPresentation());
   }
 }
 public void doUpdate(@NotNull AnActionEvent event, final Map<String, Object> _params) {
   try {
     this.enable(event.getPresentation());
   } catch (Throwable t) {
     LOG.error("User's action doUpdate method failed. Action:" + "FindModelUsages", t);
     this.disable(event.getPresentation());
   }
 }
 @Override
 public void update(AnActionEvent e) {
   if (mySession != null) {
     e.getPresentation().setEnabled(false);
   } else {
     e.getPresentation().setEnabled(true);
   }
 }
 public void update(AnActionEvent e) {
   super.update(e);
   if (e != null) {
     if (e.getPresentation().isVisible() && findActions(e).length == 0) {
       e.getPresentation().setVisible(false);
     }
   }
 }
 public void update(AnActionEvent e) {
   final Module module = LangDataKeys.MODULE.getData(e.getDataContext());
   boolean enabled = module != null && PluginModuleType.isOfType(module);
   e.getPresentation().setVisible(enabled);
   e.getPresentation().setEnabled(enabled);
   if (enabled) {
     e.getPresentation().setText(DevKitBundle.message("prepare.for.deployment", module.getName()));
   }
 }
 @Override
 public void update(AnActionEvent e) {
   final VirtualFile file = CommonDataKeys.VIRTUAL_FILE.getData(e.getDataContext());
   final boolean enabled = isAcceptableFile(file);
   e.getPresentation().setEnabled(enabled);
   if (ActionPlaces.isPopupPlace(e.getPlace())) {
     e.getPresentation().setVisible(enabled);
   }
 }
Example #14
0
  public void update(final AnActionEvent e) {
    final FileGroupInfo fileGroupInfo = new FileGroupInfo();

    myHelperAction.setFileIterationListener(fileGroupInfo);
    myHelperAction.update(e);

    myGetterStub.setDelegate(fileGroupInfo);

    if ((e.getPresentation().isEnabled())) {
      removeAll();
      if (myHelperAction.allAreIgnored()) {
        final DataContext dataContext = e.getDataContext();
        final Project project = CommonDataKeys.PROJECT.getData(dataContext);
        SvnVcs vcs = SvnVcs.getInstance(project);

        final Ref<Boolean> filesOk = new Ref<Boolean>(Boolean.FALSE);
        final Ref<Boolean> extensionOk = new Ref<Boolean>(Boolean.FALSE);

        // virtual files parameter is not used -> can pass null
        SvnPropertyService.doCheckIgnoreProperty(
            vcs,
            project,
            null,
            fileGroupInfo,
            fileGroupInfo.getExtensionMask(),
            filesOk,
            extensionOk);

        if (Boolean.TRUE.equals(filesOk.get())) {
          myRemoveExactAction.setActionText(
              fileGroupInfo.oneFileSelected()
                  ? fileGroupInfo.getFileName()
                  : SvnBundle.message("action.Subversion.UndoIgnore.text"));
          add(myRemoveExactAction);
        }

        if (Boolean.TRUE.equals(extensionOk.get())) {
          myRemoveExtensionAction.setActionText(fileGroupInfo.getExtensionMask());
          add(myRemoveExtensionAction);
        }

        e.getPresentation().setText(SvnBundle.message("group.RevertIgnoreChoicesGroup.text"));
      } else if (myHelperAction.allCanBeIgnored()) {
        final String ignoreExactlyName =
            (fileGroupInfo.oneFileSelected())
                ? fileGroupInfo.getFileName()
                : SvnBundle.message("action.Subversion.Ignore.ExactMatch.text");
        myAddExactAction.setActionText(ignoreExactlyName);
        add(myAddExactAction);
        if (fileGroupInfo.sameExtension()) {
          myAddExtensionAction.setActionText(fileGroupInfo.getExtensionMask());
          add(myAddExtensionAction);
        }
        e.getPresentation().setText(SvnBundle.message("group.IgnoreChoicesGroup.text"));
      }
    }
  }
  @Override
  public void update(final AnActionEvent e) {
    super.update(e);

    e.getPresentation().setIcon(myIcon);
    e.getPresentation().setText((getHiders().get(myClass) ? "Hide " : "Show ") + myText);

    e.getPresentation().setEnabled(getHiders() != null && getHiders().get(myClass) != null);
  }
 public final void update(AnActionEvent e) {
   FileSystemTree tree = e.getData(FileSystemTree.DATA_KEY);
   if (tree != null) {
     e.getPresentation().setEnabled(true);
     update(tree, e);
   } else {
     e.getPresentation().setEnabled(false);
   }
 }
 public void doUpdate(@NotNull AnActionEvent event, final Map<String, Object> _params) {
   try {
     this.enable(event.getPresentation());
   } catch (Throwable t) {
     LOG.error(
         "User's action doUpdate method failed. Action:" + "PrintReachingDefinintionsInformation",
         t);
     this.disable(event.getPresentation());
   }
 }
 public void doUpdate(@NotNull AnActionEvent event, final Map<String, Object> _params) {
   try {
     this.enable(event.getPresentation());
   } catch (Throwable t) {
     if (log.isErrorEnabled()) {
       log.error("User's action doUpdate method failed. Action:" + "HighlightInstances", t);
     }
     this.disable(event.getPresentation());
   }
 }
 @Override
 public void update(@NotNull AnActionEvent e) {
   AnAction action = getAction(e);
   if (action != null) {
     e.getPresentation().setVisible(true);
     action.update(e);
   } else {
     e.getPresentation().setVisible(false);
   }
 }
 @Override
 public void update(AnActionEvent e) {
   super.update(e);
   e.getPresentation().setVisible(!UpdateSettings.getInstance().myPluginHosts.isEmpty());
   String repository = ((AvailablePluginsTableModel) pluginsModel).getRepository();
   if (repository.length() > LENGTH) {
     repository = repository.substring(0, LENGTH) + "...";
   }
   e.getPresentation().setText("Repository: " + repository);
 }
Example #21
0
 public void doUpdate(@NotNull AnActionEvent event, final Map<String, Object> _params) {
   try {
     this.enable(event.getPresentation());
   } catch (Throwable t) {
     if (LOG.isEnabledFor(Priority.ERROR)) {
       LOG.error("User's action doUpdate method failed. Action:" + "ReplaceByCondition", t);
     }
     this.disable(event.getPresentation());
   }
 }
 @Override
 public void update(AnActionEvent e) {
   // e.getPresentation()
   if (pl.vcIsProved.containsKey(vcNum) && pl.vcIsProved.get(vcNum)) {
     e.getPresentation().setIcon(RESOLVEIcons.PROVED);
     isProved = true;
   } else {
     e.getPresentation().setIcon(RESOLVEIcons.NOT_PROVED);
   }
 }
 public void doUpdate(@NotNull AnActionEvent event, final Map<String, Object> _params) {
   try {
     this.enable(event.getPresentation());
   } catch (Throwable t) {
     if (LOG.isEnabledFor(Level.ERROR)) {
       LOG.error("User's action doUpdate method failed. Action:" + "ModuleProperties", t);
     }
     this.disable(event.getPresentation());
   }
 }
Example #24
0
    @Override
    public void update(AnActionEvent e) {
      e.getPresentation().setEnabled(!myTable.isEditing() && myTable.getSelectedRow() >= 0);
      e.getPresentation().setText("Revert to Default");
      e.getPresentation().setIcon(IconLoader.getIcon("/general/remove.png"));

      if (e.getPresentation().isEnabled()) {
        final RegistryValue rv = myModel.getRegistryValue(myTable.getSelectedRow());
        e.getPresentation().setEnabled(rv.isChangedFromDefault());
      }
    }
Example #25
0
 @Override
 public void update(AnActionEvent e) {
   final ToolWindow window = getWindow(e);
   e.getPresentation()
       .setEnabled(window != null && window.getContentManager().getContentCount() > 1);
   e.getPresentation()
       .setText(
           window == null || window.getContentUiType() == ToolWindowContentUiType.TABBED
               ? "Show List of Tabs"
               : "Show List of Views");
 }
 public void doUpdate(@NotNull AnActionEvent event, final Map<String, Object> _params) {
   try {
     {
       boolean enabled = this.isApplicable(event, _params);
       this.setEnabledState(event.getPresentation(), enabled);
     }
   } catch (Throwable t) {
     LOG.error("User's action doUpdate method failed. Action:" + "MoveProperyUp", t);
     this.disable(event.getPresentation());
   }
 }
  @Override
  public void update(AnActionEvent e) {
    DataContext dataContext = e.getDataContext();
    Editor editor = CommonDataKeys.EDITOR.getData(dataContext);
    PsiFile file = CommonDataKeys.PSI_FILE.getData(dataContext);

    if (file == null || editor == null) {
      e.getPresentation().setEnabled(false);
    } else {
      e.getPresentation().setEnabled(editor.getSelectionModel().hasSelection());
    }
  }
 public void doUpdate(@NotNull AnActionEvent event, final Map<String, Object> _params) {
   try {
     this.enable(event.getPresentation());
   } catch (Throwable t) {
     if (log.isErrorEnabled()) {
       log.error(
           "User's action doUpdate method failed. Action:" + "MigrationScript_ResolveBrokenRefs",
           t);
     }
     this.disable(event.getPresentation());
   }
 }
Example #29
0
 public void doUpdate(@NotNull AnActionEvent event, final Map<String, Object> _params) {
   try {
     {
       AbstractDebugSession debugSession = DebugActionsUtil.getDebugSession(event);
       event.getPresentation().setEnabled(debugSession != null && debugSession.isStepEnabled());
     }
   } catch (Throwable t) {
     if (log.isErrorEnabled()) {
       log.error("User's action doUpdate method failed. Action:" + "StepOut", t);
     }
     this.disable(event.getPresentation());
   }
 }
  @Override
  public void update(final AnActionEvent e) {
    if (!e.getPresentation().isVisible()) {
      return;
    }
    final DataContext dataContext = e.getDataContext();
    final Presentation presentation = e.getPresentation();

    final boolean enabled = isAvailable(dataContext);

    presentation.setVisible(enabled);
    presentation.setEnabled(enabled);
  }