Search in sources :

Example 1 with RemoveASTNodeFix

use of com.intellij.lang.javascript.validation.fixes.RemoveASTNodeFix in project intellij-plugins by JetBrains.

the class FlexUnitMethodIsStaticInspection method visitPotentialTestMethod.

protected void visitPotentialTestMethod(JSFunction method, ProblemsHolder holder, FlexUnitSupport support) {
    if (FlexUnitSupport.getCustomRunner((JSClass) method.getParent()) != null)
        return;
    if (method.getAttributeList() != null && method.getAttributeList().hasModifier(JSAttributeList.ModifierType.STATIC)) {
        final ASTNode nameIdentifier = method.findNameIdentifier();
        if (nameIdentifier != null) {
            final ASTNode node = method.getAttributeList().getNode().findChildByType(JSTokenTypes.STATIC_KEYWORD);
            assert node != null;
            holder.registerProblem(nameIdentifier.getPsi(), FlexBundle.message("flexunit.inspection.testmethodisstatic.message"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, new RemoveASTNodeFix("0.is.not.a.legal.name", node) {

                @NotNull
                @Override
                public String getText() {
                    return FlexBundle.message("flexunit.fix.remove.static.modifier");
                }
            });
        }
    }
}
Also used : ASTNode(com.intellij.lang.ASTNode) RemoveASTNodeFix(com.intellij.lang.javascript.validation.fixes.RemoveASTNodeFix) JSClass(com.intellij.lang.javascript.psi.ecmal4.JSClass) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

ASTNode (com.intellij.lang.ASTNode)1 JSClass (com.intellij.lang.javascript.psi.ecmal4.JSClass)1 RemoveASTNodeFix (com.intellij.lang.javascript.validation.fixes.RemoveASTNodeFix)1 NotNull (org.jetbrains.annotations.NotNull)1