1 22 package org.aspectj.debugger.gui; 23 24 import com.sun.jdi.*; 25 import java.util.*; 26 27 public class NonAJCMethodHelper implements MethodHelper { 28 29 private Method method; 30 31 public NonAJCMethodHelper(Method method) { 32 this.method = method; 33 } 34 35 public String getRealName() { 36 return method.name(); 37 } 38 39 public String getDisplayName() { 40 return getRealName() + args(); 41 } 42 43 public String getToolTipText() { 44 return longName(); 45 } 46 47 public String getClassName() { 48 return method.declaringType().name(); 49 } 50 51 private String longName() { 52 return accessString() 53 + " " + modsString() 54 + " " + method.returnTypeName() 55 + " " + method.name() + args(); 56 } 57 58 private String modsString() { 59 return (method.isAbstract() ? " abstract" : "") 60 + (method.isFinal() ? " final" : "") 61 + (method.isNative() ? " native" : "") 62 + (method.isSynchronized() ? " synchronized" : ""); 63 } 64 65 private String accessString() { 66 if (method.isPublic()) return "public"; 67 if (method.isProtected()) return "protected"; 68 if (method.isPrivate()) return "private"; 69 return ""; 70 } 71 72 private String args() { 73 String str = "("; 74 List names = method.argumentTypeNames(); 75 if (names != null && names.size() > 0) { 76 Iterator iter = names.iterator(); 77 while (iter.hasNext()) { 78 str += iter.next() + (iter.hasNext() ? "," : ""); 79 } 80 } 81 str += ")"; 82 return str; 83 } 84 85 public String getRelativePath() { 86 return SourceNameFactory.sourceName(method.declaringType()); 87 } 88 89 public int getLine() { 90 Location loc = method.location(); 91 return loc != null ? loc.lineNumber() : -1; 92 } 93 94 public String getBreakpoint() { 95 return method.declaringType().name() + "." + method.name() + args(); 96 } 97 98 public int getType() { 99 return MethodNode.getType(method.isConstructor(), 100 method.isStatic(), 101 method.isPublic(), 102 method.isPrivate(), 103 method.isProtected()); 104 } 105 } 106 | Popular Tags |