mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup
This commit is contained in:
@@ -21,21 +21,18 @@ import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.TokenType;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.xml.XmlConditionalSection;
|
||||
import com.intellij.psi.xml.XmlElementType;
|
||||
import com.intellij.psi.xml.XmlEntityDecl;
|
||||
import com.intellij.psi.xml.XmlEntityRef;
|
||||
import com.intellij.psi.xml.*;
|
||||
|
||||
/**
|
||||
* @author maxim.mossienko
|
||||
*/
|
||||
public class XmlConditionalSectionImpl extends XmlElementImpl implements XmlConditionalSection, XmlElementType {
|
||||
public class XmlConditionalSectionImpl extends XmlElementImpl implements XmlConditionalSection {
|
||||
public XmlConditionalSectionImpl() {
|
||||
super(XML_CONDITIONAL_SECTION);
|
||||
super(XmlElementType.XML_CONDITIONAL_SECTION);
|
||||
}
|
||||
|
||||
public boolean isIncluded(PsiFile targetFile) {
|
||||
ASTNode child = findChildByType(XML_CONDITIONAL_SECTION_START);
|
||||
ASTNode child = findChildByType(XmlTokenType.XML_CONDITIONAL_SECTION_START);
|
||||
|
||||
if (child != null) {
|
||||
child = child.getTreeNext();
|
||||
@@ -46,10 +43,10 @@ public class XmlConditionalSectionImpl extends XmlElementImpl implements XmlCond
|
||||
|
||||
if (child != null) {
|
||||
IElementType elementType = child.getElementType();
|
||||
if (elementType == XML_CONDITIONAL_INCLUDE) return true;
|
||||
if (elementType == XML_CONDITIONAL_IGNORE) return false;
|
||||
if (elementType == XmlTokenType.XML_CONDITIONAL_INCLUDE) return true;
|
||||
if (elementType == XmlTokenType.XML_CONDITIONAL_IGNORE) return false;
|
||||
|
||||
if (elementType == XML_ENTITY_REF) {
|
||||
if (elementType == XmlElementType.XML_ENTITY_REF) {
|
||||
XmlEntityRef xmlEntityRef = (XmlEntityRef)child.getPsi();
|
||||
|
||||
final String text = xmlEntityRef.getText();
|
||||
@@ -64,21 +61,19 @@ public class XmlConditionalSectionImpl extends XmlElementImpl implements XmlCond
|
||||
for (ASTNode e = decl.getNode().getFirstChildNode(); e != null; e = e.getTreeNext()) {
|
||||
if (e.getElementType() == XmlElementType.XML_ATTRIBUTE_VALUE) {
|
||||
final boolean b = StringUtil.stripQuotesAroundValue(e.getText()).equals("INCLUDE");
|
||||
//if (!b) System.out.println("Skipped:"+text);
|
||||
return b;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
///System.out.println("Skipped:"+child.getText());
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public PsiElement getBodyStart() {
|
||||
ASTNode child = findChildByType(XML_MARKUP_START);
|
||||
ASTNode child = findChildByType(XmlTokenType.XML_MARKUP_START);
|
||||
if (child != null) child = child.getTreeNext();
|
||||
if (child != null) return child.getPsi();
|
||||
return null;
|
||||
|
||||
@@ -33,7 +33,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
/**
|
||||
* @author Mike
|
||||
*/
|
||||
public class XmlDoctypeImpl extends XmlElementImpl implements XmlDoctype, XmlElementType {
|
||||
public class XmlDoctypeImpl extends XmlElementImpl implements XmlDoctype {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.source.xml.XmlDoctypeImpl");
|
||||
|
||||
public XmlDoctypeImpl() {
|
||||
@@ -66,13 +66,13 @@ public class XmlDoctypeImpl extends XmlElementImpl implements XmlDoctype, XmlEle
|
||||
public int getChildRole(ASTNode child) {
|
||||
LOG.assertTrue(child.getTreeParent() == this);
|
||||
IElementType i = child.getElementType();
|
||||
if (i == XML_DOCTYPE_PUBLIC) {
|
||||
if (i == XmlTokenType.XML_DOCTYPE_PUBLIC) {
|
||||
return XmlChildRole.XML_DOCTYPE_PUBLIC;
|
||||
}
|
||||
else if (i == XML_DOCTYPE_SYSTEM) {
|
||||
else if (i == XmlTokenType.XML_DOCTYPE_SYSTEM) {
|
||||
return XmlChildRole.XML_DOCTYPE_SYSTEM;
|
||||
}
|
||||
else if (i == XML_NAME) {
|
||||
else if (i == XmlTokenType.XML_NAME) {
|
||||
return XmlChildRole.XML_NAME;
|
||||
}
|
||||
else {
|
||||
@@ -203,7 +203,7 @@ public class XmlDoctypeImpl extends XmlElementImpl implements XmlDoctype, XmlEle
|
||||
}
|
||||
|
||||
public XmlMarkupDecl getMarkupDecl() {
|
||||
for(PsiElement child = this.getFirstChild(); child != null; child = child.getNextSibling()){
|
||||
for(PsiElement child = getFirstChild(); child != null; child = child.getNextSibling()){
|
||||
if (child instanceof XmlMarkupDecl){
|
||||
return (XmlMarkupDecl)child;
|
||||
}
|
||||
@@ -216,14 +216,14 @@ public class XmlDoctypeImpl extends XmlElementImpl implements XmlDoctype, XmlEle
|
||||
public PsiReference[] getReferences() {
|
||||
final XmlElement dtdUrlElement = getDtdUrlElement();
|
||||
final PsiElement docTypePublic = findChildByRoleAsPsiElement(XmlChildRole.XML_DOCTYPE_PUBLIC);
|
||||
PsiReference uriRefs[] = null;
|
||||
PsiReference[] uriRefs = null;
|
||||
|
||||
if (dtdUrlElement != null) {
|
||||
uriRefs = new PsiReference[1];
|
||||
uriRefs[0] = new URLReference(XmlDoctypeImpl.this) {
|
||||
@NotNull
|
||||
public Object[] getVariants() {
|
||||
return (docTypePublic != null)?
|
||||
return docTypePublic != null ?
|
||||
super.getVariants(): EMPTY_ARRAY;
|
||||
}
|
||||
@NotNull
|
||||
|
||||
Reference in New Issue
Block a user