IDEA-67498 XSLT: changing value of version does not change XPath highlighting and completion until project reopening

This commit is contained in:
sweinreuter
2011-04-11 09:51:54 +02:00
parent c8bba3a665
commit 2b5bcf3c51
2 changed files with 23 additions and 2 deletions
@@ -87,10 +87,20 @@ public abstract class XsltContextProviderBase extends ContextProvider {
protected XsltContextProviderBase(XmlElement element) {
final Project project = element.getProject();
myFileAssociationsManager = FileAssociationsManager.getInstance(project);
myContextElement = SmartPointerManager.getInstance(project).createLazyPointer(element);
myContextElement = SmartPointerManager.getInstance(project).createSmartPsiElementPointer(element);
attachTo(element);
}
@Override
protected boolean isValid() {
return super.isValid() && matchContextType();
}
private boolean matchContextType() {
final PsiFile file = myContextElement.getContainingFile();
return file != null && XsltSupport.getXsltLanguageLevel(file).getXPathVersion() == getContextType().getVersion();
}
private static void fillFromSchema(PsiFile file, ElementNames names) {
if (!(file instanceof XmlFile)) return;
final XmlFile f = (XmlFile)file;
@@ -16,12 +16,23 @@
package org.intellij.lang.xpath.xslt.impl;
import org.intellij.lang.xpath.context.XPathVersion;
import org.intellij.lang.xpath.xslt.XsltSupport;
import com.intellij.util.xml.NanoXmlUtil;
public class XsltChecker extends NanoXmlUtil.IXMLBuilderAdapter {
public enum LanguageLevel { NONE, V1, V2 }
public enum LanguageLevel { NONE(null), V1(XPathVersion.V1), V2(XPathVersion.V2);
private final XPathVersion myVersion;
LanguageLevel(XPathVersion version) {
myVersion = version;
}
public XPathVersion getXPathVersion() {
return myVersion;
}
}
enum State {
YES, SIMPLIFIED, NO, POSSIBLY, POSSIBLY_SIMPLIFIED_SYNTAX, VERSION2