use of org.jetbrains.plugins.javaFX.fxml.descriptors.JavaFxClassTagDescriptor in project intellij-community by JetBrains.
the class JavaFxNamespaceDescriptor method getElementDescriptor.
@Nullable
@Override
public XmlElementDescriptor getElementDescriptor(@NotNull XmlTag tag) {
final XmlTag parentTag = tag.getParentTag();
if (parentTag != null) {
final XmlElementDescriptor descriptor = parentTag.getDescriptor();
return descriptor != null ? descriptor.getElementDescriptor(tag, parentTag) : null;
}
final String name = tag.getName();
if (FxmlConstants.FX_ROOT.equals(name)) {
return new JavaFxRootTagDescriptor(tag);
}
return new JavaFxClassTagDescriptor(name, tag);
}
use of org.jetbrains.plugins.javaFX.fxml.descriptors.JavaFxClassTagDescriptor in project intellij-community by JetBrains.
the class JavaFxNamespaceDescriptor method getRootElementsDescriptors.
@NotNull
@Override
public XmlElementDescriptor[] getRootElementsDescriptors(@Nullable XmlDocument document) {
if (document != null) {
final Project project = document.getProject();
final PsiClass paneClass = JavaPsiFacade.getInstance(project).findClass(JavaFxCommonNames.JAVAFX_SCENE_LAYOUT_PANE, GlobalSearchScope.allScope(project));
if (paneClass != null) {
final ArrayList<XmlElementDescriptor> result = new ArrayList<>();
ClassInheritorsSearch.search(paneClass, paneClass.getUseScope(), true, true, false).forEach(psiClass -> {
result.add(new JavaFxClassTagDescriptor(psiClass.getName(), psiClass));
return true;
});
return result.toArray(new XmlElementDescriptor[result.size()]);
}
}
return XmlElementDescriptor.EMPTY_ARRAY;
}
Aggregations