summaryrefslogtreecommitdiff
path: root/platform/lang-impl/src/com/intellij/find/EditorSearchComponent.java
diff options
context:
space:
mode:
Diffstat (limited to 'platform/lang-impl/src/com/intellij/find/EditorSearchComponent.java')
-rw-r--r--platform/lang-impl/src/com/intellij/find/EditorSearchComponent.java34
1 files changed, 22 insertions, 12 deletions
diff --git a/platform/lang-impl/src/com/intellij/find/EditorSearchComponent.java b/platform/lang-impl/src/com/intellij/find/EditorSearchComponent.java
index 8c5864c6569b..8a36638d993c 100644
--- a/platform/lang-impl/src/com/intellij/find/EditorSearchComponent.java
+++ b/platform/lang-impl/src/com/intellij/find/EditorSearchComponent.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -48,6 +48,7 @@ import com.intellij.util.ArrayUtil;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
@@ -68,11 +69,12 @@ public class EditorSearchComponent extends EditorHeaderComponent implements Data
private final Project myProject;
private ActionToolbar myActionsToolbar;
-
+ @NotNull
public Editor getEditor() {
return myEditor;
}
+ @NotNull
private final Editor myEditor;
public JTextComponent getSearchField() {
@@ -173,7 +175,7 @@ public class EditorSearchComponent extends EditorHeaderComponent implements Data
return findModel;
}
- public EditorSearchComponent(Editor editor, Project project) {
+ public EditorSearchComponent(@NotNull Editor editor, Project project) {
this(editor, project, createDefaultFindModel(project, editor));
}
@@ -225,7 +227,7 @@ public class EditorSearchComponent extends EditorHeaderComponent implements Data
}
@Override
- public void cursorMoved(boolean toChangeSelection) {
+ public void cursorMoved() {
updateExcludeStatus();
}
@@ -233,10 +235,7 @@ public class EditorSearchComponent extends EditorHeaderComponent implements Data
public void updateFinished() {
}
- @Override
- public void editorChanged(SearchResults sr, Editor oldEditor) { }
-
- public EditorSearchComponent(final Editor editor, final Project project, FindModel findModel) {
+ public EditorSearchComponent(@NotNull final Editor editor, final Project project, FindModel findModel) {
myFindModel = findModel;
myProject = project;
@@ -367,6 +366,9 @@ public class EditorSearchComponent extends EditorHeaderComponent implements Data
actionGroup.add(new ShowHistoryAction(mySearchFieldGetter, this));
actionGroup.add(new PrevOccurrenceAction(this, mySearchFieldGetter));
actionGroup.add(new NextOccurrenceAction(this, mySearchFieldGetter));
+ actionGroup.add(new AddOccurrenceAction(this));
+ actionGroup.add(new RemoveOccurrenceAction(this));
+ actionGroup.add(new SelectAllAction(this));
actionGroup.add(new FindAllAction(this));
actionGroup.add(new ToggleMultiline(this));
actionGroup.add(new ToggleMatchCase(this));
@@ -803,10 +805,6 @@ public class EditorSearchComponent extends EditorHeaderComponent implements Data
}
public void close() {
- if (myEditor.getSelectionModel().hasSelection()) {
- myEditor.getCaretModel().moveToOffset(myEditor.getSelectionModel().getSelectionStart());
- myEditor.getSelectionModel().removeSelection();
- }
IdeFocusManager.getInstance(myProject).requestFocus(myEditor.getContentComponent(), false);
myLivePreviewController.dispose();
@@ -937,6 +935,18 @@ public class EditorSearchComponent extends EditorHeaderComponent implements Data
return insets;
}
+ public void selectAllOccurrences() {
+ FindUtil.selectSearchResultsInEditor(myEditor, mySearchResults.getOccurrences().iterator(), -1);
+ }
+
+ public void removeOccurrence() {
+ mySearchResults.prevOccurrence(true);
+ }
+
+ public void addNextOccurrence() {
+ mySearchResults.nextOccurrence(true);
+ }
+
private static class MyUndoProvider extends TextComponentUndoProvider {
private boolean myEnabled = true;
public MyUndoProvider(JTextComponent textComponent) {