use of com.intellij.ide.highlighter.DomSupportEnabled in project intellij-community by JetBrains.
the class FileDescriptionCachedValueProvider method _computeFileElement.
@Nullable
private DomFileElementImpl<T> _computeFileElement(final boolean fireEvents, @NotNull final XmlFileHeader rootTagName, @Nullable StringBuilder sb) {
if (sb != null) {
sb.append(rootTagName).append("\n");
}
if (!myXmlFile.isValid()) {
return null;
}
if (sb != null) {
sb.append("File is valid\n");
}
if (!(myXmlFile.getFileType() instanceof DomSupportEnabled)) {
return null;
}
if (sb != null) {
sb.append("File is of dom file type\n");
}
final DomFileDescription<T> description = findFileDescription(rootTagName, sb);
final DomFileElementImpl oldValue = getLastValue();
if (sb != null) {
sb.append("last " + oldValue + "\n");
}
final List<DomEvent> events = fireEvents ? new SmartList<>() : Collections.<DomEvent>emptyList();
if (oldValue != null) {
if (fireEvents) {
events.add(new DomEvent(oldValue, false));
}
}
if (description == null) {
return null;
}
final Class<T> rootElementClass = description.getRootElementClass();
final XmlName xmlName = DomImplUtil.createXmlName(description.getRootTagName(), rootElementClass, null);
assert xmlName != null;
final EvaluatedXmlNameImpl rootTagName1 = EvaluatedXmlNameImpl.createEvaluatedXmlName(xmlName, xmlName.getNamespaceKey(), false);
VirtualFile file = myXmlFile.getVirtualFile();
FileStub stub = null;
if (description.hasStubs() && file instanceof VirtualFileWithId && !isFileParsed()) {
ApplicationManager.getApplication().assertReadAccessAllowed();
if (!XmlUtil.isStubBuilding()) {
ObjectStubTree stubTree = StubTreeLoader.getInstance().readOrBuild(myXmlFile.getProject(), file, myXmlFile);
if (stubTree != null) {
stub = (FileStub) stubTree.getRoot();
}
}
}
DomFileElementImpl<T> result = new DomFileElementImpl<>(myXmlFile, rootElementClass, rootTagName1, myDomManager, description, stub);
if (sb != null) {
sb.append("success " + result + "\n");
}
if (fireEvents) {
events.add(new DomEvent(result, true));
}
return result;
}
Aggregations