Search in sources :

Example 6 with FindModel

use of com.intellij.find.FindModel 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 FindModel

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

the class ToggleRegex method setSelected.

@Override
protected void setSelected(@NotNull SearchSession session, boolean selected) {
    FindModel findModel = session.getFindModel();
    findModel.setRegularExpressions(selected);
    if (selected) {
        findModel.setWholeWordsOnly(false);
    }
    FindSettings.getInstance().setLocalRegularExpressions(selected);
}
Also used : FindModel(com.intellij.find.FindModel)

Example 8 with FindModel

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

the class SearchResults method setNotFoundState.

public void setNotFoundState(boolean isForward) {
    myNotFoundState = true;
    FindModel findModel = new FindModel();
    findModel.copyFrom(myFindModel);
    findModel.setForward(isForward);
    FindUtil.processNotFound(myEditor, findModel.getStringToFind(), findModel, getProject());
}
Also used : FindModel(com.intellij.find.FindModel)

Example 9 with FindModel

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

the class SearchResults method updatePreviousFindModel.

private void updatePreviousFindModel(FindModel model) {
    FindModel prev = FindManager.getInstance(getProject()).getPreviousFindModel();
    if (prev == null) {
        prev = new FindModel();
    }
    if (!model.getStringToFind().isEmpty()) {
        prev.copyFrom(model);
        FindManager.getInstance(getProject()).setPreviousFindModel(prev);
    }
}
Also used : FindModel(com.intellij.find.FindModel)

Example 10 with FindModel

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

the class LivePreview method showReplacementPreview.

private void showReplacementPreview() {
    hideBalloon();
    if (!mySearchResults.isUpToDate())
        return;
    final FindResult cursor = mySearchResults.getCursor();
    final Editor editor = mySearchResults.getEditor();
    if (myDelegate != null && cursor != null) {
        String replacementPreviewText = myDelegate.getStringToReplace(editor, cursor);
        if (StringUtil.isEmpty(replacementPreviewText)) {
            replacementPreviewText = EMPTY_STRING_DISPLAY_TEXT;
        }
        final FindModel findModel = mySearchResults.getFindModel();
        if (findModel.isRegularExpressions() && findModel.isReplaceState()) {
            showBalloon(editor, replacementPreviewText);
        }
    }
}
Also used : FindModel(com.intellij.find.FindModel) Editor(com.intellij.openapi.editor.Editor) FindResult(com.intellij.find.FindResult)

Aggregations

FindModel (com.intellij.find.FindModel)31 FindManager (com.intellij.find.FindManager)8 Project (com.intellij.openapi.project.Project)7 UsageInfo (com.intellij.usageView.UsageInfo)6 FindUsagesProcessPresentation (com.intellij.usages.FindUsagesProcessPresentation)5 EditorSearchSession (com.intellij.find.EditorSearchSession)4 Editor (com.intellij.openapi.editor.Editor)4 VirtualFile (com.intellij.openapi.vfs.VirtualFile)4 FindResult (com.intellij.find.FindResult)3 StatusBar (com.intellij.openapi.wm.StatusBar)3 HighlightManager (com.intellij.codeInsight.highlighting.HighlightManager)2 Application (com.intellij.openapi.application.Application)2 EditorColorsManager (com.intellij.openapi.editor.colors.EditorColorsManager)2 EditorColorsScheme (com.intellij.openapi.editor.colors.EditorColorsScheme)2 TextAttributes (com.intellij.openapi.editor.markup.TextAttributes)2 FileEditorManager (com.intellij.openapi.fileEditor.FileEditorManager)2 Module (com.intellij.openapi.module.Module)2 WindowManager (com.intellij.openapi.wm.WindowManager)2 PsiClass (com.intellij.psi.PsiClass)2 PsiElement (com.intellij.psi.PsiElement)2