mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
javafx: accept property tags inside fx:root; completion inside fx:root tag
(cherry picked from commit a2d537c110cf7ce277e5f9881cd21e313be6d115)
This commit is contained in:
+4
@@ -117,6 +117,10 @@ public class JavaFxCompletionTest extends CompletionTestCase {
|
||||
doTest("GridPane");
|
||||
}
|
||||
|
||||
public void testChildrenInsideGridPaneRoot() throws Exception {
|
||||
doTest("children");
|
||||
}
|
||||
|
||||
public void testReadOnly() throws Exception {
|
||||
configureByFile(getTestName(true) + ".fxml");
|
||||
assertTrue(myItems.length > 0);
|
||||
|
||||
+11
-4
@@ -148,10 +148,17 @@ public class JavaFxClassBackedElementDescriptor implements XmlElementDescriptor,
|
||||
}
|
||||
|
||||
final String parentTagName = contextTag.getName();
|
||||
if (!FxmlConstants.FX_ROOT.equals(parentTagName) && !FxmlConstants.FX_DEFINE.equals(parentTagName)) {
|
||||
final JavaFxPropertyElementDescriptor elementDescriptor = new JavaFxPropertyElementDescriptor(myPsiClass, name, false);
|
||||
if (myPsiClass != null && elementDescriptor.getDeclaration() != null) {
|
||||
return elementDescriptor;
|
||||
if (myPsiClass != null) {
|
||||
if (!FxmlConstants.FX_DEFINE.equals(parentTagName)) {
|
||||
final JavaFxPropertyElementDescriptor elementDescriptor = new JavaFxPropertyElementDescriptor(myPsiClass, name, false);
|
||||
if (FxmlConstants.FX_ROOT.equals(parentTagName)) {
|
||||
final PsiField fieldByName = myPsiClass.findFieldByName(name, true);
|
||||
if (fieldByName != null) {
|
||||
return elementDescriptor;
|
||||
}
|
||||
} else if (elementDescriptor.getDeclaration() != null) {
|
||||
return elementDescriptor;
|
||||
}
|
||||
}
|
||||
}
|
||||
return new JavaFxClassBackedElementDescriptor(name, childTag);
|
||||
|
||||
+6
@@ -60,6 +60,12 @@ public class JavaFxDefaultPropertyElementDescriptor implements XmlElementDescrip
|
||||
|
||||
@Override
|
||||
public XmlElementDescriptor[] getElementsDescriptors(XmlTag context) {
|
||||
if (myName.equals(FxmlConstants.FX_ROOT)) {
|
||||
final JavaFxClassBackedElementDescriptor tagDescriptor = getRootTagDescriptor(context);
|
||||
if (tagDescriptor != null) {
|
||||
return tagDescriptor.getElementsDescriptors(context);
|
||||
}
|
||||
}
|
||||
return XmlElementDescriptor.EMPTY_ARRAY;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<?import javafx.scene.layout.GridPane?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<fx:root type="javafx.scene.layout.GridPane" xmlns:fx="http://javafx.com/fxml">
|
||||
<<caret>
|
||||
</fx:root>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?import javafx.scene.layout.GridPane?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<fx:root type="javafx.scene.layout.GridPane" xmlns:fx="http://javafx.com/fxml">
|
||||
<children
|
||||
</fx:root>
|
||||
Reference in New Issue
Block a user