Java 类com.intellij.openapi.editor.actions.TextComponentEditorAction 实例源码

项目:tools-idea    文件:EditorTextFieldProviderImpl.java   
@Override
public int compare(AnAction o1, AnAction o2) {
  if (o1 instanceof EditorAction && o2 instanceof EditorAction) {
    return 0;
  }
  if (o1 instanceof TextComponentEditorAction) {
    return -1;
  }
  if (o2 instanceof TextComponentEditorAction) {
    return 1;
  }
  if (o1 instanceof EditorAction) {
    return 1;
  }
  if (o2 instanceof EditorAction) {
    return -1;
  }
  return 0;
}
项目:consulo    文件:EditorTextFieldProviderImpl.java   
@Override
public int compare(AnAction o1, AnAction o2) {
  if (o1 instanceof EditorAction && o2 instanceof EditorAction) {
    return 0;
  }
  if (o1 instanceof TextComponentEditorAction) {
    return -1;
  }
  if (o2 instanceof TextComponentEditorAction) {
    return 1;
  }
  if (o1 instanceof EditorAction) {
    return 1;
  }
  if (o2 instanceof EditorAction) {
    return -1;
  }
  return 0;
}
项目:intellij-ce-playground    文件:EditorTextFieldActionPromoter.java   
@Override
public int compare(AnAction o1, AnAction o2) {
  boolean textFieldAction1 = o1 instanceof TextComponentEditorAction;
  boolean textFieldAction2 = o2 instanceof TextComponentEditorAction;
  boolean plainEditorAction1 = o1 instanceof EditorAction && !textFieldAction1;
  boolean plainEditorAction2 = o2 instanceof EditorAction && !textFieldAction2;
  if (textFieldAction1 && plainEditorAction2) return -1;
  if (textFieldAction2 && plainEditorAction1) return 1;
  return 0;
}
项目:consulo    文件:EditorTextFieldActionPromoter.java   
@Override
public int compare(AnAction o1, AnAction o2) {
  boolean textFieldAction1 = o1 instanceof TextComponentEditorAction;
  boolean textFieldAction2 = o2 instanceof TextComponentEditorAction;
  boolean plainEditorAction1 = o1 instanceof EditorAction && !textFieldAction1;
  boolean plainEditorAction2 = o2 instanceof EditorAction && !textFieldAction2;
  if (textFieldAction1 && plainEditorAction2) return -1;
  if (textFieldAction2 && plainEditorAction1) return 1;
  return 0;
}
项目:intellij-ce-playground    文件:SelectAllAction.java   
public void update(AnActionEvent event){
  Presentation presentation = event.getPresentation();
  Editor editor = TextComponentEditorAction.getEditorFromContext(event.getDataContext());
  presentation.setEnabled(editor != null);
}
项目:tools-idea    文件:SelectAllAction.java   
public void update(AnActionEvent event){
  Presentation presentation = event.getPresentation();
  Editor editor = TextComponentEditorAction.getEditorFromContext(event.getDataContext());
  presentation.setEnabled(editor != null);
}
项目:consulo    文件:SelectAllAction.java   
public void update(AnActionEvent event){
  Presentation presentation = event.getPresentation();
  Editor editor = TextComponentEditorAction.getEditorFromContext(event.getDataContext());
  presentation.setEnabled(editor != null);
}
项目:consulo    文件:SearchEverywhereAction.java   
@SuppressWarnings("SSBasedInspection")
private void updatePopup() {
  check();
  SwingUtilities.invokeLater(new Runnable() {
    @Override
    public void run() {
      myListModel.update();
      myList.revalidate();
      myList.repaint();

      myRenderer.recalculateWidth();
      if (myBalloon == null || myBalloon.isDisposed()) {
        return;
      }
      if (myPopup == null || !myPopup.isVisible()) {
        final ActionCallback callback = ListDelegationUtil.installKeyboardDelegation(getField().getTextEditor(), myList);
        JBScrollPane content = new JBScrollPane(myList);
        content.setMinimumSize(new Dimension(myBalloon.getSize().width, 30));
        final ComponentPopupBuilder builder = JBPopupFactory.getInstance().createComponentPopupBuilder(content, null);
        myPopup = builder.setRequestFocus(false).setCancelKeyEnabled(false).setCancelCallback(new Computable<Boolean>() {
          @Override
          public Boolean compute() {
            return myBalloon == null || myBalloon.isDisposed() || (!getField().getTextEditor().hasFocus() && !mySkipFocusGain);
          }
        }).createPopup();
        myPopup.setMinimumSize(new Dimension(myBalloon.getSize().width, 30));
        myPopup.getContent().setBorder(new EmptyBorder(0, 0, 0, 0));
        Disposer.register(myPopup, new Disposable() {
          @Override
          public void dispose() {
            callback.setDone();
            resetFields();
            myNonProjectCheckBox.setSelected(false);
            ActionToolbarImpl.updateAllToolbarsImmediately();
            if (myActionEvent != null && myActionEvent.getInputEvent() instanceof MouseEvent) {
              final Component component = myActionEvent.getInputEvent().getComponent();
              if (component != null) {
                final JLabel label = UIUtil.getParentOfType(JLabel.class, component);
                if (label != null) {
                  label.setIcon(AllIcons.Actions.FindPlain);
                }
              }
            }
            myActionEvent = null;
          }
        });
        myPopup.show(new RelativePoint(getField().getParent(), new Point(0, getField().getParent().getHeight())));
        //updatePopupBounds();

        ActionManager.getInstance().addAnActionListener(new AnActionListener.Adapter() {
          @Override
          public void beforeActionPerformed(AnAction action, DataContext dataContext, AnActionEvent event) {
            if (action instanceof TextComponentEditorAction) {
              return;
            }
            myPopup.cancel();
          }
        }, myPopup);
      }
      else {
        myList.revalidate();
        myList.repaint();
      }
      ScrollingUtil.ensureSelectionExists(myList);
      if (myList.getModel().getSize() > 0) {
        updatePopupBounds();
      }
    }
  });
}