use of com.intellij.psi.PsiPolyadicExpression in project intellij-community by JetBrains.
the class JavaPolyadicExpressionUnwrapper method doUnwrap.
@Override
protected void doUnwrap(PsiElement element, Context context) throws IncorrectOperationException {
final PsiPolyadicExpression parent = (PsiPolyadicExpression) element.getParent();
final PsiExpression operand = findOperand(element, parent);
if (operand == null) {
return;
}
context.extractElement(operand, parent);
context.delete(parent);
}
use of com.intellij.psi.PsiPolyadicExpression in project intellij-community by JetBrains.
the class JavaFormatterUtil method areSamePriorityBinaryExpressions.
/**
* Allows to check if given {@code AST} nodes refer to binary expressions which have the same priority.
*
* @param node1 node to check
* @param node2 node to check
* @return {@code true} if given nodes are binary expressions and have the same priority;
* {@code false} otherwise
*/
public static boolean areSamePriorityBinaryExpressions(ASTNode node1, ASTNode node2) {
if (node1 == null || node2 == null) {
return false;
}
if (!(node1 instanceof PsiPolyadicExpression) || !(node2 instanceof PsiPolyadicExpression)) {
return false;
}
PsiPolyadicExpression expression1 = (PsiPolyadicExpression) node1;
PsiPolyadicExpression expression2 = (PsiPolyadicExpression) node2;
return expression1.getOperationTokenType() == expression2.getOperationTokenType();
}
use of com.intellij.psi.PsiPolyadicExpression in project intellij-community by JetBrains.
the class StringConcatenationInspection method buildFixes.
@NotNull
@Override
protected InspectionGadgetsFix[] buildFixes(Object... infos) {
final InspectionGadgetsFix[] fixes = super.buildFixes(infos);
final PsiPolyadicExpression polyadicExpression = (PsiPolyadicExpression) infos[0];
final SuppressForTestsScopeFix suppressFix = SuppressForTestsScopeFix.build(this, polyadicExpression);
if (suppressFix == null) {
return fixes;
}
final InspectionGadgetsFix[] newFixes = Arrays.copyOf(fixes, fixes.length + 1);
newFixes[fixes.length] = suppressFix;
return newFixes;
}
Aggregations