1 11 package org.eclipse.debug.internal.ui.views.memory.renderings; 12 13 import org.eclipse.debug.core.model.IMemoryBlockExtension; 14 import org.eclipse.jface.action.IAction; 15 import org.eclipse.jface.viewers.ISelection; 16 import org.eclipse.jface.viewers.IStructuredSelection; 17 import org.eclipse.ui.IObjectActionDelegate; 18 import org.eclipse.ui.IWorkbenchPart; 19 20 27 public class DefaultEndianessAction implements IObjectActionDelegate { 28 29 AbstractIntegerRendering fRendering; 30 public DefaultEndianessAction() { 31 super(); 32 } 33 34 public void setActivePart(IAction action, IWorkbenchPart targetPart) { 35 } 36 37 public void run(IAction action) { 38 if (fRendering != null) 39 { 40 if (fRendering.getMemoryBlock() instanceof IMemoryBlockExtension) 41 { 42 fRendering.setDisplayEndianess(RenderingsUtil.ENDIANESS_UNKNOWN); 43 } 44 else 45 { 46 fRendering.setDisplayEndianess(RenderingsUtil.BIG_ENDIAN); 47 } 48 fRendering.refresh(); 49 } 50 51 } 52 53 public void selectionChanged(IAction action, ISelection selection) { 54 if (selection == null) 55 return; 56 57 if (selection instanceof IStructuredSelection) 58 { 59 Object obj = ((IStructuredSelection)selection).getFirstElement(); 60 if (obj == null) 61 return; 62 63 if (obj instanceof AbstractIntegerRendering) 64 { 65 fRendering = (AbstractIntegerRendering)obj; 66 } 67 } 68 } 69 70 } 71 | Popular Tags |