use of org.jetbrains.idea.devkit.util.ExtensionPointLocator in project intellij-community by JetBrains.
the class RegisterExtensionFixProvider method getQuickFixes.
@NotNull
@Override
public IntentionAction[] getQuickFixes(@NotNull PsiElement element) {
if (!(element instanceof PsiIdentifier))
return IntentionAction.EMPTY_ARRAY;
PsiElement parent = element.getParent();
if (!(parent instanceof PsiClass))
return IntentionAction.EMPTY_ARRAY;
PsiClass psiClass = (PsiClass) parent;
if (InheritanceUtil.isInheritor(psiClass, LocalInspectionTool.class.getName())) {
return new IntentionAction[] { new RegisterInspectionFix(psiClass, LocalInspectionEP.LOCAL_INSPECTION) };
}
if (InheritanceUtil.isInheritor(psiClass, GlobalInspectionTool.class.getName())) {
return new IntentionAction[] { new RegisterInspectionFix(psiClass, InspectionEP.GLOBAL_INSPECTION) };
}
ExtensionPointLocator extensionPointLocator = new ExtensionPointLocator(psiClass);
List<ExtensionPointCandidate> candidateList = extensionPointLocator.findSuperCandidates();
if (!candidateList.isEmpty()) {
return new IntentionAction[] { new RegisterExtensionFix(psiClass, candidateList) };
}
return IntentionAction.EMPTY_ARRAY;
}
use of org.jetbrains.idea.devkit.util.ExtensionPointLocator in project intellij-community by JetBrains.
the class ExtensionPointDeclarationRelatedItemLineMarkerProvider method process.
private static void process(PsiField psiField, Collection<? super RelatedItemLineMarkerInfo> result) {
if (!isExtensionPointNameDeclarationField(psiField))
return;
final PsiClass epClass = resolveExtensionPointClass(psiField);
if (epClass == null)
return;
final String epName = resolveEpName(psiField);
if (epName == null)
return;
ExtensionPointLocator locator = new ExtensionPointLocator(epClass);
List<ExtensionPointCandidate> targets = ContainerUtil.filter(locator.findDirectCandidates(), candidate -> epName.equals(candidate.epName));
final RelatedItemLineMarkerInfo<PsiElement> info = NavigationGutterIconBuilder.create(AllIcons.Nodes.Plugin, CONVERTER, RELATED_ITEM_PROVIDER).setTargets(targets).setPopupTitle("Choose Extension Point").setTooltipText("Extension Point Declaration").setAlignment(GutterIconRenderer.Alignment.RIGHT).createLineMarkerInfo(psiField.getNameIdentifier());
result.add(info);
}
Aggregations