1 package org.netbeans.modules.ruby.elements; 2 3 import java.util.Set ; 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 fqn; 12 13 public AstModuleElement(Node node) { 14 super(node); 15 } 16 17 @Override 18 public String 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 40 public ElementKind getKind() { 41 return ElementKind.MODULE; 42 } 43 44 public String getFqn() { 45 if (fqn == null) { 46 return getName(); 47 } 48 return fqn; 49 } 50 51 public void setFqn(String fqn) { 52 this.fqn = fqn; 53 } 54 55 public Set <String > getIncludes() { 56 throw new UnsupportedOperationException ("Not supported yet."); 57 }} 58 | Popular Tags |