1 11 package org.eclipse.debug.internal.ui.views.memory.renderings; 12 13 import java.math.BigInteger ; 14 15 import org.eclipse.debug.internal.ui.DebugUIPlugin; 16 import org.eclipse.debug.ui.IDebugUIConstants; 17 import org.eclipse.debug.ui.memory.AbstractTableRendering; 18 import org.eclipse.debug.ui.memory.IMemoryBlockTablePresentation; 19 import org.eclipse.jface.viewers.IColorProvider; 20 import org.eclipse.swt.graphics.Color; 21 22 25 public class TableRenderingLabelProvider extends AbstractTableRenderingLabelProvider implements IColorProvider { 26 27 private IMemoryBlockTablePresentation fTablePresentation; 28 29 32 public TableRenderingLabelProvider() { 33 super(); 34 } 35 36 public TableRenderingLabelProvider(AbstractTableRendering rendering){ 37 super(rendering); 38 fTablePresentation = (IMemoryBlockTablePresentation)rendering.getAdapter(IMemoryBlockTablePresentation.class); 39 } 40 41 42 45 public void dispose() { 46 if (fTablePresentation != null) { 47 fTablePresentation.dispose(); 48 fTablePresentation = null; 49 } 50 super.dispose(); 51 } 52 53 56 public Color getForeground(Object element) { 57 if (element instanceof TableRenderingLine) 58 { 59 TableRenderingLine line = (TableRenderingLine)element; 60 61 if (line.isMonitored) { 62 return DebugUIPlugin.getPreferenceColor(IDebugUIConstants.PREF_MEMORY_HISTORY_KNOWN_COLOR); 63 } 64 return DebugUIPlugin.getPreferenceColor(IDebugUIConstants.PREF_MEMORY_HISTORY_UNKNOWN_COLOR); 65 } 66 return DebugUIPlugin.getPreferenceColor(IDebugUIConstants.PREF_MEMORY_HISTORY_KNOWN_COLOR); 67 } 68 69 72 public Color getBackground(Object element) { 73 74 return null; 75 } 76 77 80 public String getColumnText(Object element, int columnIndex) { 81 82 String label = super.getColumnText(element, columnIndex); 83 84 if (columnIndex == 0) 86 { 87 if (fTablePresentation != null) 88 { 89 String address = ((TableRenderingLine)element).getAddress(); 90 91 String tempLabel = fTablePresentation.getRowLabel(fRendering.getMemoryBlock(), new BigInteger (address, 16)); 93 94 if (tempLabel != null) 95 return tempLabel; 96 } 97 return label; 98 } 99 return label; 100 } 101 } 102 | Popular Tags |