Search in sources :

Example 1 with IntentionWrapper

use of com.intellij.codeInspection.IntentionWrapper in project intellij-community by JetBrains.

the class IntentionListStep method getWeight.

private int getWeight(IntentionActionWithTextCaching action) {
    IntentionAction a = action.getAction();
    int group = getGroup(action);
    if (a instanceof IntentionActionWrapper) {
        a = ((IntentionActionWrapper) a).getDelegate();
    }
    if (a instanceof IntentionWrapper) {
        a = ((IntentionWrapper) a).getAction();
    }
    if (a instanceof HighPriorityAction) {
        return group + 3;
    }
    if (a instanceof LowPriorityAction) {
        return group - 3;
    }
    if (a instanceof SuppressIntentionActionFromFix) {
        if (((SuppressIntentionActionFromFix) a).isShouldBeAppliedToInjectionHost() == ThreeState.NO) {
            return group - 1;
        }
    }
    if (a instanceof QuickFixWrapper) {
        final LocalQuickFix quickFix = ((QuickFixWrapper) a).getFix();
        if (quickFix instanceof HighPriorityAction) {
            return group + 3;
        }
        if (quickFix instanceof LowPriorityAction) {
            return group - 3;
        }
    }
    return group;
}
Also used : SuppressIntentionActionFromFix(com.intellij.codeInspection.SuppressIntentionActionFromFix) IntentionWrapper(com.intellij.codeInspection.IntentionWrapper) LocalQuickFix(com.intellij.codeInspection.LocalQuickFix) IntentionActionWrapper(com.intellij.codeInsight.intention.impl.config.IntentionActionWrapper) QuickFixWrapper(com.intellij.codeInspection.ex.QuickFixWrapper)

Aggregations

IntentionActionWrapper (com.intellij.codeInsight.intention.impl.config.IntentionActionWrapper)1 IntentionWrapper (com.intellij.codeInspection.IntentionWrapper)1 LocalQuickFix (com.intellij.codeInspection.LocalQuickFix)1 SuppressIntentionActionFromFix (com.intellij.codeInspection.SuppressIntentionActionFromFix)1 QuickFixWrapper (com.intellij.codeInspection.ex.QuickFixWrapper)1