diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/XPath2ElementVisitor.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/XPath2ElementVisitor.java new file mode 100644 index 000000000000..fbc07a9abb2a --- /dev/null +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/XPath2ElementVisitor.java @@ -0,0 +1,92 @@ +/* + * Copyright 2000-2011 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.intellij.lang.xpath.psi; + +import org.intellij.lang.xpath.psi.impl.XPath2ElementImpl; + +/* +* Created by IntelliJ IDEA. +* User: sweinreuter +* Date: 08.04.11 +*/ +public class XPath2ElementVisitor extends XPathElementVisitor { + public void visitXPath2TypeReference(XPath2TypeReference o) { + visitXPathElement(o); + } + + public void visitXPath2InstanceOf(XPath2InstanceOf o) { + visitXPathExpression(o); +// visitXPath2TypeReference(o); + } + + public void visitXPath2QuantifiedExpr(XPath2QuantifiedExpr o) { + visitXPathExpression(o); +// visitXPathVariableDeclaration(o); + } + + public void visitXPath2TreatAs(XPath2TreatAs o) { + visitXPathExpression(o); +// visitXPath2TypeReference(o); + } + + public void visitXPath2If(XPath2If o) { + visitXPathExpression(o); + } + + public void visitXPath2Cast(XPath2Cast o) { + visitXPathExpression(o); +// visitXPath2TypeReference(o); + } + + public void visitXPathVariableDeclaration(XPathVariableDeclaration o) { + visitXPathElement(o); + } + + public void visitXPath2Sequence(XPath2Sequence o) { + visitXPathExpression(o); + } + + public void visitXPath2For(XPath2For o) { + visitXPathExpression(o); +// visitXPathVariableDeclaration(o); + } + + public void visitXPath2TypeElement(XPath2TypeElement o) { + visitQNameElement(o); + } + + public void visitXPath2Castable(XPath2Castable o) { + visitXPathExpression(o); +// visitXPath2TypeReference(o); + } + + public void visitXPath2RangeExpression(XPath2RangeExpression o) { + visitXPathExpression(o); + } + + @Override + public void visitXPathElement(XPathElement o) { + if (o instanceof XPath2ElementImpl) { + visitXPath2Element(o); + } else { + super.visitXPathElement(o); + } + } + + public void visitXPath2Element(XPathElement element) { + super.visitXPathElement(element); + } +} \ No newline at end of file diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/XPathBinaryExpression.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/XPathBinaryExpression.java index a4b53d12d5c4..b9bab46695de 100644 --- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/XPathBinaryExpression.java +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/XPathBinaryExpression.java @@ -28,4 +28,7 @@ public interface XPathBinaryExpression extends XPathExpression { @NotNull XPathElementType getOperator(); + + @NotNull + String getOperationSign(); } \ No newline at end of file diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/XPathElementVisitor.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/XPathElementVisitor.java new file mode 100644 index 000000000000..8ffbe7287b46 --- /dev/null +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/XPathElementVisitor.java @@ -0,0 +1,107 @@ +/* + * Copyright 2000-2011 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.intellij.lang.xpath.psi; + +import com.intellij.psi.PsiElementVisitor; + +/* +* Created by IntelliJ IDEA. +* User: sweinreuter +* Date: 08.04.11 +*/ +public class XPathElementVisitor extends PsiElementVisitor { + public void visitXPathString(XPathString o) { + visitXPathExpression(o); + } + + public void visitXPathPrefixExpression(XPathPrefixExpression o) { + visitXPathExpression(o); + } + + public void visitXPathVariable(XPathVariable o) { + visitXPathElement(o); + } + + public void visitXPathToken(XPathToken o) { + visitXPathElement(o); + } + + public void visitXPathNodeTypeTest(XPathNodeTypeTest o) { + visitXPathFunctionCall(o); + } + + public void visitXPathPredicate(XPathPredicate o) { + visitXPathElement(o); + } + + public void visitQNameElement(QNameElement o) { + visitXPathElement(o); + } + + public void visitXPathNodeTest(XPathNodeTest o) { + visitQNameElement(o); + } + + public void visitXPathFunctionCall(XPathFunctionCall o) { + visitXPathExpression(o); +// visitQNameElement(o); + } + + public void visitXPathBinaryExpression(XPathBinaryExpression o) { + visitXPathExpression(o); + } + + public void visitXPathExpression(XPathExpression o) { + visitXPathElement(o); + } + + public void visitXPathParenthesizedExpression(XPathParenthesizedExpression o) { + visitXPathExpression(o); + } + + public void visitXPathStep(XPathStep o) { + visitXPathExpression(o); + } + + public void visitXPathAxisSpecifier(XPathAxisSpecifier o) { + visitXPathElement(o); + } + + public void visitXPathNumber(XPathNumber o) { + visitXPathExpression(o); + } + + public void visitXPathVariableReference(XPathVariableReference o) { + visitXPathExpression(o); +// visitQNameElement(o); + } + + public void visitXPathFilterExpression(XPathFilterExpression o) { + visitXPathExpression(o); + } + + public void visitXPathFunction(XPathFunction o) { + visitXPathElement(o); + } + + public void visitXPathLocationPath(XPathLocationPath o) { + visitXPathExpression(o); + } + + public void visitXPathElement(XPathElement o) { + visitElement(o); + } +} \ No newline at end of file diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPath2CastImpl.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPath2CastImpl.java index 62756f43fa45..0c0bf4ee6b70 100644 --- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPath2CastImpl.java +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPath2CastImpl.java @@ -17,12 +17,13 @@ package org.intellij.lang.xpath.psi.impl; import com.intellij.lang.ASTNode; import org.intellij.lang.xpath.psi.XPath2Cast; +import org.intellij.lang.xpath.psi.XPath2ElementVisitor; import org.intellij.lang.xpath.psi.XPath2TypeElement; import org.intellij.lang.xpath.psi.XPathType; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -public class XPath2CastImpl extends XPathElementImpl implements XPath2Cast { +public class XPath2CastImpl extends XPath2ElementImpl implements XPath2Cast { public XPath2CastImpl(ASTNode node) { super(node); } @@ -39,4 +40,8 @@ public class XPath2CastImpl extends XPathElementImpl implements XPath2Cast { final XPathType type = getTargetType(); return type != null ? type : XPathType.UNKNOWN; } + + public void accept(XPath2ElementVisitor visitor) { + visitor.visitXPath2Cast(this); + } } \ No newline at end of file diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPath2CastableImpl.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPath2CastableImpl.java index 4b25a2688684..fff0ef251243 100644 --- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPath2CastableImpl.java +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPath2CastableImpl.java @@ -16,14 +16,11 @@ package org.intellij.lang.xpath.psi.impl; import com.intellij.lang.ASTNode; -import org.intellij.lang.xpath.psi.XPath2Castable; -import org.intellij.lang.xpath.psi.XPath2Type; -import org.intellij.lang.xpath.psi.XPath2TypeElement; -import org.intellij.lang.xpath.psi.XPathType; +import org.intellij.lang.xpath.psi.*; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -public class XPath2CastableImpl extends XPathElementImpl implements XPath2Castable { +public class XPath2CastableImpl extends XPath2ElementImpl implements XPath2Castable { public XPath2CastableImpl(ASTNode node) { super(node); } @@ -40,4 +37,8 @@ public class XPath2CastableImpl extends XPathElementImpl implements XPath2Castab public XPathType getType() { return XPath2Type.BOOLEAN; } + + public void accept(XPath2ElementVisitor visitor) { + visitor.visitXPath2Castable(this); + } } diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPath2ElementImpl.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPath2ElementImpl.java new file mode 100644 index 000000000000..09f14ee0a75c --- /dev/null +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPath2ElementImpl.java @@ -0,0 +1,44 @@ +/* + * Copyright 2000-2011 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.intellij.lang.xpath.psi.impl; + +import com.intellij.lang.ASTNode; +import org.intellij.lang.xpath.psi.XPath2ElementVisitor; +import org.intellij.lang.xpath.psi.XPathElementVisitor; + +/* +* Created by IntelliJ IDEA. +* User: sweinreuter +* Date: 08.04.11 +*/ +public class XPath2ElementImpl extends XPathElementImpl { + public XPath2ElementImpl(ASTNode node) { + super(node); + } + + public void accept(XPath2ElementVisitor visitor) { + visitor.visitXPath2Element(this); + } + + @Override + public final void accept(XPathElementVisitor visitor) { + if (visitor instanceof XPath2ElementVisitor) { + accept((XPath2ElementVisitor)visitor); + } else { + super.accept(visitor); + } + } +} \ No newline at end of file diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPath2ForImpl.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPath2ForImpl.java index a330078f59de..b24491d55f88 100644 --- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPath2ForImpl.java +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPath2ForImpl.java @@ -18,12 +18,13 @@ package org.intellij.lang.xpath.psi.impl; import com.intellij.lang.ASTNode; import com.intellij.psi.util.PsiTreeUtil; import org.intellij.lang.xpath.XPath2ElementTypes; +import org.intellij.lang.xpath.psi.XPath2ElementVisitor; import org.intellij.lang.xpath.psi.XPath2For; import org.intellij.lang.xpath.psi.XPathExpression; import org.intellij.lang.xpath.psi.XPathType; import org.jetbrains.annotations.NotNull; -public class XPath2ForImpl extends XPath2VariableDeclarationImpl implements XPath2For { +public class XPath2ForImpl extends XPath2VariableDeclarationImpl implements XPath2For { public XPath2ForImpl(ASTNode node) { super(node); } @@ -39,4 +40,8 @@ public class XPath2ForImpl extends XPath2VariableDeclarationImpl implements XPa final ASTNode node = getNode().findChildByType(XPath2ElementTypes.BODY); return node != null ? PsiTreeUtil.findChildOfType(node.getPsi(), XPathExpression.class) : null; } + + public void accept(XPath2ElementVisitor visitor) { + visitor.visitXPath2For(this); + } } \ No newline at end of file diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPath2IfImpl.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPath2IfImpl.java index 638e2984d709..3983b3239d7c 100644 --- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPath2IfImpl.java +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPath2IfImpl.java @@ -16,12 +16,13 @@ package org.intellij.lang.xpath.psi.impl; import com.intellij.lang.ASTNode; +import org.intellij.lang.xpath.psi.XPath2ElementVisitor; import org.intellij.lang.xpath.psi.XPath2If; import org.intellij.lang.xpath.psi.XPathExpression; import org.intellij.lang.xpath.psi.XPathType; import org.jetbrains.annotations.NotNull; -public class XPath2IfImpl extends XPathElementImpl implements XPath2If { +public class XPath2IfImpl extends XPath2ElementImpl implements XPath2If { public XPath2IfImpl(ASTNode node) { super(node); } @@ -48,4 +49,8 @@ public class XPath2IfImpl extends XPathElementImpl implements XPath2If { public XPathExpression getElseBranch() { return null; } + + public void accept(XPath2ElementVisitor visitor) { + visitor.visitXPath2If(this); + } } \ No newline at end of file diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPath2InstanceOfImpl.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPath2InstanceOfImpl.java index 97a3b52ba8d5..19b6d751f79c 100644 --- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPath2InstanceOfImpl.java +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPath2InstanceOfImpl.java @@ -20,7 +20,7 @@ import org.intellij.lang.xpath.psi.*; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -public class XPath2InstanceOfImpl extends XPathElementImpl implements XPath2InstanceOf { +public class XPath2InstanceOfImpl extends XPath2ElementImpl implements XPath2InstanceOf { public XPath2InstanceOfImpl(ASTNode node) { super(node); } @@ -37,4 +37,8 @@ public class XPath2InstanceOfImpl extends XPathElementImpl implements XPath2Inst public XPathType getType() { return XPath2Type.BOOLEAN; } + + public void accept(XPath2ElementVisitor visitor) { + visitor.visitXPath2InstanceOf(this); + } } \ No newline at end of file diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPath2QuantifiedExprImpl.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPath2QuantifiedExprImpl.java index ba92fffbf934..17ee00823d00 100644 --- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPath2QuantifiedExprImpl.java +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPath2QuantifiedExprImpl.java @@ -18,6 +18,7 @@ package org.intellij.lang.xpath.psi.impl; import com.intellij.lang.ASTNode; import com.intellij.psi.util.PsiTreeUtil; import org.intellij.lang.xpath.XPath2ElementTypes; +import org.intellij.lang.xpath.psi.XPath2ElementVisitor; import org.intellij.lang.xpath.psi.XPath2QuantifiedExpr; import org.intellij.lang.xpath.psi.XPathExpression; import org.intellij.lang.xpath.psi.XPathType; @@ -38,4 +39,8 @@ public class XPath2QuantifiedExprImpl extends XPath2VariableDeclarationImpl impl final ASTNode node = getNode().findChildByType(XPath2ElementTypes.BODY); return node != null ? PsiTreeUtil.findChildOfType(node.getPsi(), XPathExpression.class) : null; } + + public void accept(XPath2ElementVisitor visitor) { + visitor.visitXPath2QuantifiedExpr(this); + } } \ No newline at end of file diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPath2RangeExpressionImpl.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPath2RangeExpressionImpl.java index a1e01083dc33..007dd09f8d06 100644 --- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPath2RangeExpressionImpl.java +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPath2RangeExpressionImpl.java @@ -19,7 +19,7 @@ import com.intellij.lang.ASTNode; import org.intellij.lang.xpath.psi.*; import org.jetbrains.annotations.NotNull; -public class XPath2RangeExpressionImpl extends XPathElementImpl implements XPath2RangeExpression { +public class XPath2RangeExpressionImpl extends XPath2ElementImpl implements XPath2RangeExpression { public XPath2RangeExpressionImpl(ASTNode node) { super(node); } @@ -41,4 +41,8 @@ public class XPath2RangeExpressionImpl extends XPathElementImpl implements XPath public XPathType getType() { return XPath2SequenceType.create(XPath2Type.INTEGER, XPath2SequenceType.Cardinality.ZERO_OR_MORE); } + + public void accept(XPath2ElementVisitor visitor) { + visitor.visitXPath2RangeExpression(this); + } } \ No newline at end of file diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPath2SequenceImpl.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPath2SequenceImpl.java index 852fecc2dd54..ea0a041e9137 100644 --- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPath2SequenceImpl.java +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPath2SequenceImpl.java @@ -16,13 +16,10 @@ package org.intellij.lang.xpath.psi.impl; import com.intellij.lang.ASTNode; -import org.intellij.lang.xpath.psi.XPath2Sequence; -import org.intellij.lang.xpath.psi.XPath2Type; -import org.intellij.lang.xpath.psi.XPathExpression; -import org.intellij.lang.xpath.psi.XPathType; +import org.intellij.lang.xpath.psi.*; import org.jetbrains.annotations.NotNull; -public class XPath2SequenceImpl extends XPathElementImpl implements XPath2Sequence { +public class XPath2SequenceImpl extends XPath2ElementImpl implements XPath2Sequence { public XPath2SequenceImpl(ASTNode node) { super(node); } @@ -38,4 +35,8 @@ public class XPath2SequenceImpl extends XPathElementImpl implements XPath2Sequen public XPathType getType() { return XPath2Type.SEQUENCE; } + + public void accept(XPath2ElementVisitor visitor) { + visitor.visitXPath2Sequence(this); + } } \ No newline at end of file diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPath2TreatAsImpl.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPath2TreatAsImpl.java index f527b90a9e99..6e3287f7cd18 100644 --- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPath2TreatAsImpl.java +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPath2TreatAsImpl.java @@ -16,12 +16,13 @@ package org.intellij.lang.xpath.psi.impl; import com.intellij.lang.ASTNode; +import org.intellij.lang.xpath.psi.XPath2ElementVisitor; import org.intellij.lang.xpath.psi.XPath2TreatAs; import org.intellij.lang.xpath.psi.XPath2TypeElement; import org.intellij.lang.xpath.psi.XPathType; import org.jetbrains.annotations.NotNull; -public class XPath2TreatAsImpl extends XPathElementImpl implements XPath2TreatAs { +public class XPath2TreatAsImpl extends XPath2ElementImpl implements XPath2TreatAs { public XPath2TreatAsImpl(ASTNode node) { super(node); } @@ -37,4 +38,8 @@ public class XPath2TreatAsImpl extends XPathElementImpl implements XPath2TreatAs final XPath2TypeElement node = findChildByClass(XPath2TypeElement.class); return node != null ? node.getDeclaredType() : XPathType.UNKNOWN; } + + public void accept(XPath2ElementVisitor visitor) { + visitor.visitXPath2TreatAs(this); + } } \ No newline at end of file diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPath2TypeElementImpl.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPath2TypeElementImpl.java index dd0991f5e1c3..ee747576ee37 100644 --- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPath2TypeElementImpl.java +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPath2TypeElementImpl.java @@ -19,15 +19,12 @@ import com.intellij.lang.ASTNode; import com.intellij.psi.PsiReference; import com.intellij.psi.tree.TokenSet; import org.intellij.lang.xpath.XPathTokenTypes; -import org.intellij.lang.xpath.psi.PrefixedName; -import org.intellij.lang.xpath.psi.XPath2Type; -import org.intellij.lang.xpath.psi.XPath2TypeElement; -import org.intellij.lang.xpath.psi.XPathType; +import org.intellij.lang.xpath.psi.*; import org.jetbrains.annotations.NotNull; import javax.xml.namespace.QName; -public class XPath2TypeElementImpl extends XPathElementImpl implements XPath2TypeElement { +public class XPath2TypeElementImpl extends XPath2ElementImpl implements XPath2TypeElement { public XPath2TypeElementImpl(ASTNode node) { super(node); } @@ -83,4 +80,8 @@ public class XPath2TypeElementImpl extends XPathElementImpl implements XPath2Typ } return super.getReferences(); } + + public void accept(XPath2ElementVisitor visitor) { + visitor.visitXPath2TypeElement(this); + } } \ No newline at end of file diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPath2VariableDeclarationImpl.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPath2VariableDeclarationImpl.java index 5d531dcac214..03e84e5cec8c 100644 --- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPath2VariableDeclarationImpl.java +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPath2VariableDeclarationImpl.java @@ -19,6 +19,7 @@ import com.intellij.lang.ASTNode; import com.intellij.psi.PsiElement; import com.intellij.psi.util.PsiTreeUtil; import org.intellij.lang.xpath.XPath2ElementTypes; +import org.intellij.lang.xpath.psi.XPath2ElementVisitor; import org.intellij.lang.xpath.psi.XPathExpression; import org.intellij.lang.xpath.psi.XPathVariable; import org.intellij.lang.xpath.psi.XPathVariableDeclaration; @@ -31,7 +32,7 @@ import java.util.List; * User: sweinreuter * Date: 10.01.11 */ -public class XPath2VariableDeclarationImpl extends XPathElementImpl implements XPathVariableDeclaration { +public class XPath2VariableDeclarationImpl extends XPath2ElementImpl implements XPathVariableDeclaration { public XPath2VariableDeclarationImpl(ASTNode node) { super(node); } @@ -61,4 +62,8 @@ public class XPath2VariableDeclarationImpl extends XPathElementImpl implements X } return null; } + + public void accept(XPath2ElementVisitor visitor) { + visitor.visitXPathVariableDeclaration(this); + } } \ No newline at end of file diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPath2VariableImpl.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPath2VariableImpl.java index 8e547d10441b..5ec7af5038ad 100644 --- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPath2VariableImpl.java +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPath2VariableImpl.java @@ -53,4 +53,8 @@ public class XPath2VariableImpl extends XPathElementImpl implements XPathVariabl public PsiElement setName(@NonNls @NotNull String name) throws IncorrectOperationException { return replace(XPathChangeUtil.createVariableReference(this, name)); } + + public void accept(XPathElementVisitor visitor) { + visitor.visitXPathVariable(this); + } } \ No newline at end of file diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathAxisSpecifierImpl.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathAxisSpecifierImpl.java index c54c7a8b5ae3..32080906a609 100644 --- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathAxisSpecifierImpl.java +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathAxisSpecifierImpl.java @@ -15,6 +15,7 @@ */ package org.intellij.lang.xpath.psi.impl; +import org.intellij.lang.xpath.psi.XPathElementVisitor; import org.intellij.lang.xpath.psi.XPathAxisSpecifier; import org.intellij.lang.xpath.psi.Axis; import org.intellij.lang.xpath.XPathTokenTypes; @@ -43,4 +44,8 @@ public class XPathAxisSpecifierImpl extends XPathElementImpl implements XPathAxi final boolean b = node.getChildren(XPathTokenTypes.AXIS).length == 0; return b && node.findChildByType(XPathTokenTypes.AT) == null; } + + public void accept(XPathElementVisitor visitor) { + visitor.visitXPathAxisSpecifier(this); + } } \ No newline at end of file diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathBinaryExpressionImpl.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathBinaryExpressionImpl.java index e22f730f654c..675d34434f3c 100644 --- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathBinaryExpressionImpl.java +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathBinaryExpressionImpl.java @@ -18,10 +18,7 @@ package org.intellij.lang.xpath.psi.impl; import com.intellij.lang.ASTNode; import com.intellij.psi.tree.TokenSet; import org.intellij.lang.xpath.*; -import org.intellij.lang.xpath.psi.XPath2Type; -import org.intellij.lang.xpath.psi.XPathBinaryExpression; -import org.intellij.lang.xpath.psi.XPathExpression; -import org.intellij.lang.xpath.psi.XPathType; +import org.intellij.lang.xpath.psi.*; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -55,6 +52,13 @@ public class XPathBinaryExpressionImpl extends XPathElementImpl implements XPath return elementType; } + @NotNull + @Override + public String getOperationSign() { + final ASTNode[] nodes = getNode().getChildren(BINARY_OPERATIONS); + return nodes[0].getText(); + } + @NotNull public XPathType getType() { final XPathElementType operator = getOperator(); @@ -132,4 +136,8 @@ public class XPathBinaryExpressionImpl extends XPathElementImpl implements XPath private static boolean is(XPathExpression op, XPathType type) { return op != null && (type instanceof XPath2Type ? type.isAssignableFrom(op.getType()) : type == op.getType()); } + + public void accept(XPathElementVisitor visitor) { + visitor.visitXPathBinaryExpression(this); + } } \ No newline at end of file diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathChangeUtil.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathChangeUtil.java index 59bbc79bcc3c..807ec85c9389 100644 --- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathChangeUtil.java +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathChangeUtil.java @@ -16,18 +16,17 @@ package org.intellij.lang.xpath.psi.impl; +import com.intellij.openapi.fileTypes.FileType; import com.intellij.openapi.project.Project; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFileFactory; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.util.LocalTimeCounter; -import org.jetbrains.annotations.NotNull; - import org.intellij.lang.xpath.XPathFile; -import org.intellij.lang.xpath.XPathFileType; import org.intellij.lang.xpath.context.ContextProvider; import org.intellij.lang.xpath.psi.XPathExpression; import org.intellij.lang.xpath.psi.XPathVariableReference; +import org.jetbrains.annotations.NotNull; public class XPathChangeUtil { private XPathChangeUtil() { @@ -48,13 +47,13 @@ public class XPathChangeUtil { @NotNull public static XPathFile createXPathFile(PsiElement context, String text) { - final XPathFile file = createXPathFile(context.getProject(), text); + final XPathFile file = createXPathFile(context.getProject(), text, context.getContainingFile().getFileType()); ContextProvider.copy(context.getContainingFile(), file); return file; } @NotNull - public static XPathFile createXPathFile(Project project, String text) { - return (XPathFile)PsiFileFactory.getInstance(project).createFileFromText("dummy.xpath", XPathFileType.XPATH, text, LocalTimeCounter.currentTime(), true); + public static XPathFile createXPathFile(Project project, String text, FileType fileType) { + return (XPathFile)PsiFileFactory.getInstance(project).createFileFromText("dummy." + fileType.getDefaultExtension(), fileType, text, LocalTimeCounter.currentTime(), true); } } diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathElementImpl.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathElementImpl.java index 5f541795c266..96c718fc5f2a 100644 --- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathElementImpl.java +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathElementImpl.java @@ -19,6 +19,7 @@ import com.intellij.extapi.psi.ASTWrapperPsiElement; import com.intellij.lang.ASTNode; import com.intellij.openapi.util.NotNullLazyValue; import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiElementVisitor; import com.intellij.util.IncorrectOperationException; import org.intellij.lang.xpath.XPath2ElementTypes; import org.intellij.lang.xpath.XPathElementTypes; @@ -27,6 +28,7 @@ import org.intellij.lang.xpath.XPathTokenTypes; import org.intellij.lang.xpath.context.ContextProvider; import org.intellij.lang.xpath.context.XPathVersion; import org.intellij.lang.xpath.psi.XPathElement; +import org.intellij.lang.xpath.psi.XPathElementVisitor; import org.jetbrains.annotations.NotNull; public class XPathElementImpl extends ASTWrapperPsiElement implements XPathElement { @@ -125,4 +127,17 @@ public class XPathElementImpl extends ASTWrapperPsiElement implements XPathEleme public XPathVersion getXPathVersion() { return getContainingFile().getXPathVersion(); } + + @Override + public final void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof XPathElementVisitor) { + accept((XPathElementVisitor)visitor); + } else { + super.accept(visitor); + } + } + + public void accept(XPathElementVisitor visitor) { + visitor.visitXPathElement(this); + } } diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathFilterExpressionImpl.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathFilterExpressionImpl.java index e3e1c1fd61e5..edf9aa109c75 100644 --- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathFilterExpressionImpl.java +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathFilterExpressionImpl.java @@ -54,4 +54,8 @@ public class XPathFilterExpressionImpl extends XPathElementImpl implements XPath assert nodes.length == 1; return (XPathPredicate)nodes[0].getPsi(); } + + public void accept(XPathElementVisitor visitor) { + visitor.visitXPathFilterExpression(this); + } } diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathFunctionCallImpl.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathFunctionCallImpl.java index 0a24221406f3..e4ad35267384 100644 --- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathFunctionCallImpl.java +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathFunctionCallImpl.java @@ -280,6 +280,14 @@ public class XPathFunctionCallImpl extends XPathElementImpl implements XPathFunc public XPathVersion getXPathVersion() { return getElement().getXPathVersion(); } + + public void accept(XPathElementVisitor visitor) { + visitor.visitXPathFunction(this); + } } } + + public void accept(XPathElementVisitor visitor) { + visitor.visitXPathFunctionCall(this); + } } diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathLocationPathImpl.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathLocationPathImpl.java index af5f9b1e7896..391a4980570d 100644 --- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathLocationPathImpl.java +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathLocationPathImpl.java @@ -48,4 +48,8 @@ public class XPathLocationPathImpl extends XPathElementImpl implements XPathLoca final XPathExpression pathExpression = getFirstStep(); return pathExpression instanceof XPathStep && ((XPathStep)pathExpression).isAbsolute(); } + + public void accept(XPathElementVisitor visitor) { + visitor.visitXPathLocationPath(this); + } } diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathNodeTestImpl.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathNodeTestImpl.java index 17916be11749..47a83f94c4a9 100644 --- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathNodeTestImpl.java +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathNodeTestImpl.java @@ -116,4 +116,8 @@ public class XPathNodeTestImpl extends XPathElementImpl implements XPathNodeTest return EMPTY_ARRAY; } } + + public void accept(XPathElementVisitor visitor) { + visitor.visitXPathNodeTest(this); + } } diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathNodeTypeTestImpl.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathNodeTypeTestImpl.java index 63ef2c5413a1..f5c3370b0fdd 100644 --- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathNodeTypeTestImpl.java +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathNodeTypeTestImpl.java @@ -16,6 +16,7 @@ package org.intellij.lang.xpath.psi.impl; import org.intellij.lang.xpath.XPathTokenTypes; +import org.intellij.lang.xpath.psi.XPathElementVisitor; import org.intellij.lang.xpath.psi.NodeType; import org.intellij.lang.xpath.psi.XPathNodeTypeTest; import org.intellij.lang.xpath.psi.XPathType; @@ -47,4 +48,8 @@ public class XPathNodeTypeTestImpl extends XPathFunctionCallImpl implements XPat protected ASTNode getNameNode() { return getNode().findChildByType(XPathTokenTypes.NODE_TYPE); } + + public void accept(final XPathElementVisitor visitor) { + visitor.visitXPathNodeTypeTest(this); + } } diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathNumberImpl.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathNumberImpl.java index 300dde29b9f8..53ecd61ae94d 100644 --- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathNumberImpl.java +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathNumberImpl.java @@ -17,6 +17,7 @@ package org.intellij.lang.xpath.psi.impl; import com.intellij.lang.ASTNode; import org.intellij.lang.xpath.context.XPathVersion; +import org.intellij.lang.xpath.psi.XPathElementVisitor; import org.intellij.lang.xpath.psi.XPath2Type; import org.intellij.lang.xpath.psi.XPathNumber; import org.intellij.lang.xpath.psi.XPathType; @@ -36,4 +37,8 @@ public class XPathNumberImpl extends XPathElementImpl implements XPathNumber { public double getValue() { return Double.parseDouble(getText()); } + + public void accept(XPathElementVisitor visitor) { + visitor.visitXPathNumber(this); + } } \ No newline at end of file diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathParenthesizedExpressionImpl.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathParenthesizedExpressionImpl.java index df4f93679aa5..adeb914c832c 100644 --- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathParenthesizedExpressionImpl.java +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathParenthesizedExpressionImpl.java @@ -17,6 +17,7 @@ package org.intellij.lang.xpath.psi.impl; import com.intellij.lang.ASTNode; import org.intellij.lang.xpath.XPath2ElementTypes; +import org.intellij.lang.xpath.psi.XPathElementVisitor; import org.intellij.lang.xpath.psi.XPathExpression; import org.intellij.lang.xpath.psi.XPathParenthesizedExpression; import org.intellij.lang.xpath.psi.XPathType; @@ -39,4 +40,8 @@ public class XPathParenthesizedExpressionImpl extends XPathElementImpl implement final ASTNode[] nodes = getNode().getChildren(XPath2ElementTypes.EXPRESSIONS); return (XPathExpression)(nodes.length > 0 ? nodes[0].getPsi() : null); } + + public void accept(XPathElementVisitor visitor) { + visitor.visitXPathParenthesizedExpression(this); + } } \ No newline at end of file diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathPredicateImpl.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathPredicateImpl.java index 079803954fd9..ea02ae45b569 100644 --- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathPredicateImpl.java +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathPredicateImpl.java @@ -17,6 +17,7 @@ package org.intellij.lang.xpath.psi.impl; import com.intellij.lang.ASTNode; import org.intellij.lang.xpath.XPath2ElementTypes; +import org.intellij.lang.xpath.psi.XPathElementVisitor; import org.intellij.lang.xpath.psi.XPathExpression; import org.intellij.lang.xpath.psi.XPathPredicate; import org.jetbrains.annotations.Nullable; @@ -31,4 +32,8 @@ public class XPathPredicateImpl extends XPathElementImpl implements XPathPredica final ASTNode[] nodes = getNode().getChildren(XPath2ElementTypes.EXPRESSIONS); return (XPathExpression)(nodes.length > 0 ? nodes[0].getPsi() : null); } + + public void accept(XPathElementVisitor visitor) { + visitor.visitXPathPredicate(this); + } } diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathPrefixExpressionImpl.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathPrefixExpressionImpl.java index 213bb4632d94..30b1047c0261 100644 --- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathPrefixExpressionImpl.java +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathPrefixExpressionImpl.java @@ -19,6 +19,7 @@ import com.intellij.lang.ASTNode; import org.intellij.lang.xpath.XPath2ElementTypes; import org.intellij.lang.xpath.XPathElementType; import org.intellij.lang.xpath.XPathTokenTypes; +import org.intellij.lang.xpath.psi.XPathElementVisitor; import org.intellij.lang.xpath.psi.XPathExpression; import org.intellij.lang.xpath.psi.XPathPrefixExpression; import org.intellij.lang.xpath.psi.XPathType; @@ -51,4 +52,8 @@ public class XPathPrefixExpressionImpl extends XPathElementImpl implements XPath assert elementType != null; return elementType; } + + public void accept(XPathElementVisitor visitor) { + visitor.visitXPathPrefixExpression(this); + } } diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathStepImpl.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathStepImpl.java index c9f33d07581c..a2e250d32de4 100644 --- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathStepImpl.java +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathStepImpl.java @@ -118,4 +118,8 @@ public class XPathStepImpl extends XPathElementImpl implements XPathStep { public boolean isAbsolute() { return getPreviousStep() == null && getNode().getChildren(XPathTokenTypes.PATH_OPS).length > 0; } + + public void accept(XPathElementVisitor visitor) { + visitor.visitXPathStep(this); + } } diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathStringImpl.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathStringImpl.java index 35d647471076..59a7fab8fbff 100644 --- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathStringImpl.java +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathStringImpl.java @@ -18,6 +18,7 @@ package org.intellij.lang.xpath.psi.impl; import com.intellij.lang.ASTNode; import com.intellij.lang.Language; import org.intellij.lang.xpath.XPath2Language; +import org.intellij.lang.xpath.psi.XPathElementVisitor; import org.intellij.lang.xpath.psi.XPathString; import org.intellij.lang.xpath.psi.XPathType; import org.jetbrains.annotations.NotNull; @@ -60,4 +61,8 @@ public class XPathStringImpl extends XPathElementImpl implements XPathString { } return value; } + + public void accept(XPathElementVisitor visitor) { + visitor.visitXPathString(this); + } } \ No newline at end of file diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathTokenImpl.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathTokenImpl.java index f7b0db8e527a..7c7cf7eb0078 100644 --- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathTokenImpl.java +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathTokenImpl.java @@ -17,6 +17,7 @@ package org.intellij.lang.xpath.psi.impl; import com.intellij.lang.ASTNode; import com.intellij.psi.tree.IElementType; +import org.intellij.lang.xpath.psi.XPathElementVisitor; import org.intellij.lang.xpath.psi.XPathToken; public class XPathTokenImpl extends XPathElementImpl implements XPathToken { @@ -27,4 +28,8 @@ public class XPathTokenImpl extends XPathElementImpl implements XPathToken { public IElementType getTokenType() { return getNode().getElementType(); } + + public void accept(XPathElementVisitor visitor) { + visitor.visitXPathToken(this); + } } diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathVariableReferenceImpl.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathVariableReferenceImpl.java index eaa2bffe840f..fe346abb8eb5 100644 --- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathVariableReferenceImpl.java +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathVariableReferenceImpl.java @@ -159,4 +159,8 @@ public class XPathVariableReferenceImpl extends XPathElementImpl implements XPat public boolean equals(Object obj) { return obj == this; } + + public void accept(XPathElementVisitor visitor) { + visitor.visitXPathVariableReference(this); + } } diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/psi/impl/XsltElementImpl.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/psi/impl/XsltElementImpl.java index 8989a769b9a4..193ba378db13 100644 --- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/psi/impl/XsltElementImpl.java +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/psi/impl/XsltElementImpl.java @@ -35,6 +35,8 @@ import com.intellij.util.IncorrectOperationException; import org.intellij.lang.xpath.completion.CompletionLists; import org.intellij.lang.xpath.context.ContextProvider; import org.intellij.lang.xpath.context.XPathVersion; +import org.intellij.lang.xpath.psi.XPathElement; +import org.intellij.lang.xpath.psi.XPathElementVisitor; import org.intellij.lang.xpath.xslt.XsltSupport; import org.intellij.lang.xpath.xslt.psi.XsltElement; import org.intellij.lang.xpath.xslt.psi.XsltElementFactory; @@ -203,8 +205,16 @@ abstract class XsltElementImpl extends LightElement implements Iconable, Navigat return canNavigate(); } + public void accept(@NotNull XPathElementVisitor visitor) { + visitor.visitXPathElement((XPathElement)this); + } + public void accept(@NotNull PsiElementVisitor visitor) { + if (visitor instanceof XPathElementVisitor && this instanceof XPathElement) { + accept((XPathElementVisitor)visitor); + } else { myElement.accept(visitor); + } } @Override diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/psi/impl/XsltFunctionImpl.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/psi/impl/XsltFunctionImpl.java index 1dc692e2db93..7461b394f348 100644 --- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/psi/impl/XsltFunctionImpl.java +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/psi/impl/XsltFunctionImpl.java @@ -22,11 +22,11 @@ import com.intellij.psi.xml.XmlTag; import com.intellij.util.IncorrectOperationException; import com.intellij.util.NotNullFunction; import com.intellij.util.containers.ContainerUtil; -import org.intellij.lang.xpath.context.ContextProvider; import org.intellij.lang.xpath.context.functions.Function; import org.intellij.lang.xpath.context.functions.FunctionImpl; import org.intellij.lang.xpath.context.functions.Parameter; import org.intellij.lang.xpath.psi.XPath2Type; +import org.intellij.lang.xpath.psi.XPathElementVisitor; import org.intellij.lang.xpath.psi.XPathType; import org.intellij.lang.xpath.xslt.XsltSupport; import org.intellij.lang.xpath.xslt.psi.XsltFunction; @@ -130,4 +130,8 @@ public class XsltFunctionImpl extends XsltElementImpl implements XsltFunction, I public int getMinArity() { return getFunction().getMinArity(); } + + public void accept(@NotNull XPathElementVisitor visitor) { + visitor.visitXPathFunction(this); + } } diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/psi/impl/XsltParameterImpl.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/psi/impl/XsltParameterImpl.java index 24e9ec70bdd3..966a5186539c 100644 --- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/psi/impl/XsltParameterImpl.java +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/psi/impl/XsltParameterImpl.java @@ -15,19 +15,18 @@ */ package org.intellij.lang.xpath.xslt.psi.impl; -import org.intellij.lang.xpath.xslt.XsltSupport; -import org.intellij.lang.xpath.xslt.impl.XsltIncludeIndex; -import org.intellij.lang.xpath.xslt.psi.XsltElementFactory; -import org.intellij.lang.xpath.xslt.psi.XsltParameter; -import org.intellij.lang.xpath.xslt.psi.XsltTemplate; -import org.intellij.lang.xpath.xslt.util.XsltCodeInsightUtil; - import com.intellij.psi.search.LocalSearchScope; import com.intellij.psi.search.SearchScope; import com.intellij.psi.xml.XmlFile; import com.intellij.psi.xml.XmlTag; import com.intellij.util.CommonProcessors; import com.intellij.util.Icons; +import org.intellij.lang.xpath.xslt.XsltSupport; +import org.intellij.lang.xpath.xslt.impl.XsltIncludeIndex; +import org.intellij.lang.xpath.xslt.psi.XsltElementFactory; +import org.intellij.lang.xpath.xslt.psi.XsltParameter; +import org.intellij.lang.xpath.xslt.psi.XsltTemplate; +import org.intellij.lang.xpath.xslt.util.XsltCodeInsightUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/psi/impl/XsltVariableImpl.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/psi/impl/XsltVariableImpl.java index e06b1259ccb1..70b32631a472 100644 --- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/psi/impl/XsltVariableImpl.java +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/psi/impl/XsltVariableImpl.java @@ -20,6 +20,7 @@ import com.intellij.psi.search.SearchScope; import com.intellij.psi.xml.XmlAttribute; import com.intellij.psi.xml.XmlTag; import com.intellij.util.Icons; +import org.intellij.lang.xpath.psi.XPathElementVisitor; import org.intellij.lang.xpath.psi.XPathExpression; import org.intellij.lang.xpath.psi.XPathType; import org.intellij.lang.xpath.psi.XPathVariableReference; @@ -95,4 +96,8 @@ public class XsltVariableImpl extends XsltElementImpl implements XsltVariable { final String name = getName(); return name != null && "type:void".equals(QNameUtil.createQName(name, getTag()).getNamespaceURI()); } + + public void accept(@NotNull XPathElementVisitor visitor) { + visitor.visitXPathVariable(this); + } }