use of com.intellij.psi.PsiIfStatement in project intellij-community by JetBrains.
the class SimplifyIfElseIntention method getElementPredicate.
@NotNull
public PsiElementPredicate getElementPredicate() {
return new PsiElementPredicate() {
public boolean satisfiedBy(PsiElement element) {
if (!(element instanceof PsiJavaToken)) {
return false;
}
final PsiJavaToken token = (PsiJavaToken) element;
final PsiElement parent = token.getParent();
if (!(parent instanceof PsiIfStatement)) {
return false;
}
return TrivialIfInspection.isTrivial((PsiIfStatement) parent);
}
};
}
use of com.intellij.psi.PsiIfStatement in project intellij-community by JetBrains.
the class IfToSwitchPredicate method satisfiedBy.
@Override
public boolean satisfiedBy(PsiElement element) {
if (!(element instanceof PsiJavaToken)) {
return false;
}
final PsiJavaToken token = (PsiJavaToken) element;
if (token.getTokenType() != JavaTokenType.IF_KEYWORD) {
return false;
}
final PsiElement parent = element.getParent();
if (!(parent instanceof PsiIfStatement)) {
return false;
}
final PsiIfStatement statement = (PsiIfStatement) parent;
if (ErrorUtil.containsError(statement)) {
return false;
}
return SwitchUtils.getSwitchExpression(statement, 0, false, true) != null;
}
use of com.intellij.psi.PsiIfStatement in project Main by SpartanRefactoring.
the class UtilsTest method testGetDocumentFromPsiElement.
public void testGetDocumentFromPsiElement() throws Exception {
PsiIfStatement i = createTestIfStatement("x > 2", "x++;");
assertNull(getDocumentFromPsiElement(i));
}
Aggregations