JSEmbeddedContentImpl.java

1    /* 
2     * Copyright 2000-2005 JetBrains s.r.o. 
3     * 
4     * Licensed under the Apache License, Version 2.0 (the "License"); 
5     * you may not use this file except in compliance with the License. 
6     * You may obtain a copy of the License at 
7     * 
8     * http://www.apache.org/licenses/LICENSE-2.0 
9     * 
10    * Unless required by applicable law or agreed to in writing, software 
11    * distributed under the License is distributed on an "AS IS" BASIS, 
12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
13    * See the License for the specific language governing permissions and 
14    * limitations under the License. 
15    */ 
16   package com.intellij.lang.javascript.psi.impl; 
17    
18   import com.intellij.lang.ASTNode; 
19   import com.intellij.psi.PsiElement; 
20   import com.intellij.psi.PsiSubstitutor; 
21   import com.intellij.psi.scope.PsiScopeProcessor; 
22   import com.intellij.psi.search.PsiElementProcessor; 
23   import com.intellij.psi.xml.XmlTag; 
24   import com.intellij.psi.xml.XmlTagChild; 
25    
26   /** 
27    * Created by IntelliJ IDEA. 
28    * User: max 
29    * Date: Jan 31, 2005 
30    * Time: 12:02:38 AM 
31    * To change this template use File | Settings | File Templates. 
32    */ 
33   public class JSEmbeddedContentImpl extends JSElementImpl implements XmlTagChild { 
34     public JSEmbeddedContentImpl(final ASTNode node) { 
35       super(node); 
36     } 
37    
38     public String toString() { 
39       return "JSEmbeddedContent"; 
40     } 
41    
42     public XmlTag getParentTag() { 
43       final PsiElement parent = getParent(); 
44       if(parent instanceof XmlTag) return (XmlTag)parent; 
45       return null; 
46     } 
47    
48     public XmlTagChild getNextSiblingInTag() { 
49       PsiElement nextSibling = getNextSibling(); 
50       if(nextSibling instanceof XmlTagChild) return (XmlTagChild)nextSibling; 
51       return null; 
52     } 
53    
54     public XmlTagChild getPrevSiblingInTag() { 
55       final PsiElement prevSibling = getPrevSibling(); 
56       if(prevSibling instanceof XmlTagChild) return (XmlTagChild)prevSibling; 
57       return null; 
58     } 
59    
60     public boolean processElements(PsiElementProcessor processor, PsiElement place) { 
61       // TODO 
62       return true; 
63     } 
64    
65     public boolean processDeclarations(PsiScopeProcessor processor, PsiSubstitutor substitutor, PsiElement lastParent, PsiElement place) { 
66    
67       if (lastParent == null) { 
68         PsiElement child = getFirstChild(); 
69         while (child != null) { 
70           if (!child.processDeclarations(processor, substitutor, null, place)) return false; 
71           child = child.getNextSibling(); 
72         } 
73       } 
74    
75       return true; 
76     } 
77   } 
78