Search in sources :

Example 1 with PerlCastExpression

use of com.perl5.lang.perl.psi.PerlCastExpression in project Perl5-IDEA by Camelcade.

the class PerlFormattingSimpleDereferenceUnwrap method apply.

@Override
public int apply() {
    int delta = 0;
    if (myCastElement.isValid() && myVariableElement.isValid()) {
        String newCode = getCode();
        PerlFileImpl newFile = PerlElementFactory.createFile(myCastElement.getProject(), newCode);
        PerlCastExpression newCastExpression = PsiTreeUtil.findChildOfType(newFile, PerlCastExpression.class);
        if (newCastExpression != null) {
            delta = new PerlFormattingReplace(myCastElement, newCastExpression).apply();
        }
    }
    return delta;
}
Also used : PerlFileImpl(com.perl5.lang.perl.psi.impl.PerlFileImpl) PerlCastExpression(com.perl5.lang.perl.psi.PerlCastExpression)

Aggregations

PerlCastExpression (com.perl5.lang.perl.psi.PerlCastExpression)1 PerlFileImpl (com.perl5.lang.perl.psi.impl.PerlFileImpl)1