Search in sources :

Example 1 with PsiExpressionList

use of com.intellij.psi.PsiExpressionList in project intellij-community by JetBrains.

the class NotInSuperOrThisCallFilterBase method isOK.

public boolean isOK(PsiExpression occurrence) {
    PsiElement parent = occurrence.getParent();
    while (parent instanceof PsiExpression) {
        parent = parent.getParent();
    }
    if (!(parent instanceof PsiExpressionList))
        return true;
    parent = parent.getParent();
    if (!(parent instanceof PsiMethodCallExpression))
        return true;
    final String text = ((PsiMethodCallExpression) parent).getMethodExpression().getText();
    return !getKeywordText().equals(text);
}
Also used : PsiExpression(com.intellij.psi.PsiExpression) PsiExpressionList(com.intellij.psi.PsiExpressionList) PsiElement(com.intellij.psi.PsiElement) PsiMethodCallExpression(com.intellij.psi.PsiMethodCallExpression)

Example 2 with PsiExpressionList

use of com.intellij.psi.PsiExpressionList in project intellij-community by JetBrains.

the class JavaConditionalUnwrapper method doUnwrap.

@Override
protected void doUnwrap(PsiElement element, Context context) throws IncorrectOperationException {
    PsiConditionalExpression cond = (PsiConditionalExpression) element.getParent();
    PsiElement savedBlock;
    if (cond.getElseExpression() == element) {
        savedBlock = element;
    } else {
        savedBlock = cond.getThenExpression();
    }
    context.extractElement(savedBlock, cond);
    if (cond.getParent() instanceof PsiExpressionList) {
        context.delete(cond);
    } else {
        context.deleteExactly(cond);
    }
}
Also used : PsiExpressionList(com.intellij.psi.PsiExpressionList) PsiElement(com.intellij.psi.PsiElement) PsiConditionalExpression(com.intellij.psi.PsiConditionalExpression)

Aggregations

PsiElement (com.intellij.psi.PsiElement)2 PsiExpressionList (com.intellij.psi.PsiExpressionList)2 PsiConditionalExpression (com.intellij.psi.PsiConditionalExpression)1 PsiExpression (com.intellij.psi.PsiExpression)1 PsiMethodCallExpression (com.intellij.psi.PsiMethodCallExpression)1