Search in sources :

Example 6 with EditorSearchSession

use of com.intellij.find.EditorSearchSession in project intellij-community by JetBrains.

the class SwitchToReplace method actionPerformed.

@Override
public void actionPerformed(AnActionEvent e) {
    EditorSearchSession search = e.getRequiredData(EditorSearchSession.SESSION_KEY);
    FindModel findModel = search.getFindModel();
    FindUtil.configureFindModel(true, e.getData(CommonDataKeys.EDITOR_EVEN_IF_INACTIVE), findModel, false);
    search.getComponent().getSearchTextComponent().selectAll();
}
Also used : FindModel(com.intellij.find.FindModel) EditorSearchSession(com.intellij.find.EditorSearchSession)

Example 7 with EditorSearchSession

use of com.intellij.find.EditorSearchSession in project intellij-community by JetBrains.

the class ToggleSelectionOnlyAction method update.

@Override
public void update(AnActionEvent e) {
    super.update(e);
    EditorSearchSession session = e.getData(EditorSearchSession.SESSION_KEY);
    e.getPresentation().setEnabledAndVisible(session != null && session.getFindModel().isReplaceState());
}
Also used : EditorSearchSession(com.intellij.find.EditorSearchSession)

Example 8 with EditorSearchSession

use of com.intellij.find.EditorSearchSession in project intellij-community by JetBrains.

the class FindAllAction method update.

@Override
public void update(final AnActionEvent e) {
    Project project = e.getProject();
    Editor editor = e.getData(CommonDataKeys.EDITOR_EVEN_IF_INACTIVE);
    EditorSearchSession search = e.getData(EditorSearchSession.SESSION_KEY);
    updateTemplateIcon(search);
    e.getPresentation().setIcon(getTemplatePresentation().getIcon());
    e.getPresentation().setEnabled(editor != null && project != null && search != null && !project.isDisposed() && search.hasMatches() && PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument()) != null);
}
Also used : Project(com.intellij.openapi.project.Project) EditorSearchSession(com.intellij.find.EditorSearchSession) Editor(com.intellij.openapi.editor.Editor)

Example 9 with EditorSearchSession

use of com.intellij.find.EditorSearchSession in project intellij-community by JetBrains.

the class OccurrenceAction method update.

@Override
public void update(AnActionEvent e) {
    EditorSearchSession search = e.getData(EditorSearchSession.SESSION_KEY);
    if (search == null) {
        e.getPresentation().setEnabledAndVisible(false);
        return;
    }
    boolean isFind = !search.getFindModel().isReplaceState();
    boolean hasMatches = search.hasMatches();
    e.getPresentation().setVisible(isFind);
    e.getPresentation().setEnabled(isFind && hasMatches);
}
Also used : EditorSearchSession(com.intellij.find.EditorSearchSession)

Example 10 with EditorSearchSession

use of com.intellij.find.EditorSearchSession in project intellij-community by JetBrains.

the class SwitchToFind method actionPerformed.

@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.getData(CommonDataKeys.EDITOR_EVEN_IF_INACTIVE), findModel, false);
    search.getComponent().getSearchTextComponent().selectAll();
}
Also used : FindModel(com.intellij.find.FindModel) EditorSearchSession(com.intellij.find.EditorSearchSession)

Aggregations

EditorSearchSession (com.intellij.find.EditorSearchSession)12 FindModel (com.intellij.find.FindModel)4 Editor (com.intellij.openapi.editor.Editor)3 Project (com.intellij.openapi.project.Project)3 EditorWindow (com.intellij.injected.editor.EditorWindow)1