Пример #1
0
 public void update(AnActionEvent e) {
   final Presentation presentation = e.getPresentation();
   presentation.setEnabled(false);
   final TreePath[] selectionPath = myTree.getSelectionPaths();
   if (selectionPath != null) {
     Object[] nodes =
         ContainerUtil.map2Array(
             selectionPath,
             new Function<TreePath, Object>() {
               @Override
               public Object fun(TreePath treePath) {
                 return treePath.getLastPathComponent();
               }
             });
     if (!myCondition.value(nodes)) return;
     presentation.setEnabled(true);
   }
 }
Пример #2
0
 public void actionPerformed(AnActionEvent e) {
   final JBPopupFactory popupFactory = JBPopupFactory.getInstance();
   final ListPopupStep step =
       popupFactory.createActionsStep(
           myActionGroup,
           e.getDataContext(),
           false,
           false,
           myActionGroup.getTemplatePresentation().getText(),
           myTree,
           true,
           myPreselection != null ? myPreselection.getDefaultIndex() : 0,
           true);
   final ListPopup listPopup = popupFactory.createListPopup(step);
   listPopup.setHandleAutoSelectionBeforeShow(true);
   if (e instanceof AnActionButton.AnActionEventWrapper) {
     ((AnActionButton.AnActionEventWrapper) e).showPopup(listPopup);
   } else {
     listPopup.showUnderneathOf(myNorthPanel);
   }
 }
 @Override
 public void update(AnActionEvent e) {
   super.update(e);
   Presentation presentation = e.getPresentation();
   presentation.setEnabled(myContainerNodes.size() > 1);
 }
 @Override
 public void update(AnActionEvent e) {
   super.update(e);
   final Presentation presentation = e.getPresentation();
   presentation.setEnabled(allTargetsAreValid());
 }
 @Override
 public void update(AnActionEvent e) {
   super.update(e);
   e.getPresentation().setVisible(myContent != null);
 }