1 22 package org.aspectj.debugger.gui; 23 24 import com.sun.jdi.*; 25 26 public abstract class HexableAJValueNode extends AJValueNode implements Hexable { 27 28 private boolean isHex = false; 29 30 public HexableAJValueNode(AJValueGetter getter, int type) { 31 super(getter, type); 32 } 33 34 public abstract String getHexValue(Value value); 35 36 public void setHex(boolean isHex) { 37 this.isHex = isHex; 38 } 39 40 public boolean isHex() { 41 return isHex; 42 } 43 44 public void toggle() { 45 setHex(!isHex()); 46 ComponentRepository.getThreadGroupTreePane().getTree().reloadAll(); 47 } 48 49 public String format(Value value) { 50 return isHex() ? "0x" + pad(getHexValue(value)) : super.format(value); 51 } 52 53 private final static int HEX_LENGTH = 8; 54 private String pad(String str) { 55 int length = HEX_LENGTH - str.length(); 56 while (length-- > 0) str = "0"+ str; 57 return str; 58 } 59 60 } 61 | Popular Tags |