public void invoke(@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) {
final PsiElement at = file.findElementAt(editor.getCaretModel().getOffset());
final HaxeComponentName componentName = PsiTreeUtil.getParentOfType(at, HaxeComponentName.class);
final HaxeClass haxeClass = PsiTreeUtil.getParentOfType(at, HaxeClass.class);
final HaxeNamedComponent namedComponent = componentName == null ? haxeClass : (HaxeNamedComponent)componentName.getParent();
if (at == null || haxeClass == null || namedComponent == null) return;
final List<HaxeClass> supers = HaxeResolveUtil.tyrResolveClassesByQName(haxeClass.getExtendsList());
supers.addAll(HaxeResolveUtil.tyrResolveClassesByQName(haxeClass.getImplementsList()));
final List<HaxeNamedComponent> superItems = HaxeResolveUtil.findNamedSubComponents(false, supers.toArray(new HaxeClass[supers.size()]));
final HaxeComponentType type = HaxeComponentType.typeOf(namedComponent);
if (type == HaxeComponentType.METHOD) {
final HaxeComponentWithDeclarationList methodDeclaration = (HaxeComponentWithDeclarationList)namedComponent;
tryNavigateToSuperMethod(editor, methodDeclaration, superItems);
}
else if (!supers.isEmpty() && namedComponent instanceof HaxeClass) {
PsiElementListNavigator.openTargets(
editor,
HaxeResolveUtil.getComponentNames(supers).toArray(new NavigatablePsiElement[supers.size()]),
DaemonBundle.message("navigation.title.subclass", namedComponent.getName(), supers.size()),
"Subclasses of " + namedComponent.getName(),
new DefaultPsiElementCellRenderer()
);
}
}