mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
getText is expensive
This commit is contained in:
+3
-4
@@ -93,10 +93,6 @@ public class InvertIfIntention extends Intention {
|
||||
return new PsiElementPredicate() {
|
||||
@Override
|
||||
public boolean satisfiedBy(PsiElement element) {
|
||||
|
||||
if (!"if".equals(element.getText())) {
|
||||
return false;
|
||||
}
|
||||
PsiElement parent = element.getParent();
|
||||
if (!(parent instanceof GrIfStatement)) {
|
||||
return false;
|
||||
@@ -105,6 +101,9 @@ public class InvertIfIntention extends Intention {
|
||||
if (((GrIfStatement)parent).getCondition() == null) {
|
||||
return false;
|
||||
}
|
||||
if (!"if".equals(element.getText())) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
+5
-11
@@ -64,17 +64,11 @@ public class SplitIfIntention extends Intention {
|
||||
return new PsiElementPredicate() {
|
||||
@Override
|
||||
public boolean satisfiedBy(PsiElement element) {
|
||||
if ("&&".equals(element.getText()) &&
|
||||
element.getParent() instanceof GrBinaryExpression &&
|
||||
((GrBinaryExpression)element.getParent()).getRightOperand() != null &&
|
||||
element.getParent().getParent() instanceof GrIfStatement &&
|
||||
((GrIfStatement) element.getParent().getParent()).getElseBranch() == null
|
||||
) {
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
return element.getParent() instanceof GrBinaryExpression &&
|
||||
((GrBinaryExpression)element.getParent()).getRightOperand() != null &&
|
||||
element.getParent().getParent() instanceof GrIfStatement &&
|
||||
((GrIfStatement)element.getParent().getParent()).getElseBranch() == null
|
||||
&& "&&".equals(element.getText());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user