Search in sources :

Example 11 with InspectionGadgetsFix

use of com.siyeh.ig.InspectionGadgetsFix in project intellij-community by JetBrains.

the class PublicFieldInspection method buildFixes.

@NotNull
@Override
protected InspectionGadgetsFix[] buildFixes(Object... infos) {
    final List<InspectionGadgetsFix> fixes = new ArrayList<>();
    final PsiField field = (PsiField) infos[0];
    fixes.add(new EncapsulateVariableFix(field.getName()));
    AddToIgnoreIfAnnotatedByListQuickFix.build(field, ignorableAnnotations, fixes);
    return fixes.toArray(new InspectionGadgetsFix[fixes.size()]);
}
Also used : EncapsulateVariableFix(com.siyeh.ig.fixes.EncapsulateVariableFix) PsiField(com.intellij.psi.PsiField) ArrayList(java.util.ArrayList) InspectionGadgetsFix(com.siyeh.ig.InspectionGadgetsFix) NotNull(org.jetbrains.annotations.NotNull)

Example 12 with InspectionGadgetsFix

use of com.siyeh.ig.InspectionGadgetsFix in project intellij-community by JetBrains.

the class TooBroadThrowsInspection method buildFixes.

@NotNull
@Override
protected InspectionGadgetsFix[] buildFixes(Object... infos) {
    final PsiElement context = (PsiElement) infos[2];
    final SuppressForTestsScopeFix suppressFix = SuppressForTestsScopeFix.build(this, context);
    if (suppressFix == null) {
        return new InspectionGadgetsFix[] { buildFix(infos) };
    }
    return new InspectionGadgetsFix[] { buildFix(infos), suppressFix };
}
Also used : InspectionGadgetsFix(com.siyeh.ig.InspectionGadgetsFix) SuppressForTestsScopeFix(com.siyeh.ig.fixes.SuppressForTestsScopeFix) PsiElement(com.intellij.psi.PsiElement) NotNull(org.jetbrains.annotations.NotNull)

Example 13 with InspectionGadgetsFix

use of com.siyeh.ig.InspectionGadgetsFix in project intellij-community by JetBrains.

the class NonBooleanMethodNameMayNotStartWithQuestionInspection method buildFixes.

@NotNull
@Override
protected InspectionGadgetsFix[] buildFixes(Object... infos) {
    final PsiElement context = (PsiElement) infos[0];
    final InspectionGadgetsFix suppressFix = SuppressForTestsScopeFix.build(this, context);
    if (suppressFix == null) {
        return new InspectionGadgetsFix[] { new RenameFix() };
    }
    return new InspectionGadgetsFix[] { new RenameFix(), suppressFix };
}
Also used : RenameFix(com.siyeh.ig.fixes.RenameFix) InspectionGadgetsFix(com.siyeh.ig.InspectionGadgetsFix) PsiElement(com.intellij.psi.PsiElement) NotNull(org.jetbrains.annotations.NotNull)

Example 14 with InspectionGadgetsFix

use of com.siyeh.ig.InspectionGadgetsFix in project intellij-community by JetBrains.

the class PublicConstructorInNonPublicClassInspection method buildFixes.

@Override
@NotNull
public InspectionGadgetsFix[] buildFixes(Object... infos) {
    final List<InspectionGadgetsFix> fixes = new ArrayList();
    final PsiMethod constructor = (PsiMethod) infos[0];
    final PsiClass aClass = constructor.getContainingClass();
    if (aClass != null && aClass.hasModifierProperty(PsiModifier.PRIVATE)) {
        fixes.add(new SetConstructorModifierFix(PsiModifier.PRIVATE));
    }
    fixes.add(new RemoveModifierFix(PsiModifier.PUBLIC));
    return fixes.toArray(new InspectionGadgetsFix[fixes.size()]);
}
Also used : RemoveModifierFix(com.siyeh.ig.fixes.RemoveModifierFix) ArrayList(java.util.ArrayList) InspectionGadgetsFix(com.siyeh.ig.InspectionGadgetsFix) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

InspectionGadgetsFix (com.siyeh.ig.InspectionGadgetsFix)14 NotNull (org.jetbrains.annotations.NotNull)13 PsiElement (com.intellij.psi.PsiElement)6 ArrayList (java.util.ArrayList)5 SuppressForTestsScopeFix (com.siyeh.ig.fixes.SuppressForTestsScopeFix)4 DelegatingFix (com.siyeh.ig.DelegatingFix)2 RenameFix (com.siyeh.ig.fixes.RenameFix)2 AddTypeCastFix (com.intellij.codeInsight.daemon.impl.quickfix.AddTypeCastFix)1 CreateMethodQuickFix (com.intellij.codeInsight.daemon.impl.quickfix.CreateMethodQuickFix)1 AddAnnotationPsiFix (com.intellij.codeInsight.intention.AddAnnotationPsiFix)1 ProblemDescriptor (com.intellij.codeInspection.ProblemDescriptor)1 Project (com.intellij.openapi.project.Project)1 PsiField (com.intellij.psi.PsiField)1 PsiPolyadicExpression (com.intellij.psi.PsiPolyadicExpression)1 ChangeSignatureProcessor (com.intellij.refactoring.changeSignature.ChangeSignatureProcessor)1 EncapsulateVariableFix (com.siyeh.ig.fixes.EncapsulateVariableFix)1 IntroduceConstantFix (com.siyeh.ig.fixes.IntroduceConstantFix)1 RemoveModifierFix (com.siyeh.ig.fixes.RemoveModifierFix)1 List (java.util.List)1