1 12 package org.eclipse.debug.internal.ui.views.memory.renderings; 13 14 import java.math.BigInteger ; 15 16 import org.eclipse.debug.core.model.MemoryByte; 17 import org.eclipse.debug.internal.ui.DebugUIPlugin; 18 import org.eclipse.debug.internal.ui.memory.provisional.AbstractAsyncTableRendering; 19 import org.eclipse.debug.ui.IDebugUIConstants; 20 21 24 public class HexRendering extends AbstractAsyncTableRendering { 25 26 public HexRendering(String renderingId) 27 { 28 super(renderingId); 29 } 30 31 34 public String getString(String dataType, BigInteger address, 35 MemoryByte[] data) { 36 StringBuffer strBuffer = new StringBuffer (); 37 38 String paddedStr = DebugUIPlugin.getDefault().getPreferenceStore().getString(IDebugUIConstants.PREF_PADDED_STR); 39 40 for (int i=0; i<data.length; i++) 41 { 42 if (data[i].isReadable()) 43 { 44 strBuffer.append(new String (RenderingsUtil.convertByteToCharArray(data[i].getValue()))); 45 } 46 else 47 { 48 strBuffer.append(paddedStr); 50 } 51 } 52 53 return strBuffer.toString().toUpperCase(); 54 } 55 56 59 public byte[] getBytes(String dataType, BigInteger address, 60 MemoryByte[] currentValues, String data) { 61 byte[] bytes = RenderingsUtil.convertHexStringToByteArray(data, currentValues.length, getNumCharsPerByte()); 62 63 return bytes; 64 } 65 66 public int getNumCharsPerByte() 67 { 68 return 2; 69 } 70 71 } 72 | Popular Tags |