Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Intellij Community
Commits
afb30f3e
Commit
afb30f3e
authored
7 years ago
by
Kirill Smelov
Browse files
Options
Download
Email Patches
Plain Diff
SSR: Allow Profile extensions to enable type related fields in EditVarConstraintsDialog
parent
559f4ec7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
java/structuralsearch-java/src/com/intellij/structuralsearch/JavaStructuralSearchProfile.java
+5
-0
...ntellij/structuralsearch/JavaStructuralSearchProfile.java
platform/structuralsearch/source/com/intellij/structuralsearch/StructuralSearchProfile.java
+7
-0
...om/intellij/structuralsearch/StructuralSearchProfile.java
platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/EditVarConstraintsDialog.java
+11
-21
.../structuralsearch/plugin/ui/EditVarConstraintsDialog.java
with
23 additions
and
21 deletions
+23
-21
java/structuralsearch-java/src/com/intellij/structuralsearch/JavaStructuralSearchProfile.java
+
5
-
0
View file @
afb30f3e
...
@@ -802,4 +802,9 @@ public class JavaStructuralSearchProfile extends StructuralSearchProfile {
...
@@ -802,4 +802,9 @@ public class JavaStructuralSearchProfile extends StructuralSearchProfile {
return
offset
;
return
offset
;
}
}
@Override
public
boolean
typeRelatedVarConstraintsSupported
()
{
return
true
;
}
}
}
This diff is collapsed.
Click to expand it.
platform/structuralsearch/source/com/intellij/structuralsearch/StructuralSearchProfile.java
+
7
-
0
View file @
afb30f3e
...
@@ -278,4 +278,11 @@ public abstract class StructuralSearchProfile {
...
@@ -278,4 +278,11 @@ public abstract class StructuralSearchProfile {
public
PsiElement
getPresentableElement
(
PsiElement
element
)
{
public
PsiElement
getPresentableElement
(
PsiElement
element
)
{
return
isIdentifier
(
element
)
?
element
.
getParent
()
:
element
;
return
isIdentifier
(
element
)
?
element
.
getParent
()
:
element
;
}
}
/**
* @see com.intellij.structuralsearch.plugin.ui.EditVarConstraintsDialog
*/
public
boolean
typeRelatedVarConstraintsSupported
()
{
return
false
;
}
}
}
This diff is collapsed.
Click to expand it.
platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/EditVarConstraintsDialog.java
+
11
-
21
View file @
afb30f3e
...
@@ -19,7 +19,6 @@ import com.intellij.openapi.editor.ex.EditorEx;
...
@@ -19,7 +19,6 @@ import com.intellij.openapi.editor.ex.EditorEx;
import
com.intellij.openapi.fileTypes.FileType
;
import
com.intellij.openapi.fileTypes.FileType
;
import
com.intellij.openapi.fileTypes.FileTypeManager
;
import
com.intellij.openapi.fileTypes.FileTypeManager
;
import
com.intellij.openapi.fileTypes.FileTypes
;
import
com.intellij.openapi.fileTypes.FileTypes
;
import
com.intellij.openapi.fileTypes.StdFileTypes
;
import
com.intellij.openapi.help.HelpManager
;
import
com.intellij.openapi.help.HelpManager
;
import
com.intellij.openapi.project.Project
;
import
com.intellij.openapi.project.Project
;
import
com.intellij.openapi.ui.ComponentWithBrowseButton
;
import
com.intellij.openapi.ui.ComponentWithBrowseButton
;
...
@@ -115,11 +114,14 @@ class EditVarConstraintsDialog extends DialogWrapper {
...
@@ -115,11 +114,14 @@ class EditVarConstraintsDialog extends DialogWrapper {
setTitle
(
SSRBundle
.
message
(
"editvarcontraints.edit.variables"
));
setTitle
(
SSRBundle
.
message
(
"editvarcontraints.edit.variables"
));
final
StructuralSearchProfile
profile
=
StructuralSearchUtil
.
getProfileByFileType
(
fileType
);
final
boolean
typesSupported
=
profile
!=
null
&&
profile
.
typeRelatedVarConstraintsSupported
();
regexp
.
getDocument
().
addDocumentListener
(
new
MyDocumentListener
(
notRegexp
,
wholeWordsOnly
));
regexp
.
getDocument
().
addDocumentListener
(
new
MyDocumentListener
(
notRegexp
,
wholeWordsOnly
));
regexp
.
getDocument
().
addDocumentListener
(
new
DocumentListener
()
{
regexp
.
getDocument
().
addDocumentListener
(
new
DocumentListener
()
{
@Override
@Override
public
void
documentChanged
(
DocumentEvent
e
)
{
public
void
documentChanged
(
DocumentEvent
e
)
{
applyWithinTypeHierarchy
.
setEnabled
(
e
.
getDocument
().
getTextLength
()
>
0
&&
fileType
==
StdFileTypes
.
JAVA
);
applyWithinTypeHierarchy
.
setEnabled
(
e
.
getDocument
().
getTextLength
()
>
0
&&
typesSupported
);
}
}
});
});
myZeroZeroButton
.
addActionListener
(
new
ActionListener
()
{
myZeroZeroButton
.
addActionListener
(
new
ActionListener
()
{
...
@@ -180,27 +182,15 @@ class EditVarConstraintsDialog extends DialogWrapper {
...
@@ -180,27 +182,15 @@ class EditVarConstraintsDialog extends DialogWrapper {
variables
.
add
(
new
Variable
(
Configuration
.
CONTEXT_VAR_NAME
,
""
,
""
,
true
));
variables
.
add
(
new
Variable
(
Configuration
.
CONTEXT_VAR_NAME
,
""
,
""
,
true
));
}
}
if
(
fileType
==
StdFileTypes
.
JAVA
)
{
formalArgTypeWithinHierarchy
.
setEnabled
(
typesSupported
);
formalArgTypeWithinHierarchy
.
setEnabled
(
true
);
invertFormalArgType
.
setEnabled
(
typesSupported
);
invertFormalArgType
.
setEnabled
(
true
);
formalArgType
.
setEnabled
(
typesSupported
);
formalArgType
.
setEnabled
(
true
);
exprTypeWithinHierarchy
.
setEnabled
(
true
);
notExprType
.
setEnabled
(
true
);
regexprForExprType
.
setEnabled
(
true
);
applyWithinTypeHierarchy
.
setEnabled
(
true
);
exprTypeWithinHierarchy
.
setEnabled
(
typesSupported
);
}
else
{
notExprType
.
setEnabled
(
typesSupported
);
formalArgTypeWithinHierarchy
.
setEnabled
(
false
);
regexprForExprType
.
setEnabled
(
typesSupported
);
invertFormalArgType
.
setEnabled
(
false
);
formalArgType
.
setEnabled
(
false
);
exprTypeWithinHierarchy
.
setEnabled
(
false
);
applyWithinTypeHierarchy
.
setEnabled
(
typesSupported
);
notExprType
.
setEnabled
(
false
);
regexprForExprType
.
setEnabled
(
false
);
applyWithinTypeHierarchy
.
setEnabled
(
false
);
}
parameterList
.
setModel
(
parameterList
.
setModel
(
new
AbstractListModel
<
Variable
>()
{
new
AbstractListModel
<
Variable
>()
{
...
...
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
Menu
Projects
Groups
Snippets
Help