Java 类com.intellij.openapi.actionSystem.CommonShortcuts 实例源码

项目:intellij-ce-playground    文件:TipManager.java   
public TipManager(final JComponent component, TipFactory factory) {
  myTipFactory = factory;
  myComponent = component;

  new UiNotifyConnector.Once(component, new Activatable() {
    @Override
    public void showNotify() {
      installListeners();
    }

    @Override
    public void hideNotify() {
    }
  });

  final HideTooltipAction hide = new HideTooltipAction();
  hide.registerCustomShortcutSet(CommonShortcuts.ESCAPE, myComponent);
  Disposer.register(this, new Disposable() {
    @Override
    public void dispose() {
      hide.unregisterCustomShortcutSet(myComponent);
    }
  });
}
项目:intellij-ce-playground    文件:AbstractFieldPanel.java   
protected JComponent createCenterPanel() {
  myTextArea = new JTextArea(10, 50);
  myTextArea.setText(getText());
  myTextArea.setWrapStyleWord(true);
  myTextArea.setLineWrap(true);
  myTextArea.getDocument().addDocumentListener(new DocumentAdapter() {
    public void textChanged(DocumentEvent event) {
      if (myChangeListener != null) {
        myChangeListener.run();
      }
    }
  });

  new AnAction() {
    public void actionPerformed(AnActionEvent e) {
      doOKAction();
    }
  }.registerCustomShortcutSet(CommonShortcuts.ENTER, myTextArea);

  return ScrollPaneFactory.createScrollPane(myTextArea);
}
项目:intellij-ce-playground    文件:MultilinePopupBuilder.java   
@NotNull
JBPopup createPopup() {
  JPanel panel = new JPanel(new BorderLayout());
  panel.add(myTextField, BorderLayout.CENTER);
  ComponentPopupBuilder builder = JBPopupFactory.getInstance().createComponentPopupBuilder(panel, myTextField)
    .setCancelOnClickOutside(true)
    .setAdText(KeymapUtil.getShortcutsText(CommonShortcuts.CTRL_ENTER.getShortcuts()) + " to finish")
    .setRequestFocus(true)
    .setResizable(true)
    .setMayBeParent(true);

  final JBPopup popup = builder.createPopup();
  popup.setMinimumSize(new Dimension(200, 90));
  AnAction okAction = new DumbAwareAction() {
    @Override
    public void actionPerformed(@NotNull AnActionEvent e) {
      unregisterCustomShortcutSet(popup.getContent());
      popup.closeOk(e.getInputEvent());
    }
  };
  okAction.registerCustomShortcutSet(CommonShortcuts.CTRL_ENTER, popup.getContent());
  return popup;
}
项目:intellij-ce-playground    文件:FrameWrapper.java   
private void addCloseOnEsc(final RootPaneContainer frame) {
  new DumbAwareAction() {
    @Override
    public void actionPerformed(@NotNull AnActionEvent e) {
      MenuSelectionManager menuSelectionManager = MenuSelectionManager.defaultManager();
      MenuElement[] selectedPath = menuSelectionManager.getSelectedPath();
      if (selectedPath.length > 0) { // hide popup menu if any
        menuSelectionManager.clearSelectedPath();
      } else {
        // if you remove this line problems will start happen on Mac OS X
        // 2 projects opened, call Cmd+D on the second opened project and then Esc.
        // Weird situation: 2nd IdeFrame will be active, but focus will be somewhere inside the 1st IdeFrame
        // App is unusable until Cmd+Tab, Cmd+tab
        FrameWrapper.this.myFrame.setVisible(false);
        close();
      }
    }
  }.registerCustomShortcutSet(CommonShortcuts.ESCAPE, myComponent, this);
}
项目:intellij-ce-playground    文件:ClassToBindProperty.java   
public MyEditor(final Project project) {
  myProject = project;
  myEditorTextField = new EditorTextField("", project, StdFileTypes.JAVA) {
    protected boolean shouldHaveBorder() {
      return false;
    }
  };
  myActionListener = new MyActionListener();
  myTfWithButton = new ComponentWithBrowseButton<EditorTextField>(myEditorTextField, myActionListener);
  myEditorTextField.setBorder(null);
  new MyCancelEditingAction().registerCustomShortcutSet(CommonShortcuts.ESCAPE, myTfWithButton);
  /*
  myEditorTextField.addActionListener(
    new ActionListener() {
      public void actionPerformed(final ActionEvent e) {
        fireValueCommitted();
      }
    }
  );
  */
}
项目:tools-idea    文件:ClassToBindProperty.java   
public MyEditor(final Project project) {
  myProject = project;
  myEditorTextField = new EditorTextField("", project, StdFileTypes.JAVA) {
    protected boolean shouldHaveBorder() {
      return false;
    }
  };
  myActionListener = new MyActionListener();
  myTfWithButton = new ComponentWithBrowseButton<EditorTextField>(myEditorTextField, myActionListener);
  myEditorTextField.setBorder(null);
  new MyCancelEditingAction().registerCustomShortcutSet(CommonShortcuts.ESCAPE, myTfWithButton);
  /*
  myEditorTextField.addActionListener(
    new ActionListener() {
      public void actionPerformed(final ActionEvent e) {
        fireValueCommitted();
      }
    }
  );
  */
}
项目:consulo-ui-designer    文件:ClassToBindProperty.java   
public MyEditor(final Project project) {
  myProject = project;
  myEditorTextField = new EditorTextField("", project, JavaFileType.INSTANCE) {
    protected boolean shouldHaveBorder() {
      return false;
    }
  };
  myActionListener = new MyActionListener();
  myTfWithButton = new ComponentWithBrowseButton<EditorTextField>(myEditorTextField, myActionListener);
  myEditorTextField.setBorder(null);
  new MyCancelEditingAction().registerCustomShortcutSet(CommonShortcuts.ESCAPE, myTfWithButton);
  /*
  myEditorTextField.addActionListener(
    new ActionListener() {
      public void actionPerformed(final ActionEvent e) {
        fireValueCommitted();
      }
    }
  );
  */
}
项目:nuxeo-intellij    文件:NuxeoSDKsPanel.java   
@Override
@Nullable
protected ArrayList<AnAction> createActions(boolean fromPopup) {
    ArrayList<AnAction> result = new ArrayList<AnAction>();
    result.add(new AnAction("Add", "Add", IconUtil.getAddIcon()) {
        {
            registerCustomShortcutSet(CommonShortcuts.INSERT, myTree);
        }

        public void actionPerformed(AnActionEvent event) {
            final VirtualFile sdk = NuxeoSDKChooser.chooseNuxeoSDK(project);
            if (sdk == null)
                return;

            final String name = askForNuxeoSDKName("Register Nuxeo SDK", "");
            if (name == null)
                return;
            final NuxeoSDK nuxeoSDK = new NuxeoSDK(name, sdk.getPath());
            addNuxeoSDKNode(nuxeoSDK);
        }
    });
    result.add(new MyDeleteAction(forAll(Conditions.alwaysTrue())));
    return result;
}
项目:consulo    文件:MultilinePopupBuilder.java   
@Nonnull
JBPopup createPopup() {
  JPanel panel = new JPanel(new BorderLayout());
  panel.add(myTextField, BorderLayout.CENTER);
  ComponentPopupBuilder builder = JBPopupFactory.getInstance().createComponentPopupBuilder(panel, myTextField)
          .setCancelOnClickOutside(true)
          .setAdText(KeymapUtil.getShortcutsText(CommonShortcuts.CTRL_ENTER.getShortcuts()) + " to finish")
          .setRequestFocus(true)
          .setResizable(true)
          .setMayBeParent(true);

  final JBPopup popup = builder.createPopup();
  popup.setMinimumSize(new JBDimension(200, 90));
  AnAction okAction = new DumbAwareAction() {
    @Override
    public void actionPerformed(@Nonnull AnActionEvent e) {
      unregisterCustomShortcutSet(popup.getContent());
      popup.closeOk(e.getInputEvent());
    }
  };
  okAction.registerCustomShortcutSet(CommonShortcuts.CTRL_ENTER, popup.getContent());
  return popup;
}
项目:consulo    文件:FrameWrapper.java   
private void addCloseOnEsc(final RootPaneContainer frame) {
  JRootPane rootPane = frame.getRootPane();
  ActionListener closeAction = new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      if (!PopupUtil.handleEscKeyEvent()) {
        // if you remove this line problems will start happen on Mac OS X
        // 2 projects opened, call Cmd+D on the second opened project and then Esc.
        // Weird situation: 2nd IdeFrame will be active, but focus will be somewhere inside the 1st IdeFrame
        // App is unusable until Cmd+Tab, Cmd+tab
        FrameWrapper.this.myFrame.setVisible(false);
        close();
      }
    }
  };
  rootPane.registerKeyboardAction(closeAction, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW);
  ActionUtil.registerForEveryKeyboardShortcut(rootPane, closeAction, CommonShortcuts.getCloseActiveWindow());
}
项目:intellij-ce-playground    文件:InspectPanel.java   
public InspectPanel(Project project, DebuggerStateManager stateManager, @NotNull NodeDescriptorImpl inspectDescriptor) {
  super(project, stateManager);

  getInspectTree().setInspectDescriptor(inspectDescriptor);

  add(ScrollPaneFactory.createScrollPane(getInspectTree()), BorderLayout.CENTER);
  registerDisposable(DebuggerAction.installEditAction(getInspectTree(), DebuggerActions.EDIT_NODE_SOURCE));

  overrideShortcut(getInspectTree(), DebuggerActions.COPY_VALUE, CommonShortcuts.getCopy());
  setUpdateEnabled(true);
}
项目:intellij-ce-playground    文件:DiffWindowBase.java   
protected void init() {
  if (myWrapper != null) return;

  myProcessor = createProcessor();

  String dialogGroupKey = myProcessor.getContextUserData(DiffUserDataKeys.DIALOG_GROUP_KEY);
  if (dialogGroupKey == null) dialogGroupKey = "DiffContextDialog";

  myWrapper = new WindowWrapperBuilder(DiffUtil.getWindowMode(myHints), new MyPanel(myProcessor.getComponent()))
    .setProject(myProject)
    .setParent(myHints.getParent())
    .setDimensionServiceKey(dialogGroupKey)
    .setOnShowCallback(new Runnable() {
      @Override
      public void run() {
        myProcessor.updateRequest();
        myProcessor.requestFocus(); // TODO: not needed for modal dialogs. Make a flag in WindowWrapperBuilder ?
      }
    })
    .build();
  myWrapper.setImage(ImageLoader.loadFromResource("/diff/Diff.png"));
  Disposer.register(myWrapper, myProcessor);

  new DumbAwareAction() {
    public void actionPerformed(final AnActionEvent e) {
      myWrapper.close();
    }
  }.registerCustomShortcutSet(CommonShortcuts.getCloseActiveWindow(), myProcessor.getComponent(), myWrapper);
}
项目:intellij-ce-playground    文件:ScrollingUtil.java   
public static void installMoveEndAction(final JList list, @Nullable JComponent focusParent) {
  new ListScrollAction(CommonShortcuts.getMoveEnd(), focusParent == null ? list : focusParent){
    @Override
    public void actionPerformed(AnActionEvent e) {
      moveEnd(list);
    }
  };
}
项目:intellij-ce-playground    文件:ScrollingUtil.java   
public static void installMoveHomeAction(final JList list, @Nullable JComponent focusParent) {
  new ListScrollAction(CommonShortcuts.getMoveHome(), focusParent == null ? list : focusParent){
    @Override
    public void actionPerformed(AnActionEvent e) {
      moveHome(list);
    }
  };
}
项目:intellij-ce-playground    文件:ScrollingUtil.java   
public static void installMovePageDownAction(final JList list, @Nullable JComponent focusParent) {
  new ListScrollAction(CommonShortcuts.getMovePageDown(), focusParent == null ? list : focusParent){
    @Override
    public void actionPerformed(AnActionEvent e) {
      movePageDown(list);
    }
  };
}
项目:intellij-ce-playground    文件:ScrollingUtil.java   
public static void installMovePageUpAction(final JList list, @Nullable JComponent focusParent) {
  new ListScrollAction(CommonShortcuts.getMovePageUp(), focusParent == null ? list : focusParent){
    @Override
    public void actionPerformed(AnActionEvent e) {
      movePageUp(list);
    }
  };
}
项目:intellij-ce-playground    文件:ScrollingUtil.java   
public static void installMoveDownAction(final JList list, @Nullable JComponent focusParent) {
  new ListScrollAction(CommonShortcuts.getMoveDown(), focusParent == null ? list : focusParent){
    @Override
    public void actionPerformed(AnActionEvent e) {
      moveDown(list, 0);
    }
  };
}
项目:intellij-ce-playground    文件:ScrollingUtil.java   
public static void installMoveUpAction(final JList list, @Nullable JComponent focusParent) {
  new ListScrollAction(CommonShortcuts.getMoveUp(), focusParent == null ? list : focusParent) {
    @Override
    public void actionPerformed(AnActionEvent e) {
      moveUp(list, 0);
    }
  };
}
项目:intellij-ce-playground    文件:TaskDefaultFavoriteListProvider.java   
private void showNotePopup(Project project,
                           final DnDAwareTree tree,
                           final Consumer<String> after, final String initText) {
  final JTextArea textArea = new JTextArea(3, 50);
  textArea.setFont(UIUtil.getTreeFont());
  textArea.setText(initText);
  final JBScrollPane pane = new JBScrollPane(textArea);
  final ComponentPopupBuilder builder = JBPopupFactory.getInstance().createComponentPopupBuilder(pane, textArea)
    .setCancelOnClickOutside(true)
    .setAdText(KeymapUtil.getShortcutsText(CommonShortcuts.CTRL_ENTER.getShortcuts()) + " to finish")
    .setTitle("Comment")
    .setMovable(true)
    .setRequestFocus(true).setResizable(true).setMayBeParent(true);
  final JBPopup popup = builder.createPopup();
  final JComponent content = popup.getContent();
  final AnAction action = new AnAction() {
    @Override
    public void actionPerformed(AnActionEvent e) {
      popup.closeOk(e.getInputEvent());
      unregisterCustomShortcutSet(content);
      after.consume(textArea.getText());
    }
  };
  action.registerCustomShortcutSet(CommonShortcuts.CTRL_ENTER, content);
  ApplicationManager.getApplication().invokeLater(new Runnable() {
    @Override
    public void run() {
      popup.showInCenterOf(tree);
    }
  }, ModalityState.NON_MODAL, project.getDisposed());
}
项目:intellij-ce-playground    文件:AntBuildFilePropertiesAction.java   
public AntBuildFilePropertiesAction(AntExplorer antExplorer) {
  super(AntBundle.message("build.file.properties.action.name"),
        AntBundle.message("build.file.properties.action.description"),
        AntIcons.Properties);
  myAntExplorer = antExplorer;
  registerCustomShortcutSet(CommonShortcuts.ALT_ENTER, myAntExplorer);
}
项目:intellij-ce-playground    文件:GitSkippedCommits.java   
@Override
protected void addActionsTo(DefaultActionGroup group) {
  super.addActionsTo(group);
  ShowAllAffectedGenericAction showCommit = ShowAllAffectedGenericAction.getInstance();
  showCommit.registerCustomShortcutSet(new CustomShortcutSet(
    CommonShortcuts.DOUBLE_CLICK_1.getShortcuts()[0]), myTree);
  group.addAction(showCommit);

}
项目:tools-idea    文件:InspectPanel.java   
public InspectPanel(Project project, DebuggerStateManager stateManager, @NotNull NodeDescriptorImpl inspectDescriptor) {
  super(project, stateManager);

  getInspectTree().setInspectDescriptor(inspectDescriptor);

  add(ScrollPaneFactory.createScrollPane(getInspectTree()), BorderLayout.CENTER);
  registerDisposable(DebuggerAction.installEditAction(getInspectTree(), DebuggerActions.EDIT_NODE_SOURCE));

  overrideShortcut(getInspectTree(), DebuggerActions.COPY_VALUE, CommonShortcuts.getCopy());
  setUpdateEnabled(true);
}
项目:tools-idea    文件:TaskDefaultFavoriteListProvider.java   
private void showNotePopup(Project project,
                           final DnDAwareTree tree,
                           final Consumer<String> after, final String initText) {
  final JTextArea textArea = new JTextArea(3, 50);
  textArea.setFont(UIUtil.getTreeFont());
  textArea.setText(initText);
  final JBScrollPane pane = new JBScrollPane(textArea);
  final ComponentPopupBuilder builder = JBPopupFactory.getInstance().createComponentPopupBuilder(pane, textArea)
    .setCancelOnClickOutside(true)
    .setAdText(KeymapUtil.getShortcutsText(CommonShortcuts.CTRL_ENTER.getShortcuts()) + " to finish")
    .setTitle("Comment")
    .setMovable(true)
    .setRequestFocus(true).setResizable(true).setMayBeParent(true);
  final JBPopup popup = builder.createPopup();
  final JComponent content = popup.getContent();
  final AnAction action = new AnAction() {
    @Override
    public void actionPerformed(AnActionEvent e) {
      popup.closeOk(e.getInputEvent());
      unregisterCustomShortcutSet(content);
      after.consume(textArea.getText());
    }
  };
  action.registerCustomShortcutSet(CommonShortcuts.CTRL_ENTER, content);
  ApplicationManager.getApplication().invokeLater(new Runnable() {
    @Override
    public void run() {
      popup.showInCenterOf(tree);
    }
  }, ModalityState.NON_MODAL, project.getDisposed());
}
项目:tools-idea    文件:AntBuildFilePropertiesAction.java   
public AntBuildFilePropertiesAction(AntExplorer antExplorer) {
  super(AntBundle.message("build.file.properties.action.name"),
        AntBundle.message("build.file.properties.action.description"),
        AllIcons.Ant.Properties);
  myAntExplorer = antExplorer;
  registerCustomShortcutSet(CommonShortcuts.ALT_ENTER, myAntExplorer);
}
项目:tools-idea    文件:GitSkippedCommits.java   
@Override
protected void addActionsTo(DefaultActionGroup group) {
  super.addActionsTo(group);
  ShowAllAffectedGenericAction showCommit = ShowAllAffectedGenericAction.getInstance();
  showCommit.registerCustomShortcutSet(new CustomShortcutSet(
    CommonShortcuts.DOUBLE_CLICK_1.getShortcuts()[0]), myTree);
  group.addAction(showCommit);

}
项目:consulo-apache-ant    文件:AntBuildFilePropertiesAction.java   
public AntBuildFilePropertiesAction(AntExplorer antExplorer) {
  super(AntBundle.message("build.file.properties.action.name"),
        AntBundle.message("build.file.properties.action.description"),
    ApacheAntIcons.Properties);
  myAntExplorer = antExplorer;
  registerCustomShortcutSet(CommonShortcuts.ALT_ENTER, myAntExplorer);
}
项目:consulo-apache-ant    文件:AntBuildMessageView.java   
private JPanel createToolbarPanel() {
  RunAction runAction = new RunAction(this);
  runAction.registerCustomShortcutSet(CommonShortcuts.getRerun(), this);

  DefaultActionGroup leftActionGroup = new DefaultActionGroup();
  leftActionGroup.add(runAction);
  leftActionGroup.add(new PauseOutputAction(this));
  leftActionGroup.add(new StopAction(this));
  leftActionGroup.add(new CloseAction());
  leftActionGroup.add(new PreviousOccurenceToolbarAction(this));
  leftActionGroup.add(new NextOccurenceToolbarAction(this));
  leftActionGroup.add(new ContextHelpAction(HelpID.ANT));

  DefaultActionGroup rightActionGroup = new DefaultActionGroup();
  rightActionGroup.add(new ChangeViewAction(this));
  rightActionGroup.add(new VerboseAction(this));
  rightActionGroup.add(CommonActionsManager.getInstance().createExpandAllAction(myTreeExpander, this));
  rightActionGroup.add(CommonActionsManager.getInstance().createCollapseAllAction(myTreeExpander, this));
  rightActionGroup.add(myTreeView.createToggleAutoscrollAction());

  myLeftToolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.ANT_MESSAGES_TOOLBAR, leftActionGroup, false);
  JPanel toolbarPanel = new JPanel(new GridLayout(1, 2, 2, 0));
  toolbarPanel.add(myLeftToolbar.getComponent());
  myRightToolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.ANT_MESSAGES_TOOLBAR, rightActionGroup, false);
  toolbarPanel.add(myRightToolbar.getComponent());

  return toolbarPanel;
}
项目:consulo    文件:DiffWindowBase.java   
protected void init() {
  if (myWrapper != null) return;

  myProcessor = createProcessor();

  String dialogGroupKey = myProcessor.getContextUserData(DiffUserDataKeys.DIALOG_GROUP_KEY);
  if (dialogGroupKey == null) dialogGroupKey = "DiffContextDialog";

  myWrapper = new WindowWrapperBuilder(DiffUtil.getWindowMode(myHints), new MyPanel(myProcessor.getComponent()))
          .setProject(myProject)
          .setParent(myHints.getParent())
          .setDimensionServiceKey(dialogGroupKey)
          .setOnShowCallback(new Runnable() {
            @Override
            public void run() {
              myProcessor.updateRequest();
              myProcessor.requestFocus(); // TODO: not needed for modal dialogs. Make a flag in WindowWrapperBuilder ?
            }
          })
          .build();
  myWrapper.setImage(ImageLoader.loadFromResource("/diff/Diff.png"));
  Disposer.register(myWrapper, myProcessor);

  new DumbAwareAction() {
    public void actionPerformed(final AnActionEvent e) {
      myWrapper.close();
    }
  }.registerCustomShortcutSet(CommonShortcuts.getCloseActiveWindow(), myProcessor.getComponent());
}
项目:consulo    文件:ScrollingUtil.java   
public static void installMoveEndAction(final JList list, @Nullable JComponent focusParent) {
  new ListScrollAction(CommonShortcuts.getMoveEnd(), focusParent == null ? list : focusParent){
    @Override
    public void actionPerformed(AnActionEvent e) {
      moveEnd(list);
    }
  };
}
项目:consulo    文件:ScrollingUtil.java   
public static void installMoveHomeAction(final JList list, @Nullable JComponent focusParent) {
  new ListScrollAction(CommonShortcuts.getMoveHome(), focusParent == null ? list : focusParent){
    @Override
    public void actionPerformed(AnActionEvent e) {
      moveHome(list);
    }
  };
}
项目:consulo    文件:ScrollingUtil.java   
public static void installMovePageDownAction(final JList list, @Nullable JComponent focusParent) {
  new ListScrollAction(CommonShortcuts.getMovePageDown(), focusParent == null ? list : focusParent){
    @Override
    public void actionPerformed(AnActionEvent e) {
      movePageDown(list);
    }
  };
}
项目:consulo    文件:ScrollingUtil.java   
public static void installMovePageUpAction(final JList list, @Nullable JComponent focusParent) {
  new ListScrollAction(CommonShortcuts.getMovePageUp(), focusParent == null ? list : focusParent){
    @Override
    public void actionPerformed(AnActionEvent e) {
      movePageUp(list);
    }
  };
}
项目:consulo    文件:ScrollingUtil.java   
public static void installMoveDownAction(final JList list, @Nullable JComponent focusParent) {
  new ListScrollAction(CommonShortcuts.getMoveDown(), focusParent == null ? list : focusParent){
    @Override
    public void actionPerformed(AnActionEvent e) {
      moveDown(list, 0);
    }
  };
}
项目:consulo    文件:ScrollingUtil.java   
public static void installMoveUpAction(final JList list, @Nullable JComponent focusParent) {
  new ListScrollAction(CommonShortcuts.getMoveUp(), focusParent == null ? list : focusParent) {
    @Override
    public void actionPerformed(AnActionEvent e) {
      moveUp(list, 0);
    }
  };
}
项目:consulo    文件:NextOccurrenceAction.java   
@Nonnull
@Override
protected List<Shortcut> getSingleLineShortcuts() {
  if (mySearch) {
    return ContainerUtil.append(Utils.shortcutsOf(IdeActions.ACTION_EDITOR_MOVE_CARET_DOWN), CommonShortcuts.ENTER.getShortcuts());
  }
  else {
    return Utils.shortcutsOf(IdeActions.ACTION_EDITOR_MOVE_CARET_DOWN);
  }
}
项目:consulo    文件:TaskDefaultFavoriteListProvider.java   
private void showNotePopup(Project project,
                           final DnDAwareTree tree,
                           final Consumer<String> after, final String initText) {
  final JTextArea textArea = new JTextArea(3, 50);
  textArea.setFont(UIUtil.getTreeFont());
  textArea.setText(initText);
  final JBScrollPane pane = new JBScrollPane(textArea);
  final ComponentPopupBuilder builder = JBPopupFactory.getInstance().createComponentPopupBuilder(pane, textArea)
    .setCancelOnClickOutside(true)
    .setAdText(KeymapUtil.getShortcutsText(CommonShortcuts.CTRL_ENTER.getShortcuts()) + " to finish")
    .setTitle("Comment")
    .setMovable(true)
    .setRequestFocus(true).setResizable(true).setMayBeParent(true);
  final JBPopup popup = builder.createPopup();
  final JComponent content = popup.getContent();
  final AnAction action = new AnAction() {
    @Override
    public void actionPerformed(AnActionEvent e) {
      popup.closeOk(e.getInputEvent());
      unregisterCustomShortcutSet(content);
      after.consume(textArea.getText());
    }
  };
  action.registerCustomShortcutSet(CommonShortcuts.CTRL_ENTER, content);
  ApplicationManager.getApplication().invokeLater(new Runnable() {
    @Override
    public void run() {
      popup.showInCenterOf(tree);
    }
  }, ModalityState.NON_MODAL, project.getDisposed());
}
项目:consulo-java    文件:DebuggerAction.java   
public static Disposable installEditAction(final JTree tree, String actionName)
{
    final DoubleClickListener listener = new DoubleClickListener()
    {
        @Override
        protected boolean onDoubleClick(MouseEvent e)
        {
            if(tree.getPathForLocation(e.getX(), e.getY()) == null)
            {
                return false;
            }
            DataContext dataContext = DataManager.getInstance().getDataContext(tree);
            GotoFrameSourceAction.doAction(dataContext);
            return true;
        }
    };
    listener.installOn(tree);

    final AnAction action = ActionManager.getInstance().getAction(actionName);
    action.registerCustomShortcutSet(CommonShortcuts.getEditSource(), tree);

    return new Disposable()
    {
        public void dispose()
        {
            listener.uninstall(tree);
            action.unregisterCustomShortcutSet(tree);
        }
    };
}
项目:mybatis-log-plugin    文件:TailContentExecutor.java   
public RerunAction(JComponent consolePanel, ConsoleView consoleView) {
    super("Rerun", "Rerun", AllIcons.Actions.Restart);
    this.consoleView = consoleView;
    registerCustomShortcutSet(CommonShortcuts.getRerun(), consolePanel);
}
项目:RestoreSql    文件:TailContentExecutor.java   
public RerunAction(JComponent consolePanel, ConsoleView consoleView) {
    super("Rerun", "Rerun", AllIcons.Actions.Restart);
    this.consoleView = consoleView;
    registerCustomShortcutSet(CommonShortcuts.getRerun(), consolePanel);
}
项目:intellij-ce-playground    文件:ArtifactEditorNavigateActionBase.java   
public ArtifactEditorNavigateActionBase(JComponent contextComponent) {
  super(ProjectBundle.message("action.name.facet.navigate"));
  registerCustomShortcutSet(CommonShortcuts.getEditSource(), contextComponent);
}