mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
ui for context of searching
This commit is contained in:
@@ -47,7 +47,7 @@ public class FileContent extends UserDataHolderBase {
|
||||
@NotNull
|
||||
public byte[] getBytes() throws IOException {
|
||||
if (myCachedBytes == null) {
|
||||
myCachedBytes = myVirtualFile.contentsToByteArray(false);
|
||||
myCachedBytes = myVirtualFile.isValid() ? myVirtualFile.contentsToByteArray(false) : ArrayUtil.EMPTY_BYTE_ARRAY;
|
||||
}
|
||||
|
||||
return myCachedBytes;
|
||||
|
||||
@@ -72,8 +72,7 @@ public class FindModel extends UserDataHolderBase implements Cloneable {
|
||||
private boolean isSearchHighlighters = false;
|
||||
private boolean isReplaceState = false;
|
||||
private boolean isWholeWordsOnly = false;
|
||||
private boolean isInCommentsOnly;
|
||||
private boolean isInStringLiteralsOnly;
|
||||
private SearchContext searchContext = SearchContext.ANY;
|
||||
private boolean isFromCursor = true;
|
||||
private boolean isForward = true;
|
||||
private boolean isGlobal = true;
|
||||
@@ -171,8 +170,7 @@ public class FindModel extends UserDataHolderBase implements Cloneable {
|
||||
isCustomScope = model.isCustomScope;
|
||||
isFindAll = model.isFindAll;
|
||||
|
||||
isInCommentsOnly = model.isInCommentsOnly;
|
||||
isInStringLiteralsOnly = model.isInStringLiteralsOnly;
|
||||
searchContext = model.searchContext;
|
||||
|
||||
isMultiline = model.isMultiline;
|
||||
}
|
||||
@@ -191,8 +189,8 @@ public class FindModel extends UserDataHolderBase implements Cloneable {
|
||||
if (isForward != findModel.isForward) return false;
|
||||
if (isFromCursor != findModel.isFromCursor) return false;
|
||||
if (isGlobal != findModel.isGlobal) return false;
|
||||
if (isInCommentsOnly != findModel.isInCommentsOnly) return false;
|
||||
if (isInStringLiteralsOnly != findModel.isInStringLiteralsOnly) return false;
|
||||
if (searchContext != findModel.searchContext) return false;
|
||||
|
||||
if (isMultiline != findModel.isMultiline) return false;
|
||||
if (isMultipleFiles != findModel.isMultipleFiles) return false;
|
||||
if (isOpenInNewTabEnabled != findModel.isOpenInNewTabEnabled) return false;
|
||||
@@ -229,8 +227,7 @@ public class FindModel extends UserDataHolderBase implements Cloneable {
|
||||
result = 31 * result + (isSearchHighlighters ? 1 : 0);
|
||||
result = 31 * result + (isReplaceState ? 1 : 0);
|
||||
result = 31 * result + (isWholeWordsOnly ? 1 : 0);
|
||||
result = 31 * result + (isInCommentsOnly ? 1 : 0);
|
||||
result = 31 * result + (isInStringLiteralsOnly ? 1 : 0);
|
||||
result = 31 * result + (searchContext.ordinal());
|
||||
result = 31 * result + (isFromCursor ? 1 : 0);
|
||||
result = 31 * result + (isForward ? 1 : 0);
|
||||
result = 31 * result + (isGlobal ? 1 : 0);
|
||||
@@ -673,8 +670,7 @@ public class FindModel extends UserDataHolderBase implements Cloneable {
|
||||
buffer.append("myStringToReplace =").append(myStringToReplace).append("\n");
|
||||
buffer.append("isReplaceState =").append(isReplaceState).append("\n");
|
||||
buffer.append("isWholeWordsOnly =").append(isWholeWordsOnly).append("\n");
|
||||
buffer.append("isInStringLiterals =").append(isInStringLiteralsOnly).append("\n");
|
||||
buffer.append("isInComments =").append(isInCommentsOnly).append("\n");
|
||||
buffer.append("searchContext =").append(searchContext).append("\n");
|
||||
buffer.append("isFromCursor =").append(isFromCursor).append("\n");
|
||||
buffer.append("isForward =").append(isForward).append("\n");
|
||||
buffer.append("isGlobal =").append(isGlobal).append("\n");
|
||||
@@ -853,25 +849,41 @@ public class FindModel extends UserDataHolderBase implements Cloneable {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isInStringLiteralsOnly() {
|
||||
return isInStringLiteralsOnly;
|
||||
public enum SearchContext {
|
||||
ANY, IN_STRINGS, IN_COMMENTS, EXCEPT_STRINGS, EXCEPT_COMMENTS, EXCEPT_STRINGS_AND_COMMENTS
|
||||
}
|
||||
|
||||
public void setInStringLiteralsOnly(boolean inStringLiteralsOnly) {
|
||||
boolean changed = isInStringLiteralsOnly != inStringLiteralsOnly;
|
||||
isInStringLiteralsOnly = inStringLiteralsOnly;
|
||||
if (changed) {
|
||||
notifyObservers();
|
||||
}
|
||||
public boolean isInStringLiteralsOnly() {
|
||||
return searchContext == SearchContext.IN_STRINGS;
|
||||
}
|
||||
|
||||
public boolean isExceptComments() {
|
||||
return searchContext == SearchContext.EXCEPT_COMMENTS;
|
||||
}
|
||||
|
||||
public boolean isExceptStringLiterals() {
|
||||
return searchContext == SearchContext.EXCEPT_STRINGS;
|
||||
}
|
||||
|
||||
public boolean isInCommentsOnly() {
|
||||
return isInCommentsOnly;
|
||||
return searchContext == SearchContext.IN_COMMENTS;
|
||||
}
|
||||
|
||||
public void setInCommentsOnly(boolean inCommentsOnly) {
|
||||
boolean changed = isInCommentsOnly != inCommentsOnly;
|
||||
isInCommentsOnly = inCommentsOnly;
|
||||
public boolean isExceptCommentsAndStringLiterals() {
|
||||
return searchContext == SearchContext.EXCEPT_STRINGS_AND_COMMENTS;
|
||||
}
|
||||
|
||||
public @NotNull SearchContext getSearchContext() {
|
||||
return searchContext;
|
||||
}
|
||||
|
||||
public void setSearchContext(@NotNull SearchContext _searchContext) {
|
||||
doSetContext(_searchContext);
|
||||
}
|
||||
|
||||
private void doSetContext(SearchContext newSearchContext) {
|
||||
boolean changed = newSearchContext != searchContext;
|
||||
searchContext = newSearchContext;
|
||||
if (changed) {
|
||||
notifyObservers();
|
||||
}
|
||||
|
||||
@@ -392,6 +392,9 @@ public class EditorSearchComponent extends EditorHeaderComponent implements Data
|
||||
if (secondaryActionsAvailable()) {
|
||||
actionGroup.addAction(new ToggleInCommentsAction(this)).setAsSecondary(true);
|
||||
actionGroup.addAction(new ToggleInLiteralsOnlyAction(this)).setAsSecondary(true);
|
||||
actionGroup.addAction(new ToggleExceptCommentsAction(this)).setAsSecondary(true);
|
||||
actionGroup.addAction(new ToggleExceptLiteralsAction(this)).setAsSecondary(true);
|
||||
actionGroup.addAction(new ToggleExceptCommentsAndLiteralsAction(this)).setAsSecondary(true);
|
||||
}
|
||||
actionGroup.addAction(new TogglePreserveCaseAction(this));
|
||||
actionGroup.addAction(new ToggleSelectionOnlyAction(this));
|
||||
@@ -473,8 +476,7 @@ public class EditorSearchComponent extends EditorHeaderComponent implements Data
|
||||
to.setCaseSensitive(from.isCaseSensitive());
|
||||
to.setWholeWordsOnly(from.isWholeWordsOnly());
|
||||
to.setRegularExpressions(from.isRegularExpressions());
|
||||
to.setInCommentsOnly(from.isInCommentsOnly());
|
||||
to.setInStringLiteralsOnly(from.isInStringLiteralsOnly());
|
||||
to.setSearchContext(from.getSearchContext());
|
||||
if (from.isReplaceState()) {
|
||||
to.setPreserveCase(from.isPreserveCase());
|
||||
}
|
||||
|
||||
@@ -119,4 +119,13 @@ public abstract class FindSettings{
|
||||
|
||||
public abstract boolean isInCommentsOnly();
|
||||
public abstract void setInCommentsOnly(boolean selected);
|
||||
|
||||
public abstract boolean isExceptStringLiterals();
|
||||
public abstract void setExceptStringLiterals(boolean selected);
|
||||
|
||||
public abstract boolean isExceptComments();
|
||||
public abstract void setExceptComments(boolean selected);
|
||||
|
||||
public abstract boolean isExceptCommentsAndLiterals();
|
||||
public abstract void setExceptCommentsAndLiterals(boolean selected);
|
||||
}
|
||||
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.find.editorHeaderActions;
|
||||
|
||||
import com.intellij.find.EditorSearchComponent;
|
||||
import com.intellij.find.FindModel;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
|
||||
public class ToggleExceptCommentsAction extends EditorHeaderToggleAction implements SecondaryHeaderAction {
|
||||
private static final String TEXT = "Except C&omments";
|
||||
|
||||
public ToggleExceptCommentsAction(EditorSearchComponent editorSearchComponent) {
|
||||
super(editorSearchComponent, TEXT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelected(AnActionEvent e) {
|
||||
return getEditorSearchComponent().getFindModel().isExceptComments();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelected(AnActionEvent e, boolean state) {
|
||||
getEditorSearchComponent().getFindModel().setSearchContext(state ? FindModel.SearchContext.EXCEPT_COMMENTS : FindModel.SearchContext.ANY);
|
||||
}
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.find.editorHeaderActions;
|
||||
|
||||
import com.intellij.find.EditorSearchComponent;
|
||||
import com.intellij.find.FindModel;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
|
||||
public class ToggleExceptCommentsAndLiteralsAction extends EditorHeaderToggleAction implements SecondaryHeaderAction {
|
||||
private static final String TEXT = "Except Comments and Li&terals";
|
||||
|
||||
public ToggleExceptCommentsAndLiteralsAction(EditorSearchComponent editorSearchComponent) {
|
||||
super(editorSearchComponent, TEXT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelected(AnActionEvent e) {
|
||||
return getEditorSearchComponent().getFindModel().isExceptCommentsAndStringLiterals();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelected(AnActionEvent e, boolean state) {
|
||||
getEditorSearchComponent().getFindModel().setSearchContext(state ? FindModel.SearchContext.EXCEPT_STRINGS_AND_COMMENTS : FindModel.SearchContext.ANY);
|
||||
}
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.find.editorHeaderActions;
|
||||
|
||||
import com.intellij.find.EditorSearchComponent;
|
||||
import com.intellij.find.FindModel;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
|
||||
public class ToggleExceptLiteralsAction extends EditorHeaderToggleAction implements SecondaryHeaderAction {
|
||||
private static final String TEXT = "Except L&iterals";
|
||||
|
||||
public ToggleExceptLiteralsAction(EditorSearchComponent editorSearchComponent) {
|
||||
super(editorSearchComponent, TEXT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelected(AnActionEvent e) {
|
||||
return getEditorSearchComponent().getFindModel().isExceptStringLiterals();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelected(AnActionEvent e, boolean state) {
|
||||
getEditorSearchComponent().getFindModel().setSearchContext(state ? FindModel.SearchContext.EXCEPT_STRINGS : FindModel.SearchContext.ANY);
|
||||
}
|
||||
}
|
||||
+1
-3
@@ -18,8 +18,6 @@ public class ToggleInCommentsAction extends EditorHeaderToggleAction implements
|
||||
|
||||
@Override
|
||||
public void setSelected(AnActionEvent e, boolean state) {
|
||||
FindModel findModel = getEditorSearchComponent().getFindModel();
|
||||
findModel.setInCommentsOnly(state);
|
||||
if (state) findModel.setInStringLiteralsOnly(false);
|
||||
getEditorSearchComponent().getFindModel().setSearchContext(state ? FindModel.SearchContext.IN_COMMENTS : FindModel.SearchContext.ANY);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-3
@@ -18,8 +18,6 @@ public class ToggleInLiteralsOnlyAction extends EditorHeaderToggleAction implem
|
||||
|
||||
@Override
|
||||
public void setSelected(AnActionEvent e, boolean state) {
|
||||
FindModel findModel = getEditorSearchComponent().getFindModel();
|
||||
findModel.setInStringLiteralsOnly(state);
|
||||
if (state) findModel.setInCommentsOnly(false);
|
||||
getEditorSearchComponent().getFindModel().setSearchContext(state ? FindModel.SearchContext.IN_STRINGS : FindModel.SearchContext.ANY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,8 +74,7 @@ public class FindDialog extends DialogWrapper {
|
||||
private StateRestoringCheckBox myCbCaseSensitive;
|
||||
private StateRestoringCheckBox myCbPreserveCase;
|
||||
private StateRestoringCheckBox myCbWholeWordsOnly;
|
||||
private StateRestoringCheckBox myCbInCommentsOnly;
|
||||
private StateRestoringCheckBox myCbInStringLiteralsOnly;
|
||||
private ComboBox mySearchContext;
|
||||
private StateRestoringCheckBox myCbRegularExpressions;
|
||||
private JRadioButton myRbGlobal;
|
||||
private JRadioButton myRbSelectedText;
|
||||
@@ -472,6 +471,9 @@ public class FindDialog extends DialogWrapper {
|
||||
findSettings.setWholeWordsOnly(myModel.isWholeWordsOnly());
|
||||
findSettings.setInStringLiteralsOnly(myModel.isInStringLiteralsOnly());
|
||||
findSettings.setInCommentsOnly(myModel.isInCommentsOnly());
|
||||
findSettings.setExceptComments(myModel.isExceptComments());
|
||||
findSettings.setExceptStringLiterals(myModel.isExceptStringLiterals());
|
||||
findSettings.setExceptCommentsAndLiterals(myModel.isExceptCommentsAndStringLiterals());
|
||||
|
||||
findSettings.setRegularExpressions(myModel.isRegularExpressions());
|
||||
if (!myModel.isMultipleFiles()){
|
||||
@@ -603,24 +605,33 @@ public class FindDialog extends DialogWrapper {
|
||||
|
||||
findOptionsPanel.add(regExPanel);
|
||||
|
||||
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);
|
||||
mySearchContext = new ComboBox(new Object[] {FindBundle.message("find.context.anywhere.scope.label", 200),
|
||||
FindBundle.message("find.context.in.comments.scope.label"), FindBundle.message("find.context.in.literals.scope.label"),
|
||||
FindBundle.message("find.context.except.comments.scope.label"),
|
||||
FindBundle.message("find.context.except.literals.scope.label"),
|
||||
FindBundle.message("find.context.except.comments.and.literals.scope.label")});
|
||||
final JPanel searchContextPanel = new JPanel(new GridBagLayout());
|
||||
searchContextPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
|
||||
|
||||
GridBagConstraints gbConstraints = new GridBagConstraints();
|
||||
gbConstraints.fill = GridBagConstraints.HORIZONTAL;
|
||||
gbConstraints.anchor = GridBagConstraints.WEST;
|
||||
|
||||
gbConstraints.gridx = 0;
|
||||
gbConstraints.gridy = 0;
|
||||
gbConstraints.gridwidth = 1;
|
||||
gbConstraints.weightx = 1;
|
||||
|
||||
JLabel searchContextLabel = new JLabel(FindBundle.message("find.context.combo.label"));
|
||||
searchContextLabel.setLabelFor(mySearchContext);
|
||||
searchContextPanel.add(searchContextLabel, gbConstraints);
|
||||
|
||||
++gbConstraints.gridx;
|
||||
|
||||
searchContextPanel.add(mySearchContext, gbConstraints);
|
||||
|
||||
if (FindManagerImpl.ourHasSearchInCommentsAndLiterals) {
|
||||
findOptionsPanel.add(myCbInCommentsOnly);
|
||||
findOptionsPanel.add(myCbInStringLiteralsOnly);
|
||||
findOptionsPanel.add(searchContextPanel);
|
||||
}
|
||||
|
||||
ActionListener actionListener = new ActionListener() {
|
||||
@@ -985,9 +996,25 @@ public class FindDialog extends DialogWrapper {
|
||||
}
|
||||
|
||||
model.setWholeWordsOnly(myCbWholeWordsOnly.isSelected());
|
||||
model.setInStringLiteralsOnly(myCbInStringLiteralsOnly.isSelected());
|
||||
|
||||
model.setInCommentsOnly(myCbInCommentsOnly.isSelected());
|
||||
String selectedSearchContextInUi = (String)mySearchContext.getSelectedItem();
|
||||
FindModel.SearchContext searchContext = FindModel.SearchContext.ANY;
|
||||
if (FindBundle.message("find.context.in.literals.scope.label").equals(selectedSearchContextInUi)) {
|
||||
searchContext = FindModel.SearchContext.IN_STRINGS;
|
||||
}
|
||||
else if (FindBundle.message("find.context.in.comments.scope.label").equals(selectedSearchContextInUi)) {
|
||||
searchContext = FindModel.SearchContext.IN_COMMENTS;
|
||||
}
|
||||
else if (FindBundle.message("find.context.except.comments.scope.label").equals(selectedSearchContextInUi)) {
|
||||
searchContext = FindModel.SearchContext.EXCEPT_COMMENTS;
|
||||
}
|
||||
else if (FindBundle.message("find.context.except.literals.scope.label").equals(selectedSearchContextInUi)) {
|
||||
searchContext = FindModel.SearchContext.EXCEPT_STRINGS;
|
||||
} else if (FindBundle.message("find.context.except.comments.and.literals.scope.label").equals(selectedSearchContextInUi)) {
|
||||
searchContext = FindModel.SearchContext.EXCEPT_STRINGS_AND_COMMENTS;
|
||||
}
|
||||
|
||||
model.setSearchContext(searchContext);
|
||||
|
||||
model.setRegularExpressions(myCbRegularExpressions.isSelected());
|
||||
String stringToFind = getStringToFind();
|
||||
@@ -1053,8 +1080,14 @@ public class FindDialog extends DialogWrapper {
|
||||
private void initByModel() {
|
||||
myCbCaseSensitive.setSelected(myModel.isCaseSensitive());
|
||||
myCbWholeWordsOnly.setSelected(myModel.isWholeWordsOnly());
|
||||
myCbInStringLiteralsOnly.setSelected(myModel.isInStringLiteralsOnly());
|
||||
myCbInCommentsOnly.setSelected(myModel.isInCommentsOnly());
|
||||
String searchContext = FindBundle.message("find.context.anywhere.scope.label");
|
||||
if (myModel.isInCommentsOnly()) searchContext = FindBundle.message("find.context.in.comments.scope.label");
|
||||
else if (myModel.isInStringLiteralsOnly()) searchContext = FindBundle.message("find.context.in.literals.scope.label");
|
||||
else if (myModel.isExceptStringLiterals()) searchContext = FindBundle.message("find.context.except.literals.scope.label");
|
||||
else if (myModel.isExceptComments()) searchContext = FindBundle.message("find.context.except.literals.scope.label");
|
||||
else if (myModel.isExceptCommentsAndStringLiterals()) searchContext = FindBundle.message("find.context.except.comments.and.literals.scope.label");
|
||||
mySearchContext.setSelectedItem(searchContext);
|
||||
|
||||
myCbRegularExpressions.setSelected(myModel.isRegularExpressions());
|
||||
|
||||
if (myModel.isMultipleFiles()) {
|
||||
|
||||
@@ -110,7 +110,13 @@ public class FindResultUsageInfo extends UsageInfo {
|
||||
|
||||
assert result.isStringFound();
|
||||
|
||||
if (myFindModel.isRegularExpressions() || myFindModel.isInCommentsOnly() || myFindModel.isInStringLiteralsOnly()) {
|
||||
if (myFindModel.isRegularExpressions() ||
|
||||
myFindModel.isInCommentsOnly() ||
|
||||
myFindModel.isInStringLiteralsOnly() ||
|
||||
myFindModel.isExceptStringLiterals() ||
|
||||
myFindModel.isExceptCommentsAndStringLiterals() ||
|
||||
myFindModel.isExceptComments()
|
||||
) {
|
||||
myAnchor = SmartPointerManager.getInstance(getProject()).createSmartPsiFileRangePointer(file, TextRange.from(offset, 0));
|
||||
}
|
||||
|
||||
|
||||
@@ -103,6 +103,9 @@ public class FindSettingsImpl extends FindSettings implements PersistentStateCom
|
||||
@SuppressWarnings({"WeakerAccess"}) public boolean WHOLE_WORDS_ONLY = false;
|
||||
@SuppressWarnings({"WeakerAccess"}) public boolean COMMENTS_ONLY = false;
|
||||
@SuppressWarnings({"WeakerAccess"}) public boolean STRING_LITERALS_ONLY = false;
|
||||
@SuppressWarnings({"WeakerAccess"}) public boolean EXCEPT_COMMENTS = false;
|
||||
@SuppressWarnings({"WeakerAccess"}) public boolean EXCEPT_COMMENTS_AND_LITERALS = false;
|
||||
@SuppressWarnings({"WeakerAccess"}) public boolean EXCEPT_LITERALS = false;
|
||||
@SuppressWarnings({"WeakerAccess"}) public boolean LOCAL_WHOLE_WORDS_ONLY = false;
|
||||
@SuppressWarnings({"WeakerAccess"}) public boolean REGULAR_EXPRESSIONS = false;
|
||||
@SuppressWarnings({"WeakerAccess"}) public boolean LOCAL_REGULAR_EXPRESSIONS = false;
|
||||
@@ -276,8 +279,18 @@ public class FindSettingsImpl extends FindSettings implements PersistentStateCom
|
||||
model.setGlobal(isGlobal());
|
||||
model.setRegularExpressions(isRegularExpressions());
|
||||
model.setWholeWordsOnly(isWholeWordsOnly());
|
||||
model.setInCommentsOnly(isInCommentsOnly());
|
||||
model.setInStringLiteralsOnly(isInStringLiteralsOnly());
|
||||
FindModel.SearchContext searchContext = isInCommentsOnly() ?
|
||||
FindModel.SearchContext.IN_COMMENTS :
|
||||
isInStringLiteralsOnly() ?
|
||||
FindModel.SearchContext.IN_STRINGS :
|
||||
isExceptComments() ?
|
||||
FindModel.SearchContext.EXCEPT_COMMENTS :
|
||||
isExceptStringLiterals() ?
|
||||
FindModel.SearchContext.EXCEPT_STRINGS :
|
||||
isExceptCommentsAndLiterals() ?
|
||||
FindModel.SearchContext.EXCEPT_STRINGS_AND_COMMENTS :
|
||||
FindModel.SearchContext.ANY;
|
||||
model.setSearchContext(searchContext);
|
||||
model.setWithSubdirectories(isWithSubdirectories());
|
||||
model.setFileFilter(FILE_MASK);
|
||||
|
||||
@@ -384,4 +397,34 @@ public class FindSettingsImpl extends FindSettings implements PersistentStateCom
|
||||
public void setCustomScope(final String SEARCH_SCOPE) {
|
||||
this.SEARCH_SCOPE = SEARCH_SCOPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isExceptComments() {
|
||||
return EXCEPT_COMMENTS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExceptCommentsAndLiterals(boolean selected) {
|
||||
EXCEPT_COMMENTS_AND_LITERALS = selected;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isExceptCommentsAndLiterals() {
|
||||
return EXCEPT_COMMENTS_AND_LITERALS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExceptComments(boolean selected) {
|
||||
EXCEPT_COMMENTS = selected;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isExceptStringLiterals() {
|
||||
return EXCEPT_LITERALS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExceptStringLiterals(boolean selected) {
|
||||
EXCEPT_LITERALS = selected;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,6 +69,14 @@ find.text.to.find.label=Text to &find:
|
||||
find.replace.with.label=Replace &with:
|
||||
find.filter.file.name.group=File name filter
|
||||
find.filter.file.mask.checkbox=File m&ask(s)
|
||||
find.context.combo.label=Conte&xt:
|
||||
find.context.anywhere.scope.label=anywhere
|
||||
find.context.in.comments.scope.label=in comments
|
||||
find.context.in.literals.scope.label=in string literals
|
||||
find.context.except.literals.scope.label=except string literals
|
||||
find.context.except.comments.scope.label=except comments
|
||||
find.context.except.comments.and.literals.scope.label=except comments and string literals
|
||||
|
||||
find.directory.not.found.error=Directory {0} is not found
|
||||
find.invalid.regular.expression.error=Bad pattern \"{0}\": {1}
|
||||
find.empty.match.regular.expression.error=Regular expression matches empty string
|
||||
|
||||
Reference in New Issue
Block a user