use of com.intellij.navigation.GotoRelatedProvider in project intellij-community by JetBrains.
the class NavigationUtil method collectRelatedItems.
@NotNull
public static List<GotoRelatedItem> collectRelatedItems(@NotNull PsiElement contextElement, @Nullable DataContext dataContext) {
Set<GotoRelatedItem> items = ContainerUtil.newLinkedHashSet();
for (GotoRelatedProvider provider : Extensions.getExtensions(GotoRelatedProvider.EP_NAME)) {
items.addAll(provider.getItems(contextElement));
if (dataContext != null) {
items.addAll(provider.getItems(dataContext));
}
}
GotoRelatedItem[] result = items.toArray(new GotoRelatedItem[items.size()]);
Arrays.sort(result, (i1, i2) -> {
String o1 = i1.getGroup();
String o2 = i2.getGroup();
return StringUtil.isEmpty(o1) ? 1 : StringUtil.isEmpty(o2) ? -1 : o1.compareTo(o2);
});
return Arrays.asList(result);
}
Aggregations