private void getIntentionActionsToShow() { getActionsToShow(myEditor, myFile, myIntentionsInfo, myPassIdToShowIntentionsFor); if (myFile instanceof IntentionFilterOwner) { final IntentionFilterOwner.IntentionActionsFilter actionsFilter = ((IntentionFilterOwner)myFile).getIntentionActionsFilter(); if (actionsFilter == null) return; if (actionsFilter != IntentionFilterOwner.IntentionActionsFilter.EVERYTHING_AVAILABLE) { myIntentionsInfo.filterActions(actionsFilter); } } if (myIntentionsInfo.isEmpty()) { return; } myShowBulb = !myIntentionsInfo.guttersToShow.isEmpty() || ContainerUtil.exists(ContainerUtil.concat(myIntentionsInfo.errorFixesToShow, myIntentionsInfo.inspectionFixesToShow,myIntentionsInfo.intentionsToShow), new Condition<HighlightInfo.IntentionActionDescriptor>() { @Override public boolean value(HighlightInfo.IntentionActionDescriptor descriptor) { return IntentionManagerSettings.getInstance().isShowLightBulb(descriptor.getAction()); } }); }
private void getIntentionActionsToShow() { if (LookupManager.getInstance(myProject).getActiveLookup() != null) return; getActionsToShow(myEditor, myFile, myIntentionsInfo, myPassIdToShowIntentionsFor); if (myFile instanceof IntentionFilterOwner) { final IntentionFilterOwner.IntentionActionsFilter actionsFilter = ((IntentionFilterOwner)myFile).getIntentionActionsFilter(); if (actionsFilter == null) return; if (actionsFilter != IntentionFilterOwner.IntentionActionsFilter.EVERYTHING_AVAILABLE) { myIntentionsInfo.filterActions(actionsFilter); } } if (myIntentionsInfo.isEmpty()) { return; } myShowBulb = !myIntentionsInfo.guttersToShow.isEmpty(); if (!myShowBulb) { for (HighlightInfo.IntentionActionDescriptor descriptor : ContainerUtil.concat(myIntentionsInfo.errorFixesToShow, myIntentionsInfo.inspectionFixesToShow,myIntentionsInfo.intentionsToShow)) { final IntentionAction action = descriptor.getAction(); if (IntentionManagerSettings.getInstance().isShowLightBulb(action)) { myShowBulb = true; break; } } } }
private static void filter(@NotNull List<HighlightInfo.IntentionActionDescriptor> descriptors, @NotNull IntentionFilterOwner.IntentionActionsFilter actionsFilter) { for (Iterator<HighlightInfo.IntentionActionDescriptor> it = descriptors.iterator(); it.hasNext();) { HighlightInfo.IntentionActionDescriptor actionDescriptor = it.next(); if (!actionsFilter.isAvailable(actionDescriptor.getAction())) it.remove(); } }
private void filterActions(@NotNull IntentionFilterOwner.IntentionActionsFilter actionsFilter) { filter(intentionsToShow, actionsFilter); filter(errorFixesToShow, actionsFilter); filter(inspectionFixesToShow, actionsFilter); filter(guttersToShow, actionsFilter); }
public void filterActions(@NotNull IntentionFilterOwner.IntentionActionsFilter actionsFilter) { filter(intentionsToShow, actionsFilter); filter(errorFixesToShow, actionsFilter); filter(inspectionFixesToShow, actionsFilter); filter(guttersToShow, actionsFilter); }