mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-26 13:39:58 +07:00
IDEA-111523 (the intention is only supposed to work inside regular assignment)
This commit is contained in:
1 parent
d6c5bb898a
commit
b993b94f0e
2 files changed
+13
-1
No files matched your search
+3
-1
@@ -53,8 +53,10 @@ public class MoveFieldAssignmentToInitializerAction extends BaseIntentionAction
|
||||
|
||||
@Override
|
||||
public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) {
|
||||
final PsiAssignmentExpression assignment = getAssignmentUnderCaret(editor, file);
|
||||
PsiAssignmentExpression assignment = getAssignmentUnderCaret(editor, file);
|
||||
if (assignment == null) return false;
|
||||
PsiElement parent = assignment.getParent();
|
||||
if (!(parent instanceof PsiExpressionStatement)) return false;
|
||||
PsiField field = getAssignedField(assignment);
|
||||
if (field == null || field.hasInitializer()) return false;
|
||||
PsiClass psiClass = field.getContainingClass();
|
||||
|
||||
Reference in new issue
Block a user