1 19 package org.netbeans.modules.javacore.parser; 20 21 import org.netbeans.lib.java.parser.ASTree; 22 import org.netbeans.lib.java.parser.ASTreeTypes; 23 import org.netbeans.lib.java.parser.ParserTokens; 24 import org.netbeans.lib.java.parser.Token; 25 26 27 31 public class ASTUtil implements ASTreeTypes, ParserTokens { 32 33 private static final String [] EMPTY_STRING_ARRAY=new String [0]; 34 35 36 private ASTUtil() { 37 } 38 39 public static String getIdentifier(ASTree tree) { 40 switch (tree.getType()) { 41 case IDENTIFIER: 42 return (String ) ((Token) tree).getValue(); 43 case MULTI_PART_ID: { 44 ASTree parts[] = tree.getSubTrees(); 45 46 return getIdentifier(parts[0]).concat(".").concat(getIdentifier(parts[1])); } 48 } 49 return null; 50 } 51 } 52 | Popular Tags |