mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
javafx: field name isCaseInsensitiveEqual to default property should be treated as subTag
(cherry picked from commit df4e26648dd1e5040ae2cba4f96cdb1ef10222b5)
This commit is contained in:
+4
@@ -281,6 +281,10 @@ public class JavaFXHighlightingTest extends AbstractJavaFXTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testDefaultPropertyField() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() throws Exception {
|
||||
myFixture.testHighlighting(false, false, false, getTestName(true) + ".fxml");
|
||||
}
|
||||
|
||||
+18
-3
@@ -1,5 +1,6 @@
|
||||
package org.jetbrains.plugins.javaFX.fxml.descriptors;
|
||||
|
||||
import com.intellij.codeInsight.AnnotationUtil;
|
||||
import com.intellij.codeInsight.daemon.Validator;
|
||||
import com.intellij.codeInsight.daemon.impl.analysis.GenericsHighlightUtil;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -26,6 +27,7 @@ import org.jetbrains.plugins.javaFX.fxml.JavaFxCommonClassNames;
|
||||
import org.jetbrains.plugins.javaFX.fxml.JavaFxPsiUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -150,14 +152,27 @@ public class JavaFxClassBackedElementDescriptor implements XmlElementDescriptor,
|
||||
final String parentTagName = contextTag.getName();
|
||||
if (myPsiClass != null) {
|
||||
if (!FxmlConstants.FX_DEFINE.equals(parentTagName)) {
|
||||
final JavaFxPropertyElementDescriptor elementDescriptor = new JavaFxPropertyElementDescriptor(myPsiClass, name, false);
|
||||
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;
|
||||
} else {
|
||||
final PsiAnnotation defaultProperty = AnnotationUtil
|
||||
.findAnnotationInHierarchy(myPsiClass, Collections.singleton(JavaFxCommonClassNames.JAVAFX_BEANS_DEFAULT_PROPERTY));
|
||||
if (defaultProperty != null) {
|
||||
final PsiAnnotationMemberValue defaultPropertyAttributeValue = defaultProperty.findAttributeValue("value");
|
||||
if (defaultPropertyAttributeValue instanceof PsiLiteralExpression) {
|
||||
final Object value = ((PsiLiteralExpression)defaultPropertyAttributeValue).getValue();
|
||||
if (value instanceof String && ((String)value).equalsIgnoreCase(name) && myPsiClass.findFieldByName(name, true) == null) {
|
||||
elementDescriptor = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (elementDescriptor != null && elementDescriptor.getDeclaration() != null) {
|
||||
return elementDescriptor;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import javafx.scene.image.*?>
|
||||
<AnchorPane xmlns:fx="http://javafx.com/fxml">
|
||||
<ImageView id="lock" pickOnBounds="true">
|
||||
<Image url="" preserveRatio="true" smooth="true"/>
|
||||
</ImageView>
|
||||
</AnchorPane>
|
||||
Reference in New Issue
Block a user