mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
New chameleons and fix for problem with changed elements ordering in tree events
This commit is contained in:
@@ -3,7 +3,6 @@ package com.intellij.psi.impl.source.javadoc;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.javadoc.JavadocTagInfo;
|
||||
import com.intellij.psi.javadoc.PsiDocTagValue;
|
||||
import com.intellij.psi.util.InheritanceUtil;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
|
||||
@@ -18,11 +17,11 @@ class ExceptionTagInfo implements JavadocTagInfo {
|
||||
}
|
||||
|
||||
public String checkTagValue(PsiDocTagValue value) {
|
||||
if (value == null) return "Exception class expected";
|
||||
if (value == null || value.getFirstChild() == null) return "Exception class expected";
|
||||
|
||||
if (!(value.getFirstChild() instanceof PsiJavaCodeReferenceElement)) return "Wrong tag value";
|
||||
if (!(value.getFirstChild().getFirstChild() instanceof PsiJavaCodeReferenceElement)) return "Wrong tag value";
|
||||
|
||||
final PsiJavaCodeReferenceElement ref = ((PsiJavaCodeReferenceElement)value.getFirstChild());
|
||||
final PsiJavaCodeReferenceElement ref = ((PsiJavaCodeReferenceElement)value.getFirstChild().getFirstChild());
|
||||
final PsiClass exceptionClass = (PsiClass)ref.resolve();
|
||||
if (exceptionClass == null) return null;
|
||||
|
||||
|
||||
@@ -125,9 +125,11 @@ public class PsiDocMethodOrFieldRef extends CompositePsiElement implements PsiDo
|
||||
|
||||
List types = new ArrayList();
|
||||
for (PsiElement child = element.getFirstChild(); child != null; child = child.getNextSibling()) {
|
||||
if (child instanceof PsiTypeElement) {
|
||||
PsiTypeElement type = (PsiTypeElement)child;
|
||||
types.add(type.getType());
|
||||
if (child.getNode().getElementType() == JavaDocElementType.DOC_TYPE_HOLDER) {
|
||||
if(child.getFirstChild() != null){
|
||||
PsiTypeElement type = (PsiTypeElement)child.getFirstChild();
|
||||
types.add(type.getType());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -73,20 +73,20 @@ public interface XmlElementType {
|
||||
};
|
||||
|
||||
|
||||
IElementType DTD_FILE = new IChameleonElementType("DTD_FILE"){
|
||||
IElementType DTD_FILE = new IChameleonElementType("DTD_FILE", Language.findByID("XML")){
|
||||
public ASTNode parseContents(ASTNode chameleon) {
|
||||
final char[] chars = ((LeafElement)chameleon).textToCharArray();
|
||||
final DTDParser parser = new DTDParser();
|
||||
try {
|
||||
return parser.parse(chars, 0, chars.length, SharedImplUtil.findCharTableByTree(chameleon));
|
||||
}
|
||||
catch (ParsingException e) {}
|
||||
catch (ParsingException e) {}
|
||||
return null;
|
||||
}
|
||||
public boolean isParsable(CharSequence buffer) {return true;}
|
||||
};
|
||||
|
||||
IElementType XML_MARKUP = new IChameleonElementType("XML_MARKUP_DECL"){
|
||||
IElementType XML_MARKUP = new IChameleonElementType("XML_MARKUP_DECL", Language.findByID("XML")){
|
||||
public ASTNode parseContents(ASTNode chameleon) {
|
||||
final char[] chars = ((LeafElement)chameleon).textToCharArray();
|
||||
final DTDMarkupParser parser = new DTDMarkupParser();
|
||||
@@ -104,6 +104,7 @@ public interface XmlElementType {
|
||||
oldXmlLexer.start(chars, 0, chars.length);
|
||||
while(oldXmlLexer.getTokenType() != null && oldXmlLexer.getTokenEnd() != buffer.length()){
|
||||
if(oldXmlLexer.getTokenType() == XmlTokenType.XML_MARKUP_END) return false;
|
||||
oldXmlLexer.advance();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user