KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > ruby > elements > AstModuleElement


1 package org.netbeans.modules.ruby.elements;
2
3 import java.util.Set JavaDoc;
4 import org.jruby.ast.Colon2Node;
5 import org.jruby.ast.ModuleNode;
6 import org.jruby.ast.Node;
7 import org.netbeans.api.gsf.ElementKind;
8
9
10 public class AstModuleElement extends AstElement implements ClassElement {
11     String JavaDoc fqn;
12     
13     public AstModuleElement(Node node) {
14         super(node);
15     }
16
17     @Override JavaDoc
18     public String JavaDoc getName() {
19         if (name == null) {
20             if (node instanceof ModuleNode) {
21                 Node n = ((ModuleNode)node).getCPath();
22
23                 if (n instanceof Colon2Node) {
24                     Colon2Node c2n = (Colon2Node)n;
25                     name = c2n.getName();
26                 } else {
27                     name = n.toString();
28                 }
29             }
30
31             if (name == null) {
32                 name = node.toString();
33             }
34         }
35
36         return name;
37     }
38
39     @Override JavaDoc
40     public ElementKind getKind() {
41         return ElementKind.MODULE;
42     }
43
44     public String JavaDoc getFqn() {
45         if (fqn == null) {
46             return getName();
47         }
48         return fqn;
49     }
50     
51     public void setFqn(String JavaDoc fqn) {
52         this.fqn = fqn;
53     }
54     
55     public Set JavaDoc<String JavaDoc> getIncludes() {
56         throw new UnsupportedOperationException JavaDoc("Not supported yet.");
57     }}
58
Popular Tags