1 11 12 package org.eclipse.debug.internal.ui.views.memory; 13 14 import org.eclipse.debug.internal.ui.DebugUIMessages; 15 import org.eclipse.debug.ui.IDebugUIConstants; 16 import org.eclipse.jface.action.Action; 17 import org.eclipse.ui.help.WorkbenchHelp; 18 19 20 25 public class FormatColumnAction extends Action 26 { 27 private static final String PREFIX = "FormatColumnAction."; private static final String BYTE = PREFIX + "byte"; private static final String BYTES = PREFIX + "bytes"; 31 ITableMemoryViewTab fViewTab; 32 int fNumBytesPerCol; 33 34 public FormatColumnAction(int numBytes, ITableMemoryViewTab viewTab) 35 { 36 super(); 37 38 String label; 39 if (numBytes > 1) 40 label = String.valueOf(numBytes) + " " + DebugUIMessages.getString(BYTES); else 42 label = String.valueOf(numBytes) + " " + DebugUIMessages.getString(BYTE); 44 super.setText(label); 45 46 fViewTab = viewTab; 47 48 if (numBytes == fViewTab.getColumnSize()) 50 { 51 setChecked(true); 52 } 53 54 fNumBytesPerCol = numBytes; 55 56 WorkbenchHelp.setHelp(this, IDebugUIConstants.PLUGIN_ID + ".FormatColumnAction_context"); } 58 61 public void run() 62 { 63 fViewTab.format(fViewTab.getBytesPerLine(), fNumBytesPerCol); 64 } 65 66 public int getColumnSize() 67 { 68 return fNumBytesPerCol; 69 } 70 71 } 72 | Popular Tags |