Search in sources :

Example 1 with IntentionActionWrapper

use of com.intellij.codeInsight.intention.impl.config.IntentionActionWrapper 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)

Example 2 with IntentionActionWrapper

use of com.intellij.codeInsight.intention.impl.config.IntentionActionWrapper in project intellij-community by JetBrains.

the class IPPTestCase method assertIntentionNotAvailable.

protected void assertIntentionNotAvailable(Class<? extends IntentionAction> intentionClass) {
    myFixture.configureByFile(getTestName(false) + ".java");
    final List<IntentionAction> result = new SmartList<>();
    for (final IntentionAction intention : myFixture.getAvailableIntentions()) {
        if (intentionClass.isInstance(intention)) {
            result.add(intention);
        } else if (intention instanceof IntentionActionWrapper) {
            final IntentionActionWrapper wrapper = (IntentionActionWrapper) intention;
            if (intentionClass.isInstance(wrapper.getDelegate())) {
                result.add(intention);
            }
        }
    }
    assertEmpty("Intention of class \'" + intentionClass + "\' is available but should not", result);
}
Also used : IntentionAction(com.intellij.codeInsight.intention.IntentionAction) SmartList(com.intellij.util.SmartList) IntentionActionWrapper(com.intellij.codeInsight.intention.impl.config.IntentionActionWrapper)

Aggregations

IntentionActionWrapper (com.intellij.codeInsight.intention.impl.config.IntentionActionWrapper)2 IntentionAction (com.intellij.codeInsight.intention.IntentionAction)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 SmartList (com.intellij.util.SmartList)1