javafx: provide primitive completion for underlying non-static setters

This commit is contained in:
anna
2013-04-15 20:59:55 +02:00
parent 54ea30e04f
commit 0d66f07f7e
3 changed files with 11 additions and 2 deletions
@@ -159,6 +159,12 @@ public class JavaFxCompletionTest extends LightFixtureCompletionTestCase {
assertContainsElements(myFixture.getLookupElementStrings(), "true", "false");
}
public void testBooleanValuesNonStatic() throws Exception {
myFixture.configureByFiles(getTestName(true) + ".fxml");
complete();
assertContainsElements(myFixture.getLookupElementStrings(), "true", "false");
}
public void testDefaultPropertyIncludeOnce() throws Exception {
myFixture.configureByFiles(getTestName(true) + ".fxml");
myItems = myFixture.completeBasic();
@@ -178,8 +178,9 @@ public class JavaFxPropertyAttributeDescriptor implements XmlAttributeDescriptor
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) {
attrType = parameters[1].getType();
final boolean isStatic = ((PsiMethod)declaration).hasModifierProperty(PsiModifier.STATIC);
if (isStatic && parameters.length == 2 || !isStatic && parameters.length == 1) {
attrType = parameters[parameters.length - 1].getType();
}
}
@@ -0,0 +1,2 @@
<?import javafx.scene.layout.GridPane?>
<GridPane xmlns:fx="http://javafx.com/fxml" disable="<caret>"/>