mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
javafx: complete Infinity/NaN for float/double properties
(cherry picked from commit 87c1146a92dfa0f74e896e3372795d5a1b52bba6)
This commit is contained in:
+12
@@ -141,6 +141,18 @@ public class JavaFxCompletionTest extends LightFixtureCompletionTestCase {
|
||||
assertContainsElements(myFixture.getLookupElementStrings(), "image", "Image");
|
||||
}
|
||||
|
||||
public void testInfinity() throws Exception {
|
||||
myFixture.configureByFiles(getTestName(true) + ".fxml");
|
||||
complete();
|
||||
assertContainsElements(myFixture.getLookupElementStrings(), "Infinity", "-Infinity", "NaN", "-NaN");
|
||||
}
|
||||
|
||||
public void testNoInfinity() throws Exception {
|
||||
myFixture.configureByFiles(getTestName(true) + ".fxml");
|
||||
complete();
|
||||
assertDoesntContain(myFixture.getLookupElementStrings(), "Infinity");
|
||||
}
|
||||
|
||||
public void testDefaultPropertyIncludeOnce() throws Exception {
|
||||
myFixture.configureByFiles(getTestName(true) + ".fxml");
|
||||
myItems = myFixture.completeBasic();
|
||||
|
||||
@@ -524,6 +524,9 @@ public class JavaFxPsiUtil {
|
||||
}
|
||||
}
|
||||
if (substitute == null) {
|
||||
if (!InheritanceUtil.isInheritor(fieldType, JavaFxCommonClassNames.JAVAFX_BEANS_VALUE_OBSERVABLE_VALUE)) {
|
||||
return Result.create(fieldType, PsiModificationTracker.JAVA_STRUCTURE_MODIFICATION_COUNT);
|
||||
}
|
||||
final PsiClass aClass = JavaPsiFacade.getInstance(project)
|
||||
.findClass(JavaFxCommonClassNames.JAVAFX_BEANS_VALUE_OBSERVABLE_VALUE, GlobalSearchScope.allScope(project));
|
||||
LOG.assertTrue(aClass != null);
|
||||
|
||||
+10
-8
@@ -79,7 +79,13 @@ public class JavaFxPropertyAttributeDescriptor implements XmlAttributeDescriptor
|
||||
}
|
||||
return ArrayUtil.toStringArray(enumConstants);
|
||||
}
|
||||
return null;
|
||||
|
||||
final String propertyQName = getBoxedPropertyType(getDeclaration());
|
||||
if (CommonClassNames.JAVA_LANG_FLOAT.equals(propertyQName) || CommonClassNames.JAVA_LANG_DOUBLE.equals(propertyQName)) {
|
||||
return new String[] {"Infinity", "-Infinity", "NaN", "-NaN"};
|
||||
}
|
||||
|
||||
return ArrayUtil.EMPTY_STRING_ARRAY;
|
||||
}
|
||||
|
||||
protected boolean isConstant(PsiField enumField) {
|
||||
@@ -140,7 +146,7 @@ public class JavaFxPropertyAttributeDescriptor implements XmlAttributeDescriptor
|
||||
final XmlAttributeDescriptor attributeDescriptor = ((XmlAttribute)parent).getDescriptor();
|
||||
if (attributeDescriptor != null) {
|
||||
final PsiElement declaration = attributeDescriptor.getDeclaration();
|
||||
final String boxedQName = getBoxedPropertyType(context, declaration);
|
||||
final String boxedQName = getBoxedPropertyType(declaration);
|
||||
if (boxedQName != null) {
|
||||
try {
|
||||
final Class<?> aClass = Class.forName(boxedQName);
|
||||
@@ -164,14 +170,10 @@ public class JavaFxPropertyAttributeDescriptor implements XmlAttributeDescriptor
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static String getBoxedPropertyType(XmlElement context, PsiElement declaration) {
|
||||
private static String getBoxedPropertyType(PsiElement declaration) {
|
||||
PsiType attrType = null;
|
||||
if (declaration instanceof PsiField) {
|
||||
attrType = ((PsiField)declaration).getType();
|
||||
if (InheritanceUtil.isInheritor(attrType, JavaFxCommonClassNames.JAVAFX_BEANS_VALUE_OBSERVABLE_VALUE)) {
|
||||
attrType = JavaFxPsiUtil
|
||||
.getWrappedPropertyType((PsiField)declaration, context.getProject(), JavaFxCommonClassNames.ourWritableMap);
|
||||
}
|
||||
attrType = JavaFxPsiUtil.getWrappedPropertyType((PsiField)declaration, declaration.getProject(), JavaFxCommonClassNames.ourWritableMap);
|
||||
} else if (declaration instanceof PsiMethod) {
|
||||
final PsiParameter[] parameters = ((PsiMethod)declaration).getParameterList().getParameters();
|
||||
if (parameters.length == 2) {
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<?import javafx.scene.layout.GridPane?>
|
||||
<?import javafx.scene.control.Button?>
|
||||
<GridPane xmlns:fx="http://javafx.com/fxml">
|
||||
<Button prefHeight="<caret>"/>
|
||||
</GridPane>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?import javafx.scene.layout.GridPane?>
|
||||
<?import javafx.scene.control.Button?>
|
||||
<GridPane xmlns:fx="http://javafx.com/fxml">
|
||||
<Button GridPane.columnIndex="<caret>"/>
|
||||
</GridPane>
|
||||
Reference in New Issue
Block a user