use of com.intellij.codeInsight.intention.IntentionAction in project intellij-community by JetBrains.
the class PyTestCase method findQuickFixByClassInIntentions.
/**
* Searches for quickfix itetion by its class
*
* @param clazz quick fix class
* @param <T> quick fix class
* @return quick fix or null if nothing found
*/
@Nullable
public <T extends LocalQuickFix> T findQuickFixByClassInIntentions(@NotNull final Class<T> clazz) {
for (final IntentionAction action : myFixture.getAvailableIntentions()) {
if ((action instanceof QuickFixWrapper)) {
final QuickFixWrapper quickFixWrapper = (QuickFixWrapper) action;
final LocalQuickFix fix = quickFixWrapper.getFix();
if (clazz.isInstance(fix)) {
@SuppressWarnings("unchecked") final T result = (T) fix;
return result;
}
}
}
return null;
}
use of com.intellij.codeInsight.intention.IntentionAction in project intellij-community by JetBrains.
the class SpellingPopupActionGroup method extractActions.
private static void extractActions(List<HighlightInfo.IntentionActionDescriptor> descriptors, Map<Anchor, List<AnAction>> actions) {
for (HighlightInfo.IntentionActionDescriptor actionDescriptor : descriptors) {
IntentionAction action = actionDescriptor.getAction();
if (action instanceof QuickFixWrapper) {
QuickFixWrapper wrapper = (QuickFixWrapper) action;
LocalQuickFix localQuickFix = wrapper.getFix();
if (localQuickFix instanceof SpellCheckerQuickFix) {
SpellCheckerQuickFix spellCheckerQuickFix = (SpellCheckerQuickFix) localQuickFix;
Anchor anchor = spellCheckerQuickFix.getPopupActionAnchor();
SpellCheckerIntentionAction popupAction = new SpellCheckerIntentionAction(action);
List<AnAction> list = actions.get(anchor);
if (list != null) {
list.add(popupAction);
}
}
}
}
}
use of com.intellij.codeInsight.intention.IntentionAction in project intellij-community by JetBrains.
the class PyUnresolvedReferencesInspectionTest method testIgnoredUnresolvedReferenceInUnionType.
// PY-11956
public void testIgnoredUnresolvedReferenceInUnionType() {
final String testName = getTestName(true);
final String inspectionName = getInspectionClass().getSimpleName();
myFixture.configureByFile("inspections/" + inspectionName + "/" + testName + ".py");
myFixture.enableInspections(getInspectionClass());
final String attrQualifiedName = "inspections." + inspectionName + "." + testName + ".A.foo";
final IntentionAction intentionAction = myFixture.findSingleIntention("Ignore unresolved reference '" + attrQualifiedName + "'");
assertNotNull(intentionAction);
myFixture.launchAction(intentionAction);
myFixture.checkHighlighting(isWarning(), isInfo(), isWeakWarning());
}
use of com.intellij.codeInsight.intention.IntentionAction in project intellij-community by JetBrains.
the class PyIntentionTest method doTest.
private void doTest(String hint, boolean ignoreWhiteSpaces) {
myFixture.configureByFile("intentions/" + getTestName(true) + ".py");
final IntentionAction action = myFixture.findSingleIntention(hint);
myFixture.launchAction(action);
myFixture.checkResultByFile("intentions/" + getTestName(true) + "_after.py", ignoreWhiteSpaces);
}
use of com.intellij.codeInsight.intention.IntentionAction in project intellij-community by JetBrains.
the class PyIntentionTest method doTest.
private void doTest(String hint) {
myFixture.configureByFile("intentions/" + getTestName(true) + ".py");
final IntentionAction action = myFixture.findSingleIntention(hint);
myFixture.launchAction(action);
myFixture.checkResultByFile("intentions/" + getTestName(true) + "_after.py");
}
Aggregations