PsiClass (final PsiFile containingFile) { if (containingFile instanceof XmlFile) { final XmlTag rootTag = ((XmlFile)containingFile).getRootTag(); final Project project = containingFile.getProject(); if (rootTag != null) { XmlAttribute attribute = rootTag.getAttribute(FxmlConstants.FX_CONTROLLER); if (attribute != null) { final PsiClass controllerClass = findControllerClass(containingFile, project, attribute); if (controllerClass != null) { return controllerClass; } } } if (Registry.is("javafx.fxml.controller.from.loader", false)) { final CachedValuesManager manager = CachedValuesManager.getManager(containingFile.getProject()); final PsiClass injectedControllerClass = manager.getCachedValue( containingFile, INJECTED_CONTROLLER, () -> computeInjectedControllerClass(containingFile), true); if (injectedControllerClass != null) { return injectedControllerClass; } } if (rootTag != null && FxmlConstants.FX_ROOT.equals(rootTag.getName())) { final XmlAttribute rootTypeAttr = rootTag.getAttribute(FxmlConstants.TYPE); if (rootTypeAttr != null) { return findControllerClass(containingFile, project, rootTypeAttr); } } } return null; }