javafx: do not treat library root tag type as controller

This commit is contained in:
anna
2013-04-05 18:16:19 +02:00
parent 254f612b81
commit 38ba10dc3b
3 changed files with 14 additions and 1 deletions

View File

@@ -20,6 +20,8 @@ import com.intellij.openapi.application.PluginPathManager;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.javaFX.fxml.codeInsight.inspections.JavaFxUnresolvedFxIdReferenceInspection;
import java.util.List;
/**
* User: anna
* Date: 1/10/13
@@ -35,6 +37,12 @@ public class JavaFXUnresolvedFxIdReferenceInspectionTest extends AbstractJavaFXQ
doTest("Controller");
}
public void testRootType() throws Exception {
myFixture.configureByFiles(getTestName(true) + ".fxml");
final List<IntentionAction> intentionActions = myFixture.filterAvailableIntentions(getHint("unknown"));
assertEmpty(intentionActions);
}
private void doTest(final String controllerName) {
myFixture.configureByFiles(getTestName(true) + ".fxml", controllerName + ".java");
final IntentionAction singleIntention = myFixture.findSingleIntention(getHint("unknown"));

View File

@@ -252,7 +252,8 @@ public class JavaFxPsiUtil {
private static PsiClass findControllerClass(PsiFile containingFile, Project project, XmlAttribute attribute) {
final String attributeValue = attribute.getValue();
if (!StringUtil.isEmptyOrSpaces(attributeValue)) {
return JavaPsiFacade.getInstance(project).findClass(attributeValue, containingFile.getResolveScope());
final GlobalSearchScope customScope = GlobalSearchScope.projectScope(project).intersectWith(containingFile.getResolveScope());
return JavaPsiFacade.getInstance(project).findClass(attributeValue, customScope);
}
return null;
}

View File

@@ -0,0 +1,4 @@
<?import javafx.scene.control.Label?>
<fx:root type="javafx.scene.layout.GridPane" xmlns:fx="http://javafx.com/fxml">
<Label fx:id="unkno<caret>wn"/>
</fx:root>