mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
search in comments and literals (IDEA-55681)
This commit is contained in:
+4
-1
@@ -1,6 +1,7 @@
|
||||
package com.intellij.find.editorHeaderActions;
|
||||
|
||||
import com.intellij.find.EditorSearchComponent;
|
||||
import com.intellij.find.FindModel;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
|
||||
public class ToggleInCommentsAction extends EditorHeaderToggleAction implements SecondaryHeaderAction {
|
||||
@@ -17,6 +18,8 @@ public class ToggleInCommentsAction extends EditorHeaderToggleAction implements
|
||||
|
||||
@Override
|
||||
public void setSelected(AnActionEvent e, boolean state) {
|
||||
getEditorSearchComponent().getFindModel().setInCommentsOnly(state);
|
||||
FindModel findModel = getEditorSearchComponent().getFindModel();
|
||||
findModel.setInCommentsOnly(state);
|
||||
if (state) findModel.setInStringLiteralsOnly(false);
|
||||
}
|
||||
}
|
||||
|
||||
+4
-1
@@ -1,6 +1,7 @@
|
||||
package com.intellij.find.editorHeaderActions;
|
||||
|
||||
import com.intellij.find.EditorSearchComponent;
|
||||
import com.intellij.find.FindModel;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
|
||||
public class ToggleInLiteralsOnlyAction extends EditorHeaderToggleAction implements SecondaryHeaderAction {
|
||||
@@ -17,6 +18,8 @@ public class ToggleInLiteralsOnlyAction extends EditorHeaderToggleAction implem
|
||||
|
||||
@Override
|
||||
public void setSelected(AnActionEvent e, boolean state) {
|
||||
getEditorSearchComponent().getFindModel().setInStringLiteralsOnly(state);
|
||||
FindModel findModel = getEditorSearchComponent().getFindModel();
|
||||
findModel.setInStringLiteralsOnly(state);
|
||||
if (state) findModel.setInCommentsOnly(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -619,6 +619,18 @@ public class FindDialog extends DialogWrapper {
|
||||
|
||||
myCbInCommentsOnly = createCheckbox(FindBundle.message("find.options.comments.only"));
|
||||
myCbInStringLiteralsOnly = createCheckbox(FindBundle.message("find.options.string.literals.only"));
|
||||
ItemListener itemListener = new ItemListener() {
|
||||
@Override
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
if (e.getSource() == myCbInCommentsOnly) {
|
||||
if (myCbInCommentsOnly.isSelected()) myCbInStringLiteralsOnly.setSelected(false);
|
||||
} else if (e.getSource() == myCbInStringLiteralsOnly) {
|
||||
if (myCbInStringLiteralsOnly.isSelected()) myCbInCommentsOnly.setSelected(false);
|
||||
}
|
||||
}
|
||||
};
|
||||
myCbInCommentsOnly.addItemListener(itemListener);
|
||||
myCbInStringLiteralsOnly.addItemListener(itemListener);
|
||||
|
||||
if (FindManagerImpl.ourHasSearchInCommentsAndLiterals) {
|
||||
findOptionsPanel.add(myCbInCommentsOnly);
|
||||
|
||||
@@ -33,7 +33,6 @@ import com.intellij.openapi.actionSystem.ActionManager;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.IdeActions;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ex.ApplicationManagerEx;
|
||||
import com.intellij.openapi.components.PersistentStateComponent;
|
||||
import com.intellij.openapi.components.State;
|
||||
import com.intellij.openapi.components.Storage;
|
||||
@@ -102,7 +101,7 @@ public class FindManagerImpl extends FindManager implements PersistentStateCompo
|
||||
private final MessageBus myBus;
|
||||
private static final Key<Boolean> HIGHLIGHTER_WAS_NOT_FOUND_KEY = Key.create("com.intellij.find.impl.FindManagerImpl.HighlighterNotFoundKey");
|
||||
@NonNls private static final String FIND_USAGES_MANAGER_ELEMENT = "FindUsagesManager";
|
||||
public static final boolean ourHasSearchInCommentsAndLiterals = ApplicationManagerEx.getApplicationEx().isInternal(); // TODO: maxim
|
||||
public static final boolean ourHasSearchInCommentsAndLiterals = true;
|
||||
private FindDialog myFindDialog;
|
||||
|
||||
public FindManagerImpl(Project project, FindSettings findSettings, UsageViewManager anotherManager, MessageBus bus) {
|
||||
|
||||
Reference in New Issue
Block a user