1 11 package org.eclipse.debug.internal.ui.views.memory.renderings; 12 13 import org.eclipse.debug.core.model.IMemoryBlock; 14 import org.eclipse.debug.core.model.IMemoryBlockExtension; 15 import org.eclipse.debug.core.model.MemoryByte; 16 import org.eclipse.debug.internal.ui.memory.provisional.AbstractAsyncTableRendering; 17 import org.eclipse.debug.ui.memory.IMemoryRenderingContainer; 18 19 24 public abstract class AbstractIntegerRendering extends AbstractAsyncTableRendering { 25 26 private int fDisplayEndianess = RenderingsUtil.ENDIANESS_UNKNOWN; 27 28 public AbstractIntegerRendering(String renderingId){ 29 super(renderingId); 30 } 31 32 public void init(IMemoryRenderingContainer container, IMemoryBlock block) { 33 super.init(container, block); 34 35 if (!(block instanceof IMemoryBlockExtension)) 37 fDisplayEndianess = RenderingsUtil.BIG_ENDIAN; 38 } 39 40 43 public int getDisplayEndianess() { 44 return fDisplayEndianess; 45 } 46 47 50 public void setDisplayEndianess(int currentEndianess) { 51 fDisplayEndianess = currentEndianess; 52 } 53 54 protected int getBytesEndianess(MemoryByte[] data) { 55 int endianess = RenderingsUtil.ENDIANESS_UNKNOWN; 56 57 if (!data[0].isEndianessKnown()) 58 return endianess; 59 60 if (data[0].isBigEndian()) 61 endianess = RenderingsUtil.BIG_ENDIAN; 62 else 63 endianess = RenderingsUtil.LITTLE_ENDIAN; 64 for (int i=1; i<data.length; i++) 65 { 66 if (!data[i].isEndianessKnown()) 68 return RenderingsUtil.ENDIANESS_UNKNOWN; 69 70 int byteEndianess = data[i].isBigEndian()?RenderingsUtil.BIG_ENDIAN:RenderingsUtil.LITTLE_ENDIAN; 71 if (byteEndianess != endianess) 72 { 73 endianess = RenderingsUtil.ENDIANESS_UNKNOWN; 74 break; 75 } 76 } 77 return endianess; 78 } 79 } 80 | Popular Tags |