diff options
Diffstat (limited to 'org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/GoToAddressAction.java')
-rw-r--r-- | org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/GoToAddressAction.java | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/GoToAddressAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/GoToAddressAction.java index bfa245303..0380b37fc 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/GoToAddressAction.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/GoToAddressAction.java @@ -39,22 +39,22 @@ import org.eclipse.ui.PlatformUI; /** * Go To Address Action for table rendering - * + * * @since 3.0 */ public class GoToAddressAction extends Action { private IMemoryRenderingContainer fContainer; private IRepositionableMemoryRendering fRendering; - + public GoToAddressAction(IMemoryRenderingContainer container, IRepositionableMemoryRendering rendering) - { + { super(DebugUIMessages.GoToAddressAction_title); fContainer = container; setToolTipText(DebugUIMessages.GoToAddressAction_title); - + fRendering = rendering; - + PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugUIConstants.PLUGIN_ID + ".GoToAddressAction_context"); //$NON-NLS-1$ } /* (non-Javadoc) @@ -64,36 +64,36 @@ public class GoToAddressAction extends Action public void run() { try - { + { Shell shell= DebugUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell(); - + // create dialog to ask for expression/address to block GoToAddressDialog dialog = new GoToAddressDialog(shell); dialog.open(); - + int returnCode = dialog.getReturnCode(); - + if (returnCode == Window.CANCEL) { return; } - + // get expression from dialog String expression = dialog.getExpression(); - + expression = parseExpression(expression); - + doGoToAddress(expression); } // open error in case of any error catch (DebugException e) { - MemoryViewUtil.openError(DebugUIMessages.GoToAddressAction_Go_to_address_failed, + MemoryViewUtil.openError(DebugUIMessages.GoToAddressAction_Go_to_address_failed, DebugUIMessages.GoToAddressAction_Go_to_address_failed, e); } catch (NumberFormatException e1) { - MemoryViewUtil.openError(DebugUIMessages.GoToAddressAction_Go_to_address_failed, + MemoryViewUtil.openError(DebugUIMessages.GoToAddressAction_Go_to_address_failed, DebugUIMessages.GoToAddressAction_Address_is_invalid, null); } } @@ -104,7 +104,7 @@ public class GoToAddressAction extends Action public String parseExpression(String expression) { expression = expression.toUpperCase(); expression = expression.trim(); - + if (expression.startsWith("0X")) //$NON-NLS-1$ { expression = expression.substring(2); @@ -118,7 +118,7 @@ public class GoToAddressAction extends Action public void doGoToAddress(String expression) throws DebugException, NumberFormatException { // convert expression to address BigInteger address = new BigInteger(expression, 16); - + // look at this address and figure out if a new memory block should // be opened. IMemoryBlock mb = fRendering.getMemoryBlock(); @@ -127,15 +127,15 @@ public class GoToAddressAction extends Action IMemoryBlockExtension mbExt = (IMemoryBlockExtension)mb; BigInteger mbStart = mbExt.getMemoryBlockStartAddress(); BigInteger mbEnd = mbExt.getMemoryBlockEndAddress(); - + if (mbStart != null) { // if trying to go beyond the start address // of the memory block if (address.compareTo(mbStart) < 0) { - IMemoryBlockRetrieval retrieval = MemoryViewUtil.getMemoryBlockRetrieval(mbExt); - + IMemoryBlockRetrieval retrieval = MemoryViewUtil.getMemoryBlockRetrieval(mbExt); + // add a new memory block and then the same rendering as fRendering // in the same container. if (retrieval != null && retrieval instanceof IMemoryBlockRetrievalExtension) @@ -152,7 +152,7 @@ public class GoToAddressAction extends Action if (address.compareTo(mbEnd) > 0) { IMemoryBlockRetrieval retrieval = MemoryViewUtil.getMemoryBlockRetrieval(mbExt); - + // add a new memory block and then the same rendering as fRendering // in the same container. if (retrieval != null && retrieval instanceof IMemoryBlockRetrievalExtension) @@ -163,34 +163,34 @@ public class GoToAddressAction extends Action } } } - + // go to specified address fRendering.goToAddress(address); } - + private void addNewMemoryBlock(String expression, IMemoryBlockRetrievalExtension retrieval) { Object elem = DebugUITools.getPartDebugContext(fContainer.getMemoryRenderingSite().getSite()); - + if (!(elem instanceof IDebugElement)) return; - + try { if (retrieval != null) - { + { IMemoryBlockExtension mbext = retrieval.getExtendedMemoryBlock(expression, elem); if (mbext != null) { IMemoryBlock[] memArray = new IMemoryBlock[]{mbext}; DebugPlugin.getDefault().getMemoryBlockManager().addMemoryBlocks(memArray); } - + IMemoryRenderingType renderingType = DebugUITools.getMemoryRenderingManager().getRenderingType(fRendering.getRenderingId()); - + if (renderingType != null) { IMemoryRendering rendering = renderingType.createRendering(); - + if (rendering != null && fRendering instanceof AbstractMemoryRendering) { rendering.init(((AbstractMemoryRendering)fRendering).getMemoryRenderingContainer(), mbext); @@ -199,11 +199,11 @@ public class GoToAddressAction extends Action } } } catch (DebugException e) { - MemoryViewUtil.openError(DebugUIMessages.GoToAddressAction_Go_to_address_failed, + MemoryViewUtil.openError(DebugUIMessages.GoToAddressAction_Go_to_address_failed, DebugUIMessages.GoToAddressAction_Go_to_address_failed, e); } catch (CoreException e) { - MemoryViewUtil.openError(DebugUIMessages.GoToAddressAction_Go_to_address_failed, + MemoryViewUtil.openError(DebugUIMessages.GoToAddressAction_Go_to_address_failed, DebugUIMessages.GoToAddressAction_Go_to_address_failed, e); } } |