1 24 package org.aspectj.debugger.gui; 25 26 import org.aspectj.tools.ide.*; 27 import java.util.*; 28 29 public class AJCMethodHelper implements MethodHelper { 30 31 private Declaration dec; 32 33 public AJCMethodHelper(Declaration dec) { 34 this.dec = dec; 35 } 36 37 public String getRealName() { 38 return dec.getSignature(); 39 } 40 41 public String getDisplayName() { 42 return getRealName(); 43 } 44 45 public String getToolTipText() { 46 return dec.getFullSignature(); 47 } 48 49 public String getClassName() { 50 return dec.getDeclaringType(); 51 } 52 53 public String getRelativePath() { 54 return dec.getFilename(); 55 } 56 57 public int getLine() { 58 return dec.getBeginLine(); 59 } 60 61 public String getBreakpoint() { 62 return getPackagePrefix() + dec.getDeclaringType() + "." + breakpointSignature(); 63 } 64 65 private String getPackagePrefix() { 66 String packageName = dec.getPackageName(); 67 if (packageName == null || 68 packageName.equals("")) { 69 return ""; 70 } 71 return packageName + "."; 72 } 73 74 public Declaration getDec() { 75 return dec; 76 } 77 78 private String breakpointSignature() { 79 return dec.getSignature(); 80 } 81 82 private int type = Integer.MIN_VALUE; 83 public int getType() { 84 return (type >= 0) ? type : (type = _getType()); 85 } 86 public int _getType() { 87 StringTokenizer tok = new StringTokenizer(dec.getFullSignature()); 88 boolean isStatic = false; 89 boolean isPublic = false; 90 boolean isPrivate = false; 91 boolean isProtected = false; 92 boolean isInit = false; 93 boolean isCtr = false; 94 if (getRealName().startsWith("new(") || getRealName().equals("<init>")) { 95 isCtr = true; 96 } 97 while (tok.hasMoreTokens()) { 98 String token = tok.nextToken(); 99 if (token.indexOf("(") != -1) break; 100 if (token.equals("static")) isStatic = true; 101 if (token.equals("public")) isPublic = true; 102 if (token.equals("protected")) isProtected = true; 103 if (token.equals("private")) isPrivate = true; 104 } 105 return MethodNode.getType(isCtr, isStatic, isPublic, isPrivate, isProtected); 106 } 107 } 108 | Popular Tags |