Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Intellij Community
Commits
b80a1dc8
Commit
b80a1dc8
authored
10 years ago
by
Maxim.Mossienko
Browse files
Options
Download
Email Patches
Plain Diff
ui for context of searching
parent
1d0664ab
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
platform/core-api/src/com/intellij/ide/caches/FileContent.java
+1
-1
...orm/core-api/src/com/intellij/ide/caches/FileContent.java
platform/lang-api/src/com/intellij/find/FindModel.java
+33
-21
platform/lang-api/src/com/intellij/find/FindModel.java
platform/lang-impl/src/com/intellij/find/EditorSearchComponent.java
+4
-2
...ang-impl/src/com/intellij/find/EditorSearchComponent.java
platform/lang-impl/src/com/intellij/find/FindSettings.java
+9
-0
platform/lang-impl/src/com/intellij/find/FindSettings.java
platform/lang-impl/src/com/intellij/find/editorHeaderActions/ToggleExceptCommentsAction.java
+38
-0
.../find/editorHeaderActions/ToggleExceptCommentsAction.java
platform/lang-impl/src/com/intellij/find/editorHeaderActions/ToggleExceptCommentsAndLiteralsAction.java
+38
-0
...rHeaderActions/ToggleExceptCommentsAndLiteralsAction.java
platform/lang-impl/src/com/intellij/find/editorHeaderActions/ToggleExceptLiteralsAction.java
+38
-0
.../find/editorHeaderActions/ToggleExceptLiteralsAction.java
platform/lang-impl/src/com/intellij/find/editorHeaderActions/ToggleInCommentsAction.java
+1
-3
...llij/find/editorHeaderActions/ToggleInCommentsAction.java
platform/lang-impl/src/com/intellij/find/editorHeaderActions/ToggleInLiteralsOnlyAction.java
+1
-3
.../find/editorHeaderActions/ToggleInLiteralsOnlyAction.java
platform/lang-impl/src/com/intellij/find/impl/FindDialog.java
+55
-22
...form/lang-impl/src/com/intellij/find/impl/FindDialog.java
platform/lang-impl/src/com/intellij/find/impl/FindResultUsageInfo.java
+7
-1
...-impl/src/com/intellij/find/impl/FindResultUsageInfo.java
platform/lang-impl/src/com/intellij/find/impl/FindSettingsImpl.java
+45
-2
...ang-impl/src/com/intellij/find/impl/FindSettingsImpl.java
platform/platform-resources-en/src/messages/FindBundle.properties
+8
-0
.../platform-resources-en/src/messages/FindBundle.properties
with
278 additions
and
55 deletions
+278
-55
platform/core-api/src/com/intellij/ide/caches/FileContent.java
+
1
-
1
View file @
b80a1dc8
...
@@ -47,7 +47,7 @@ public class FileContent extends UserDataHolderBase {
...
@@ -47,7 +47,7 @@ public class FileContent extends UserDataHolderBase {
@NotNull
@NotNull
public
byte
[]
getBytes
()
throws
IOException
{
public
byte
[]
getBytes
()
throws
IOException
{
if
(
myCachedBytes
==
null
)
{
if
(
myCachedBytes
==
null
)
{
myCachedBytes
=
myVirtualFile
.
contentsToByteArray
(
false
)
;
myCachedBytes
=
myVirtualFile
.
isValid
()
?
myVirtualFile
.
contentsToByteArray
(
false
)
:
ArrayUtil
.
EMPTY_BYTE_ARRAY
;
}
}
return
myCachedBytes
;
return
myCachedBytes
;
...
...
This diff is collapsed.
Click to expand it.
platform/lang-api/src/com/intellij/find/FindModel.java
+
33
-
21
View file @
b80a1dc8
...
@@ -72,8 +72,7 @@ public class FindModel extends UserDataHolderBase implements Cloneable {
...
@@ -72,8 +72,7 @@ public class FindModel extends UserDataHolderBase implements Cloneable {
private
boolean
isSearchHighlighters
=
false
;
private
boolean
isSearchHighlighters
=
false
;
private
boolean
isReplaceState
=
false
;
private
boolean
isReplaceState
=
false
;
private
boolean
isWholeWordsOnly
=
false
;
private
boolean
isWholeWordsOnly
=
false
;
private
boolean
isInCommentsOnly
;
private
SearchContext
searchContext
=
SearchContext
.
ANY
;
private
boolean
isInStringLiteralsOnly
;
private
boolean
isFromCursor
=
true
;
private
boolean
isFromCursor
=
true
;
private
boolean
isForward
=
true
;
private
boolean
isForward
=
true
;
private
boolean
isGlobal
=
true
;
private
boolean
isGlobal
=
true
;
...
@@ -171,8 +170,7 @@ public class FindModel extends UserDataHolderBase implements Cloneable {
...
@@ -171,8 +170,7 @@ public class FindModel extends UserDataHolderBase implements Cloneable {
isCustomScope
=
model
.
isCustomScope
;
isCustomScope
=
model
.
isCustomScope
;
isFindAll
=
model
.
isFindAll
;
isFindAll
=
model
.
isFindAll
;
isInCommentsOnly
=
model
.
isInCommentsOnly
;
searchContext
=
model
.
searchContext
;
isInStringLiteralsOnly
=
model
.
isInStringLiteralsOnly
;
isMultiline
=
model
.
isMultiline
;
isMultiline
=
model
.
isMultiline
;
}
}
...
@@ -191,8 +189,8 @@ public class FindModel extends UserDataHolderBase implements Cloneable {
...
@@ -191,8 +189,8 @@ public class FindModel extends UserDataHolderBase implements Cloneable {
if
(
isForward
!=
findModel
.
isForward
)
return
false
;
if
(
isForward
!=
findModel
.
isForward
)
return
false
;
if
(
isFromCursor
!=
findModel
.
isFromCursor
)
return
false
;
if
(
isFromCursor
!=
findModel
.
isFromCursor
)
return
false
;
if
(
isGlobal
!=
findModel
.
isGlobal
)
return
false
;
if
(
isGlobal
!=
findModel
.
isGlobal
)
return
false
;
if
(
isInCommentsOnly
!=
findModel
.
isInCommentsOnly
)
return
false
;
if
(
searchContext
!=
findModel
.
searchContext
)
return
false
;
if
(
isInStringLiteralsOnly
!=
findModel
.
isInStringLiteralsOnly
)
return
false
;
if
(
isMultiline
!=
findModel
.
isMultiline
)
return
false
;
if
(
isMultiline
!=
findModel
.
isMultiline
)
return
false
;
if
(
isMultipleFiles
!=
findModel
.
isMultipleFiles
)
return
false
;
if
(
isMultipleFiles
!=
findModel
.
isMultipleFiles
)
return
false
;
if
(
isOpenInNewTabEnabled
!=
findModel
.
isOpenInNewTabEnabled
)
return
false
;
if
(
isOpenInNewTabEnabled
!=
findModel
.
isOpenInNewTabEnabled
)
return
false
;
...
@@ -229,8 +227,7 @@ public class FindModel extends UserDataHolderBase implements Cloneable {
...
@@ -229,8 +227,7 @@ public class FindModel extends UserDataHolderBase implements Cloneable {
result
=
31
*
result
+
(
isSearchHighlighters
?
1
:
0
);
result
=
31
*
result
+
(
isSearchHighlighters
?
1
:
0
);
result
=
31
*
result
+
(
isReplaceState
?
1
:
0
);
result
=
31
*
result
+
(
isReplaceState
?
1
:
0
);
result
=
31
*
result
+
(
isWholeWordsOnly
?
1
:
0
);
result
=
31
*
result
+
(
isWholeWordsOnly
?
1
:
0
);
result
=
31
*
result
+
(
isInCommentsOnly
?
1
:
0
);
result
=
31
*
result
+
(
searchContext
.
ordinal
());
result
=
31
*
result
+
(
isInStringLiteralsOnly
?
1
:
0
);
result
=
31
*
result
+
(
isFromCursor
?
1
:
0
);
result
=
31
*
result
+
(
isFromCursor
?
1
:
0
);
result
=
31
*
result
+
(
isForward
?
1
:
0
);
result
=
31
*
result
+
(
isForward
?
1
:
0
);
result
=
31
*
result
+
(
isGlobal
?
1
:
0
);
result
=
31
*
result
+
(
isGlobal
?
1
:
0
);
...
@@ -673,8 +670,7 @@ public class FindModel extends UserDataHolderBase implements Cloneable {
...
@@ -673,8 +670,7 @@ public class FindModel extends UserDataHolderBase implements Cloneable {
buffer
.
append
(
"myStringToReplace ="
).
append
(
myStringToReplace
).
append
(
"\n"
);
buffer
.
append
(
"myStringToReplace ="
).
append
(
myStringToReplace
).
append
(
"\n"
);
buffer
.
append
(
"isReplaceState ="
).
append
(
isReplaceState
).
append
(
"\n"
);
buffer
.
append
(
"isReplaceState ="
).
append
(
isReplaceState
).
append
(
"\n"
);
buffer
.
append
(
"isWholeWordsOnly ="
).
append
(
isWholeWordsOnly
).
append
(
"\n"
);
buffer
.
append
(
"isWholeWordsOnly ="
).
append
(
isWholeWordsOnly
).
append
(
"\n"
);
buffer
.
append
(
"isInStringLiterals ="
).
append
(
isInStringLiteralsOnly
).
append
(
"\n"
);
buffer
.
append
(
"searchContext ="
).
append
(
searchContext
).
append
(
"\n"
);
buffer
.
append
(
"isInComments ="
).
append
(
isInCommentsOnly
).
append
(
"\n"
);
buffer
.
append
(
"isFromCursor ="
).
append
(
isFromCursor
).
append
(
"\n"
);
buffer
.
append
(
"isFromCursor ="
).
append
(
isFromCursor
).
append
(
"\n"
);
buffer
.
append
(
"isForward ="
).
append
(
isForward
).
append
(
"\n"
);
buffer
.
append
(
"isForward ="
).
append
(
isForward
).
append
(
"\n"
);
buffer
.
append
(
"isGlobal ="
).
append
(
isGlobal
).
append
(
"\n"
);
buffer
.
append
(
"isGlobal ="
).
append
(
isGlobal
).
append
(
"\n"
);
...
@@ -853,25 +849,41 @@ public class FindModel extends UserDataHolderBase implements Cloneable {
...
@@ -853,25 +849,41 @@ public class FindModel extends UserDataHolderBase implements Cloneable {
}
}
}
}
public
enum
SearchContext
{
ANY
,
IN_STRINGS
,
IN_COMMENTS
,
EXCEPT_STRINGS
,
EXCEPT_COMMENTS
,
EXCEPT_STRINGS_AND_COMMENTS
}
public
boolean
isInStringLiteralsOnly
()
{
public
boolean
isInStringLiteralsOnly
()
{
return
isInStringLiteralsOnly
;
return
searchContext
==
SearchContext
.
IN_STRINGS
;
}
}
public
void
setInStringLiteralsOnly
(
boolean
inStringLiteralsOnly
)
{
public
boolean
isExceptComments
(
)
{
boolean
changed
=
isInStringLiteralsOnly
!=
inStringLiteralsOnly
;
return
searchContext
==
SearchContext
.
EXCEPT_COMMENTS
;
isInStringLiteralsOnly
=
inStringLiteralsOnly
;
}
if
(
changed
)
{
notifyObserver
s
()
;
public
boolean
isExceptStringLiteral
s
()
{
}
return
searchContext
==
SearchContext
.
EXCEPT_STRINGS
;
}
}
public
boolean
isInCommentsOnly
()
{
public
boolean
isInCommentsOnly
()
{
return
isInCommentsOnly
;
return
searchContext
==
SearchContext
.
IN_COMMENTS
;
}
public
boolean
isExceptCommentsAndStringLiterals
()
{
return
searchContext
==
SearchContext
.
EXCEPT_STRINGS_AND_COMMENTS
;
}
public
@NotNull
SearchContext
getSearchContext
()
{
return
searchContext
;
}
public
void
setSearchContext
(
@NotNull
SearchContext
_searchContext
)
{
doSetContext
(
_searchContext
);
}
}
p
ublic
void
setInCommentsOnly
(
boolean
inCommentsOnly
)
{
p
rivate
void
doSetContext
(
SearchContext
newSearchContext
)
{
boolean
changed
=
isInCommentsOnly
!=
inCommentsOnly
;
boolean
changed
=
newSearchContext
!=
searchContext
;
isInCommentsOnly
=
inCommentsOnly
;
searchContext
=
newSearchContext
;
if
(
changed
)
{
if
(
changed
)
{
notifyObservers
();
notifyObservers
();
}
}
...
...
This diff is collapsed.
Click to expand it.
platform/lang-impl/src/com/intellij/find/EditorSearchComponent.java
+
4
-
2
View file @
b80a1dc8
...
@@ -392,6 +392,9 @@ public class EditorSearchComponent extends EditorHeaderComponent implements Data
...
@@ -392,6 +392,9 @@ public class EditorSearchComponent extends EditorHeaderComponent implements Data
if
(
secondaryActionsAvailable
())
{
if
(
secondaryActionsAvailable
())
{
actionGroup
.
addAction
(
new
ToggleInCommentsAction
(
this
)).
setAsSecondary
(
true
);
actionGroup
.
addAction
(
new
ToggleInCommentsAction
(
this
)).
setAsSecondary
(
true
);
actionGroup
.
addAction
(
new
ToggleInLiteralsOnlyAction
(
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
TogglePreserveCaseAction
(
this
));
actionGroup
.
addAction
(
new
ToggleSelectionOnlyAction
(
this
));
actionGroup
.
addAction
(
new
ToggleSelectionOnlyAction
(
this
));
...
@@ -473,8 +476,7 @@ public class EditorSearchComponent extends EditorHeaderComponent implements Data
...
@@ -473,8 +476,7 @@ public class EditorSearchComponent extends EditorHeaderComponent implements Data
to
.
setCaseSensitive
(
from
.
isCaseSensitive
());
to
.
setCaseSensitive
(
from
.
isCaseSensitive
());
to
.
setWholeWordsOnly
(
from
.
isWholeWordsOnly
());
to
.
setWholeWordsOnly
(
from
.
isWholeWordsOnly
());
to
.
setRegularExpressions
(
from
.
isRegularExpressions
());
to
.
setRegularExpressions
(
from
.
isRegularExpressions
());
to
.
setInCommentsOnly
(
from
.
isInCommentsOnly
());
to
.
setSearchContext
(
from
.
getSearchContext
());
to
.
setInStringLiteralsOnly
(
from
.
isInStringLiteralsOnly
());
if
(
from
.
isReplaceState
())
{
if
(
from
.
isReplaceState
())
{
to
.
setPreserveCase
(
from
.
isPreserveCase
());
to
.
setPreserveCase
(
from
.
isPreserveCase
());
}
}
...
...
This diff is collapsed.
Click to expand it.
platform/lang-impl/src/com/intellij/find/FindSettings.java
+
9
-
0
View file @
b80a1dc8
...
@@ -119,4 +119,13 @@ public abstract class FindSettings{
...
@@ -119,4 +119,13 @@ public abstract class FindSettings{
public
abstract
boolean
isInCommentsOnly
();
public
abstract
boolean
isInCommentsOnly
();
public
abstract
void
setInCommentsOnly
(
boolean
selected
);
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
);
}
}
This diff is collapsed.
Click to expand it.
platform/lang-impl/src/com/intellij/find/editorHeaderActions/ToggleExceptCommentsAction.java
0 → 100644
+
38
-
0
View file @
b80a1dc8
/*
* 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
);
}
}
This diff is collapsed.
Click to expand it.
platform/lang-impl/src/com/intellij/find/editorHeaderActions/ToggleExceptCommentsAndLiteralsAction.java
0 → 100644
+
38
-
0
View file @
b80a1dc8
/*
* 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
);
}
}
This diff is collapsed.
Click to expand it.
platform/lang-impl/src/com/intellij/find/editorHeaderActions/ToggleExceptLiteralsAction.java
0 → 100644
+
38
-
0
View file @
b80a1dc8
/*
* 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
);
}
}
This diff is collapsed.
Click to expand it.
platform/lang-impl/src/com/intellij/find/editorHeaderActions/ToggleInCommentsAction.java
+
1
-
3
View file @
b80a1dc8
...
@@ -18,8 +18,6 @@ public class ToggleInCommentsAction extends EditorHeaderToggleAction implements
...
@@ -18,8 +18,6 @@ public class ToggleInCommentsAction extends EditorHeaderToggleAction implements
@Override
@Override
public
void
setSelected
(
AnActionEvent
e
,
boolean
state
)
{
public
void
setSelected
(
AnActionEvent
e
,
boolean
state
)
{
FindModel
findModel
=
getEditorSearchComponent
().
getFindModel
();
getEditorSearchComponent
().
getFindModel
().
setSearchContext
(
state
?
FindModel
.
SearchContext
.
IN_COMMENTS
:
FindModel
.
SearchContext
.
ANY
);
findModel
.
setInCommentsOnly
(
state
);
if
(
state
)
findModel
.
setInStringLiteralsOnly
(
false
);
}
}
}
}
This diff is collapsed.
Click to expand it.
platform/lang-impl/src/com/intellij/find/editorHeaderActions/ToggleInLiteralsOnlyAction.java
+
1
-
3
View file @
b80a1dc8
...
@@ -18,8 +18,6 @@ public class ToggleInLiteralsOnlyAction extends EditorHeaderToggleAction implem
...
@@ -18,8 +18,6 @@ public class ToggleInLiteralsOnlyAction extends EditorHeaderToggleAction implem
@Override
@Override
public
void
setSelected
(
AnActionEvent
e
,
boolean
state
)
{
public
void
setSelected
(
AnActionEvent
e
,
boolean
state
)
{
FindModel
findModel
=
getEditorSearchComponent
().
getFindModel
();
getEditorSearchComponent
().
getFindModel
().
setSearchContext
(
state
?
FindModel
.
SearchContext
.
IN_STRINGS
:
FindModel
.
SearchContext
.
ANY
);
findModel
.
setInStringLiteralsOnly
(
state
);
if
(
state
)
findModel
.
setInCommentsOnly
(
false
);
}
}
}
}
This diff is collapsed.
Click to expand it.
platform/lang-impl/src/com/intellij/find/impl/FindDialog.java
+
55
-
22
View file @
b80a1dc8
...
@@ -74,8 +74,7 @@ public class FindDialog extends DialogWrapper {
...
@@ -74,8 +74,7 @@ public class FindDialog extends DialogWrapper {
private
StateRestoringCheckBox
myCbCaseSensitive
;
private
StateRestoringCheckBox
myCbCaseSensitive
;
private
StateRestoringCheckBox
myCbPreserveCase
;
private
StateRestoringCheckBox
myCbPreserveCase
;
private
StateRestoringCheckBox
myCbWholeWordsOnly
;
private
StateRestoringCheckBox
myCbWholeWordsOnly
;
private
StateRestoringCheckBox
myCbInCommentsOnly
;
private
ComboBox
mySearchContext
;
private
StateRestoringCheckBox
myCbInStringLiteralsOnly
;
private
StateRestoringCheckBox
myCbRegularExpressions
;
private
StateRestoringCheckBox
myCbRegularExpressions
;
private
JRadioButton
myRbGlobal
;
private
JRadioButton
myRbGlobal
;
private
JRadioButton
myRbSelectedText
;
private
JRadioButton
myRbSelectedText
;
...
@@ -472,6 +471,9 @@ public class FindDialog extends DialogWrapper {
...
@@ -472,6 +471,9 @@ public class FindDialog extends DialogWrapper {
findSettings
.
setWholeWordsOnly
(
myModel
.
isWholeWordsOnly
());
findSettings
.
setWholeWordsOnly
(
myModel
.
isWholeWordsOnly
());
findSettings
.
setInStringLiteralsOnly
(
myModel
.
isInStringLiteralsOnly
());
findSettings
.
setInStringLiteralsOnly
(
myModel
.
isInStringLiteralsOnly
());
findSettings
.
setInCommentsOnly
(
myModel
.
isInCommentsOnly
());
findSettings
.
setInCommentsOnly
(
myModel
.
isInCommentsOnly
());
findSettings
.
setExceptComments
(
myModel
.
isExceptComments
());
findSettings
.
setExceptStringLiterals
(
myModel
.
isExceptStringLiterals
());
findSettings
.
setExceptCommentsAndLiterals
(
myModel
.
isExceptCommentsAndStringLiterals
());
findSettings
.
setRegularExpressions
(
myModel
.
isRegularExpressions
());
findSettings
.
setRegularExpressions
(
myModel
.
isRegularExpressions
());
if
(!
myModel
.
isMultipleFiles
()){
if
(!
myModel
.
isMultipleFiles
()){
...
@@ -603,24 +605,33 @@ public class FindDialog extends DialogWrapper {
...
@@ -603,24 +605,33 @@ public class FindDialog extends DialogWrapper {
findOptionsPanel
.
add
(
regExPanel
);
findOptionsPanel
.
add
(
regExPanel
);
myCbInCommentsOnly
=
createCheckbox
(
FindBundle
.
message
(
"find.options.comments.only"
));
mySearchContext
=
new
ComboBox
(
new
Object
[]
{
FindBundle
.
message
(
"find.context.anywhere.scope.label"
,
200
),
myCbInStringLiteralsOnly
=
createCheckbox
(
FindBundle
.
message
(
"find.options.string.literals.only"
));
FindBundle
.
message
(
"find.context.in.comments.scope.label"
),
FindBundle
.
message
(
"find.context.in.literals.scope.label"
),
ItemListener
itemListener
=
new
ItemListener
()
{
FindBundle
.
message
(
"find.context.except.comments.scope.label"
),
@Override
FindBundle
.
message
(
"find.context.except.literals.scope.label"
),
public
void
itemStateChanged
(
ItemEvent
e
)
{
FindBundle
.
message
(
"find.context.except.comments.and.literals.scope.label"
)});
if
(
e
.
getSource
()
==
myCbInCommentsOnly
)
{
final
JPanel
searchContextPanel
=
new
JPanel
(
new
GridBagLayout
());
if
(
myCbInCommentsOnly
.
isSelected
())
myCbInStringLiteralsOnly
.
setSelected
(
false
);
searchContextPanel
.
setAlignmentX
(
Component
.
LEFT_ALIGNMENT
);
}
else
if
(
e
.
getSource
()
==
myCbInStringLiteralsOnly
)
{
if
(
myCbInStringLiteralsOnly
.
isSelected
())
myCbInCommentsOnly
.
setSelected
(
false
);
GridBagConstraints
gbConstraints
=
new
GridBagConstraints
();
}
gbConstraints
.
fill
=
GridBagConstraints
.
HORIZONTAL
;
}
gbConstraints
.
anchor
=
GridBagConstraints
.
WEST
;
};
myCbInCommentsOnly
.
addItemListener
(
itemListener
);
gbConstraints
.
gridx
=
0
;
myCbInStringLiteralsOnly
.
addItemListener
(
itemListener
);
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
)
{
if
(
FindManagerImpl
.
ourHasSearchInCommentsAndLiterals
)
{
findOptionsPanel
.
add
(
myCbInCommentsOnly
);
findOptionsPanel
.
add
(
searchContextPanel
);
findOptionsPanel
.
add
(
myCbInStringLiteralsOnly
);
}
}
ActionListener
actionListener
=
new
ActionListener
()
{
ActionListener
actionListener
=
new
ActionListener
()
{
...
@@ -985,9 +996,25 @@ public class FindDialog extends DialogWrapper {
...
@@ -985,9 +996,25 @@ public class FindDialog extends DialogWrapper {
}
}
model
.
setWholeWordsOnly
(
myCbWholeWordsOnly
.
isSelected
());
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
());
model
.
setRegularExpressions
(
myCbRegularExpressions
.
isSelected
());
String
stringToFind
=
getStringToFind
();
String
stringToFind
=
getStringToFind
();
...
@@ -1053,8 +1080,14 @@ public class FindDialog extends DialogWrapper {
...
@@ -1053,8 +1080,14 @@ public class FindDialog extends DialogWrapper {
private
void
initByModel
()
{
private
void
initByModel
()
{
myCbCaseSensitive
.
setSelected
(
myModel
.
isCaseSensitive
());
myCbCaseSensitive
.
setSelected
(
myModel
.
isCaseSensitive
());
myCbWholeWordsOnly
.
setSelected
(
myModel
.
isWholeWordsOnly
());
myCbWholeWordsOnly
.
setSelected
(
myModel
.
isWholeWordsOnly
());
myCbInStringLiteralsOnly
.
setSelected
(
myModel
.
isInStringLiteralsOnly
());
String
searchContext
=
FindBundle
.
message
(
"find.context.anywhere.scope.label"
);
myCbInCommentsOnly
.
setSelected
(
myModel
.
isInCommentsOnly
());
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
());
myCbRegularExpressions
.
setSelected
(
myModel
.
isRegularExpressions
());
if
(
myModel
.
isMultipleFiles
())
{
if
(
myModel
.
isMultipleFiles
())
{
...
...
This diff is collapsed.
Click to expand it.
platform/lang-impl/src/com/intellij/find/impl/FindResultUsageInfo.java
+
7
-
1
View file @
b80a1dc8
...
@@ -110,7 +110,13 @@ public class FindResultUsageInfo extends UsageInfo {
...
@@ -110,7 +110,13 @@ public class FindResultUsageInfo extends UsageInfo {
assert
result
.
isStringFound
();
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
));
myAnchor
=
SmartPointerManager
.
getInstance
(
getProject
()).
createSmartPsiFileRangePointer
(
file
,
TextRange
.
from
(
offset
,
0
));
}
}
...
...
This diff is collapsed.
Click to expand it.
platform/lang-impl/src/com/intellij/find/impl/FindSettingsImpl.java
+
45
-
2
View file @
b80a1dc8
...
@@ -103,6 +103,9 @@ public class FindSettingsImpl extends FindSettings implements PersistentStateCom
...
@@ -103,6 +103,9 @@ public class FindSettingsImpl extends FindSettings implements PersistentStateCom
@SuppressWarnings
({
"WeakerAccess"
})
public
boolean
WHOLE_WORDS_ONLY
=
false
;
@SuppressWarnings
({
"WeakerAccess"
})
public
boolean
WHOLE_WORDS_ONLY
=
false
;
@SuppressWarnings
({
"WeakerAccess"
})
public
boolean
COMMENTS_ONLY
=
false
;
@SuppressWarnings
({
"WeakerAccess"
})
public
boolean
COMMENTS_ONLY
=
false
;
@SuppressWarnings
({
"WeakerAccess"
})
public
boolean
STRING_LITERALS_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
LOCAL_WHOLE_WORDS_ONLY
=
false
;
@SuppressWarnings
({
"WeakerAccess"
})
public
boolean
REGULAR_EXPRESSIONS
=
false
;
@SuppressWarnings
({
"WeakerAccess"
})
public
boolean
REGULAR_EXPRESSIONS
=
false
;
@SuppressWarnings
({
"WeakerAccess"
})
public
boolean
LOCAL_REGULAR_EXPRESSIONS
=
false
;
@SuppressWarnings
({
"WeakerAccess"
})
public
boolean
LOCAL_REGULAR_EXPRESSIONS
=
false
;
...
@@ -276,8 +279,18 @@ public class FindSettingsImpl extends FindSettings implements PersistentStateCom
...
@@ -276,8 +279,18 @@ public class FindSettingsImpl extends FindSettings implements PersistentStateCom
model
.
setGlobal
(
isGlobal
());
model
.
setGlobal
(
isGlobal
());
model
.
setRegularExpressions
(
isRegularExpressions
());
model
.
setRegularExpressions
(
isRegularExpressions
());
model
.
setWholeWordsOnly
(
isWholeWordsOnly
());
model
.
setWholeWordsOnly
(
isWholeWordsOnly
());
model
.
setInCommentsOnly
(
isInCommentsOnly
());
FindModel
.
SearchContext
searchContext
=
isInCommentsOnly
()
?
model
.
setInStringLiteralsOnly
(
isInStringLiteralsOnly
());
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
.
setWithSubdirectories
(
isWithSubdirectories
());
model
.
setFileFilter
(
FILE_MASK
);
model
.
setFileFilter
(
FILE_MASK
);
...
@@ -384,4 +397,34 @@ public class FindSettingsImpl extends FindSettings implements PersistentStateCom
...
@@ -384,4 +397,34 @@ public class FindSettingsImpl extends FindSettings implements PersistentStateCom
public
void
setCustomScope
(
final
String
SEARCH_SCOPE
)
{
public
void
setCustomScope
(
final
String
SEARCH_SCOPE
)
{
this
.
SEARCH_SCOPE
=
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
;
}
}
}
This diff is collapsed.
Click to expand it.
platform/platform-resources-en/src/messages/FindBundle.properties
+
8
-
0
View file @
b80a1dc8
...
@@ -69,6 +69,14 @@ find.text.to.find.label=Text to &find:
...
@@ -69,6 +69,14 @@ find.text.to.find.label=Text to &find:
find.replace.with.label
=
Replace &with:
find.replace.with.label
=
Replace &with:
find.filter.file.name.group
=
File name filter
find.filter.file.name.group
=
File name filter
find.filter.file.mask.checkbox
=
File m&ask(s)
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.directory.not.found.error
=
Directory {0} is not found
find.invalid.regular.expression.error
=
Bad pattern
\"
{0}
\"
: {1}
find.invalid.regular.expression.error
=
Bad pattern
\"
{0}
\"
: {1}
find.empty.match.regular.expression.error
=
Regular expression matches empty string
find.empty.match.regular.expression.error
=
Regular expression matches empty string
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment