Java Code Examples for com.intellij.openapi.keymap.KeymapUtil#isEmacsKeymap()

The following examples show how to use com.intellij.openapi.keymap.KeymapUtil#isEmacsKeymap() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SwitchToFind.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void update(AnActionEvent e) {
  if (KeymapUtil.isEmacsKeymap()) {
    // Emacs users are accustomed to the editor that executes 'find next' on subsequent pressing of shortcut that
    // activates 'incremental search'. Hence, we do the similar hack here for them.
    ActionManager.getInstance().getAction(IdeActions.ACTION_FIND_NEXT).update(e);
  }
  else {
    EditorSearchSession search = e.getData(EditorSearchSession.SESSION_KEY);
    e.getPresentation().setEnabledAndVisible(search != null);
  }
}
 
Example 2
Source File: SwitchToFind.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void actionPerformed(AnActionEvent e) {
  if (KeymapUtil.isEmacsKeymap()) {
    // Emacs users are accustomed to the editor that executes 'find next' on subsequent pressing of shortcut that
    // activates 'incremental search'. Hence, we do the similar hack here for them.
    ActionManager.getInstance().getAction(IdeActions.ACTION_FIND_NEXT).actionPerformed(e);
    return;
  }

  EditorSearchSession search = e.getRequiredData(EditorSearchSession.SESSION_KEY);
  final FindModel findModel = search.getFindModel();
  FindUtil.configureFindModel(false, e.getDataContext().getData(EDITOR), findModel, false);
  search.getComponent().getSearchTextComponent().selectAll();
}