mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
javafx: do not include default properties in completion twice
(cherry picked from commit cc8af6dba30d01d0bcc5928338eba6b8eb9f9a91)
This commit is contained in:
+7
@@ -141,6 +141,13 @@ public class JavaFxCompletionTest extends LightFixtureCompletionTestCase {
|
||||
assertContainsElements(myFixture.getLookupElementStrings(), "image", "Image");
|
||||
}
|
||||
|
||||
public void testDefaultPropertyIncludeOnce() throws Exception {
|
||||
myFixture.configureByFiles(getTestName(true) + ".fxml");
|
||||
myItems = myFixture.completeBasic();
|
||||
assertContainsElements(myFixture.getLookupElementStrings(), "fx:reference");
|
||||
assertEquals(5, myItems.length);
|
||||
}
|
||||
|
||||
public void testIncludedRootAttributes() throws Exception {
|
||||
myFixture.addFileToProject("foo.fxml", "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
|
||||
"<?import javafx.scene.layout.*?>\n" +
|
||||
|
||||
+4
-4
@@ -72,6 +72,10 @@ public class JavaFxClassBackedElementDescriptor implements XmlElementDescriptor,
|
||||
final JavaFxPropertyElementDescriptor defaultPropertyDescriptor = getDefaultPropertyDescriptor();
|
||||
if (defaultPropertyDescriptor != null) {
|
||||
Collections.addAll(children, defaultPropertyDescriptor.getElementsDescriptors(context));
|
||||
} else {
|
||||
for (String name : FxmlConstants.FX_DEFAULT_ELEMENTS) {
|
||||
children.add(new JavaFxDefaultPropertyElementDescriptor(name, null));
|
||||
}
|
||||
}
|
||||
|
||||
collectStaticElementDescriptors(context, children);
|
||||
@@ -81,10 +85,6 @@ public class JavaFxClassBackedElementDescriptor implements XmlElementDescriptor,
|
||||
JavaFxPropertyElementDescriptor.collectDescriptorsByCollection(returnType, myPsiClass.getResolveScope(), children, myPsiClass.getProject());
|
||||
}
|
||||
|
||||
for (String name : FxmlConstants.FX_DEFAULT_ELEMENTS) {
|
||||
children.add(new JavaFxDefaultPropertyElementDescriptor(name, null));
|
||||
}
|
||||
|
||||
if (!children.isEmpty()) {
|
||||
return children.toArray(new XmlElementDescriptor[children.size()]);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<?import javafx.scene.layout.GridPane?>
|
||||
|
||||
<GridPane xmlns:fx="http://javafx.com/fxml" fx:id="foo">
|
||||
<fx:ref<caret>
|
||||
</GridPane>
|
||||
Reference in New Issue
Block a user