diff options
author | Samantha Chan | 2006-04-18 19:18:28 +0000 |
---|---|---|
committer | Samantha Chan | 2006-04-18 19:18:28 +0000 |
commit | 9e903502052fb12486e329568a542f8d82683fc1 (patch) | |
tree | 11f1dc6c83e0ee6ba2ae69e2b43ac74d731e1afa | |
parent | 1c0ae64cf51ce9badafb542e29d858966d62ab07 (diff) | |
download | eclipse.platform.debug-9e903502052fb12486e329568a542f8d82683fc1.tar.gz eclipse.platform.debug-9e903502052fb12486e329568a542f8d82683fc1.tar.xz eclipse.platform.debug-9e903502052fb12486e329568a542f8d82683fc1.zip |
Bug 128289 - [memory view] added mem block not selected in mem view tree
14 files changed, 202 insertions, 837 deletions
diff --git a/org.eclipse.debug.ui/plugin.xml b/org.eclipse.debug.ui/plugin.xml index 2b74d9c56..58a014778 100644 --- a/org.eclipse.debug.ui/plugin.xml +++ b/org.eclipse.debug.ui/plugin.xml @@ -754,7 +754,7 @@ icon="$nl$/icons/full/elcl16/pin.gif" id="org.eclipse.debug.ui.PinMemoryBlockAction" label="%PinMemoryBlockAction.label" - state="true" + state="false" style="toggle" toolbarPath="additions" tooltip="%PinMemoryBlockAction.label"/> diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/provisional/AbstractAsyncTableRendering.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/provisional/AbstractAsyncTableRendering.java index 6a5618f2b..1aa16b005 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/provisional/AbstractAsyncTableRendering.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/provisional/AbstractAsyncTableRendering.java @@ -196,6 +196,8 @@ public abstract class AbstractAsyncTableRendering extends AbstractBaseTableRende */ public static final String PROPERTY_ROW_SIZE = AbstractTableRendering.PROPERTY_ROW_SIZE; + private boolean fActivated = false; + // TODO: linux - cannot resize columns to preferred size // TODO: review use of MemorySegment, need to be careful to ensure flexible hierarchy @@ -1559,7 +1561,6 @@ public abstract class AbstractAsyncTableRendering extends AbstractBaseTableRende // This fix is a hack to delay the resize until the viewer has a chance to get // the setData event from the UI thread. Otherwise, the columns will be // squeezed together. - // TODO: test on linux UIJob job = new UIJob("resize to fit"){ //$NON-NLS-1$ public IStatus runInUIThread(IProgressMonitor monitor) { resizeColumnsToPreferredSize(); @@ -2872,7 +2873,8 @@ public abstract class AbstractAsyncTableRendering extends AbstractBaseTableRende private void hideGotoAddressComposite() { fSashForm.setMaximizedControl(fTableViewer.getControl()); - fTableViewer.getControl().setFocus(); + if (isActivated()) + fTableViewer.getControl().setFocus(); } /** @@ -2895,7 +2897,8 @@ public abstract class AbstractAsyncTableRendering extends AbstractBaseTableRende public void activated() { super.activated(); - + + fActivated = true; IWorkbench workbench = PlatformUI.getWorkbench(); ICommandService commandSupport = (ICommandService)workbench.getAdapter(ICommandService.class); IContextService contextSupport = (IContextService)workbench.getAdapter(IContextService.class); @@ -2923,6 +2926,8 @@ public abstract class AbstractAsyncTableRendering extends AbstractBaseTableRende public void deactivated() { + + fActivated = false; IWorkbench workbench = PlatformUI.getWorkbench(); ICommandService commandSupport = (ICommandService)workbench.getAdapter(ICommandService.class); IContextService contextSupport = (IContextService)workbench.getAdapter(IContextService.class); @@ -2939,6 +2944,11 @@ public abstract class AbstractAsyncTableRendering extends AbstractBaseTableRende super.deactivated(); } + private boolean isActivated() + { + return fActivated; + } + /** * Returns text for the given memory bytes at the specified address for the specified * rendering type. This is called by the label provider for. diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/MemoryRetrievalProxy.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/MemoryRetrievalProxy.java index db5bb01a1..4ec5327cd 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/MemoryRetrievalProxy.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/MemoryRetrievalProxy.java @@ -17,18 +17,14 @@ import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.IMemoryBlockListener; import org.eclipse.debug.core.model.IMemoryBlock; import org.eclipse.debug.core.model.IMemoryBlockRetrieval; -import org.eclipse.debug.internal.ui.memory.provisional.MemoryViewPresentationContext; import org.eclipse.debug.internal.ui.viewers.provisional.AbstractModelProxy; import org.eclipse.debug.internal.ui.viewers.provisional.IModelDelta; import org.eclipse.debug.internal.ui.viewers.provisional.IPresentationContext; import org.eclipse.debug.internal.ui.viewers.provisional.ModelDelta; -import org.eclipse.debug.internal.ui.views.memory.MemoryView; import org.eclipse.debug.ui.memory.IMemoryRendering; -import org.eclipse.debug.ui.memory.IMemoryRenderingSite; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.ui.IWorkbenchPart; public class MemoryRetrievalProxy extends AbstractModelProxy implements IMemoryBlockListener { private IMemoryBlockRetrieval fRetrieval; @@ -52,10 +48,8 @@ public class MemoryRetrievalProxy extends AbstractModelProxy implements IMemoryB { if (retrieval == fRetrieval) { - if (toSelect(memory[i])) - delta.addNode(memory[i], IModelDelta.ADDED | IModelDelta.SELECT); - else - delta.addNode(memory[i], IModelDelta.ADDED); + // select and take view's pinning state into account + delta.addNode(memory[i], IModelDelta.ADDED | IModelDelta.SELECT); } } } @@ -144,30 +138,4 @@ public class MemoryRetrievalProxy extends AbstractModelProxy implements IMemoryB } return false; } - - private boolean toSelect(IMemoryBlock memoryBlock) - { - // if it's the first memory block, always select - IMemoryBlock[] memoryBlocks = DebugPlugin.getDefault().getMemoryBlockManager().getMemoryBlocks(fRetrieval); - if (memoryBlocks.length == 1) - return true; - - if (getPresentationContext() instanceof MemoryViewPresentationContext) - { - // if registered, meaning the memory block is added from this view, select - MemoryViewPresentationContext context = (MemoryViewPresentationContext)getPresentationContext(); - IMemoryRenderingSite site = context.getMemoryRenderingSite(); - IWorkbenchPart part = site.getSite().getPart(); - if (part instanceof MemoryView) - { - if (((MemoryView)part).isMemoryBlockRegistered(memoryBlock)) - return true; - // if display is not pinned, select - else if (!(((MemoryView)part).isPinMBDisplay())) - return true; - } - } - return false; - } - } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryBlockAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryBlockAction.java index 4faa5b983..2bf13822c 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryBlockAction.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryBlockAction.java @@ -207,9 +207,6 @@ public class AddMemoryBlockAction extends Action implements IDebugContextListene fLastMemoryBlock = memBlock; IMemoryBlock[] memArray = new IMemoryBlock[]{memBlock}; - MemoryView view = getMemoryView(); - if (view != null) - view.registerMemoryBlocks(memArray); MemoryViewUtil.getMemoryBlockManager().addMemoryBlocks(memArray); if (fAddDefaultRenderings) @@ -267,9 +264,6 @@ public class AddMemoryBlockAction extends Action implements IDebugContextListene // add memory block to memory block manager fLastMemoryBlock = memBlock; IMemoryBlock[] memArray = new IMemoryBlock[]{memBlock}; - MemoryView view = getMemoryView(); - if (view != null) - view.registerMemoryBlocks(memArray); MemoryViewUtil.getMemoryBlockManager().addMemoryBlocks(memArray); if (fAddDefaultRenderings) diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryBlocksComposite.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryBlocksComposite.java deleted file mode 100644 index 8e0d68736..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryBlocksComposite.java +++ /dev/null @@ -1,586 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.internal.ui.views.memory; - -import java.math.BigInteger; -import java.util.ArrayList; -import java.util.StringTokenizer; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.debug.core.DebugEvent; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.IDebugEventSetListener; -import org.eclipse.debug.core.IMemoryBlockListener; -import org.eclipse.debug.core.model.IDebugElement; -import org.eclipse.debug.core.model.IMemoryBlock; -import org.eclipse.debug.core.model.IMemoryBlockExtension; -import org.eclipse.debug.core.model.IMemoryBlockRetrieval; -import org.eclipse.debug.core.model.IMemoryBlockRetrievalExtension; -import org.eclipse.debug.core.model.ITerminate; -import org.eclipse.debug.internal.ui.DebugUIMessages; -import org.eclipse.debug.internal.ui.DebugUIPlugin; -import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; -import org.eclipse.debug.ui.DebugUITools; -import org.eclipse.debug.ui.IDebugUIConstants; -import org.eclipse.debug.ui.memory.IMemoryRendering; -import org.eclipse.debug.ui.memory.IMemoryRenderingContainer; -import org.eclipse.debug.ui.memory.IMemoryRenderingSite; -import org.eclipse.debug.ui.memory.IMemoryRenderingType; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.ISelectionListener; -import org.eclipse.ui.IViewPart; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.part.PageBook; -import org.eclipse.ui.progress.UIJob; - -public class AddMemoryBlocksComposite implements ISelectionListener, IDebugEventSetListener{ - - private IViewPart fViewPart; - private PageBook fComposite; - private AddMemoryBlockPage fExtendedPage; - private AddMemoryBlockPage fSimplePage; - - private class AddMemoryBlockPage implements IMemoryBlockListener - { - private Composite fPageComposite; - private Combo fExpression; - private Text fLengthTxt; - private Button fAddButton; - private boolean fShowLength; - - private AddMemoryBlockPage(boolean createLengthFields) - { - fShowLength= createLengthFields; - createPage(fComposite, createLengthFields); - } - - private Control createPage(Composite parent, boolean createLengthFields) { - Composite composite = new Composite(parent, SWT.FILL); - fPageComposite = composite; - GridLayout addLayout = new GridLayout(); - - if (createLengthFields) - addLayout.numColumns = 3; - else - addLayout.numColumns = 2; - - addLayout.makeColumnsEqualWidth = false; - composite.setLayout(addLayout); - - Label expr = new Label(composite, SWT.NONE); - expr.setText(DebugUIMessages.AddMemoryBlocksComposite_0); - GridData data = new GridData(); - data.grabExcessHorizontalSpace = false; - data.grabExcessVerticalSpace = false; - data.verticalAlignment = SWT.CENTER; - data.horizontalAlignment = SWT.LEFT; - expr.setLayoutData(data); - - if (createLengthFields) - { - Label length = new Label(composite, SWT.NONE); - length.setText(DebugUIMessages.AddMemoryBlocksComposite_1); - data = new GridData(); - data.grabExcessHorizontalSpace = false; - data.grabExcessVerticalSpace = false; - data.verticalAlignment = SWT.CENTER; - data.horizontalAlignment = SWT.LEFT; - length.setLayoutData(data); - } - - new Label(composite, SWT.NONE); - - fExpression = new Combo(composite, SWT.NONE); - data = new GridData(); - data.grabExcessHorizontalSpace = true; - data.grabExcessVerticalSpace = false; - data.horizontalAlignment = SWT.FILL; - data.verticalAlignment = SWT.BOTTOM; - fExpression.setLayoutData(data); - - fExpression.addSelectionListener(new SelectionAdapter() - { - public void widgetDefaultSelected(SelectionEvent e) - { - if (validate()) - addMemoryBlocks(); - } - }); - - // fill history - fillHistory(); - - if (createLengthFields) - { - fLengthTxt = new Text(composite, SWT.BORDER | SWT.SINGLE); - data = new GridData(); - data.grabExcessHorizontalSpace = true; - data.grabExcessVerticalSpace = false; - data.horizontalAlignment = SWT.FILL; - data.verticalAlignment = SWT.BOTTOM; - fLengthTxt.setLayoutData(data); - - fLengthTxt.addSelectionListener(new SelectionAdapter() - { - public void widgetDefaultSelected(SelectionEvent e) - { - if (validate()) - addMemoryBlocks(); - } - }); - } - - fAddButton = new Button(composite, SWT.NONE); - fAddButton.setImage(DebugUITools.getImage(IInternalDebugUIConstants.IMG_ELCL_MONITOR_EXPRESSION)); - fAddButton.setToolTipText(DebugUIMessages.AddMemoryBlocksComposite_2); - data = new GridData(); - data.grabExcessHorizontalSpace = false; - data.grabExcessVerticalSpace = false; - data.verticalAlignment = SWT.TOP; - fAddButton.setLayoutData(data); - - fAddButton.addSelectionListener(new SelectionAdapter() - { - public void widgetSelected(SelectionEvent e) - { - addMemoryBlocks(); - } - }); - - return composite; - } - - private void fillHistory() { - String[] history = MemoryViewUtil.getHistory(); - if (history.length > 0) - { - String txt = fExpression.getText(); - fExpression.removeAll(); - for(int j=0; j<history.length; j++) { - fExpression.add(history[j]); - } - fExpression.setText(txt); - } - } - - private void addMemoryBlocks() - { - IAdaptable debugContext = DebugUITools.getDebugContext(); - if (debugContext == null) - return; - - IDebugElement elm = null; - if (debugContext instanceof IDebugElement) - elm = (IDebugElement)debugContext; - - if (elm == null) - return; - - IMemoryBlockRetrieval standardMemRetrieval = (IMemoryBlockRetrieval)elm.getAdapter(IMemoryBlockRetrieval.class); - if (standardMemRetrieval == null) - standardMemRetrieval = elm.getDebugTarget(); - - if (standardMemRetrieval == null) - return; - -// get expression entered in combo - String input = fExpression.getText(); - - ArrayList expressions = new ArrayList(); - - if (input.length() == 0) - { - expressions.add(""); //$NON-NLS-1$ - } - else - { - StringTokenizer tokenizer = new StringTokenizer(input, ","); //$NON-NLS-1$ - while (tokenizer.hasMoreTokens()) - { - expressions.add(tokenizer.nextToken()); - } - } - - boolean error = false; - String[] expressionsArray = (String[])expressions.toArray(new String[expressions.size()]); - for (int i=0; i<expressionsArray.length; i++) - { - String expression = expressionsArray[i].trim(); - MemoryViewUtil.addHistory(expression); - - try { - if (standardMemRetrieval instanceof IMemoryBlockRetrievalExtension) - { - // if the debug session supports IMemoryBlockExtensionRetrieval - IMemoryBlockRetrievalExtension memRetrieval = (IMemoryBlockRetrievalExtension)standardMemRetrieval; - - // get extended memory block with the expression entered - IMemoryBlockExtension memBlock = memRetrieval.getExtendedMemoryBlock(expression, elm); - - // add block to memory block manager - if (memBlock != null) - { - IMemoryBlock[] memArray = new IMemoryBlock[]{memBlock}; - MemoryView view = getMemoryView(); - if (view != null) - view.registerMemoryBlocks(memArray); - - MemoryViewUtil.getMemoryBlockManager().addMemoryBlocks(memArray); - addDefaultRenderings(memBlock); - } - else - { - error = true; - // open error if it failed to retrieve a memory block - MemoryViewUtil.openError(DebugUIMessages.AddMemoryBlockAction_title, DebugUIMessages.AddMemoryBlockAction_noMemoryBlock, null); - } - } - else - { - // if the debug session does not support IMemoryBlockExtensionRetrieval - expression = expression.toUpperCase(); - String hexPrefix = "0X"; //$NON-NLS-1$ - if (expression.startsWith(hexPrefix)) - { - expression = expression.substring(hexPrefix.length()); - } - - // convert the expression to an address - BigInteger address = new BigInteger(expression, 16); - - long longAddress = address.longValue(); - - // get the length of memory to block - String strLength = fLengthTxt.getText(); - - long length = Long.parseLong(strLength); - - // must monitor at least one line - if (length <= 0) - { - error = true; - String message = DebugUIMessages.AddMemoryBlockAction_failed + "\n" + DebugUIMessages.AddMemoryBlockAction_input_invalid; //$NON-NLS-1$ - MemoryViewUtil.openError(DebugUIMessages.AddMemoryBlockAction_title, message, null); - continue; - } - - // get standard memory block - IMemoryBlock memBlock = standardMemRetrieval.getMemoryBlock(longAddress, length); - - // make sure the memory block returned is not an instance of IMemoryBlockExtension - if (memBlock instanceof IMemoryBlockExtension) - { - Status status = new Status(IStatus.WARNING, DebugUIPlugin.getUniqueIdentifier(), 0, - "IMemoryBlockRetrieval returns IMemoryBlockExtension. This may result in unexpected behavior.", null); //$NON-NLS-1$ - DebugUIPlugin.log(status); - } - - if (memBlock != null) - { - // add memory block to memory block manager - IMemoryBlock[] memArray = new IMemoryBlock[]{memBlock}; - MemoryView view = getMemoryView(); - if (view != null) - view.registerMemoryBlocks(memArray); - - MemoryViewUtil.getMemoryBlockManager().addMemoryBlocks(memArray); - addDefaultRenderings(memBlock); - } - else - { - error = true; - // otherwise open up an error doalog - MemoryViewUtil.openError(DebugUIMessages.AddMemoryBlockAction_title, DebugUIMessages.AddMemoryBlockAction_noMemoryBlock, null); - } - } - } catch (DebugException e1) { - error = true; - MemoryViewUtil.openError(DebugUIMessages.AddMemoryBlockAction_title, DebugUIMessages.AddMemoryBlockAction_failed, e1); - } - catch(NumberFormatException e2) - { - error = true; - String message = DebugUIMessages.AddMemoryBlockAction_failed + "\n" + DebugUIMessages.AddMemoryBlockAction_input_invalid; //$NON-NLS-1$ - MemoryViewUtil.openError(DebugUIMessages.AddMemoryBlockAction_title, message, null); - } - } - - if (!error) - { - fExpression.setText(""); //$NON-NLS-1$ - if (fShowLength) - fLengthTxt.setText(""); //$NON-NLS-1$ - } - } - - private void becomesVisible() - { - } - - private void becomesHidden() - { - - } - - private Control getControl() - { - return fPageComposite; - } - - private boolean validate() - { - if (fAddButton.isEnabled()) - { - if (fShowLength) - { - if (fExpression.getText() != null && - fLengthTxt.getText() != null) - { - if (fLengthTxt.getText().length() > 0) - return true; - } - return false; - } - - if (fExpression.getText() != null) - return true; - return false; - } - return false; - } - - private void update(ISelection selection) - { - if (MemoryViewUtil.isValidSelection(selection)) - fAddButton.setEnabled(true); - else - fAddButton.setEnabled(false); - } - - public void memoryBlocksAdded(IMemoryBlock[] memory) { - // history has changed if a new memory block is added - fillHistory(); - } - - public void memoryBlocksRemoved(IMemoryBlock[] memory) { - } - } - - /** - * @param viewPart - */ - public AddMemoryBlocksComposite(IViewPart viewPart) - { - fViewPart = viewPart; - } - - public Control createComposite(Composite parent) - { - fComposite = new PageBook(parent, SWT.FILL); - GridData pagebookData = new GridData(); - pagebookData.grabExcessHorizontalSpace = true; - pagebookData.grabExcessVerticalSpace = false; - pagebookData.horizontalAlignment = SWT.FILL; - pagebookData.verticalAlignment = SWT.TOP; - fComposite.setLayoutData(pagebookData); - - fExtendedPage = new AddMemoryBlockPage(false); - fSimplePage = new AddMemoryBlockPage(true); - showPageWithLength(false); - - IAdaptable debugContext = DebugUITools.getDebugContext(); - if (debugContext != null) - { - ISelection sel = new StructuredSelection(debugContext); - update(sel); - } - else - update(StructuredSelection.EMPTY); - - fViewPart.getViewSite().getPage().addSelectionListener(IDebugUIConstants.ID_DEBUG_VIEW, this); - DebugPlugin.getDefault().addDebugEventListener(this); - DebugPlugin.getDefault().getMemoryBlockManager().addListener(fExtendedPage); - DebugPlugin.getDefault().getMemoryBlockManager().addListener(fSimplePage); - - return fComposite; - } - - - - public void showPageWithLength(boolean showLengthFields) - { - if (showLengthFields) - { - fComposite.showPage(fSimplePage.getControl()); - fExtendedPage.becomesHidden(); - fSimplePage.becomesVisible(); - } - else - { - fComposite.showPage(fExtendedPage.getControl()); - fSimplePage.becomesHidden(); - fExtendedPage.becomesVisible(); - } - - } - - public void dispose() - { - fViewPart.getViewSite().getPage().removeSelectionListener(IDebugUIConstants.ID_DEBUG_VIEW, this); - DebugPlugin.getDefault().removeDebugEventListener(this); - DebugPlugin.getDefault().getMemoryBlockManager().removeListener(fExtendedPage); - DebugPlugin.getDefault().getMemoryBlockManager().removeListener(fSimplePage); - } - - public void selectionChanged(IWorkbenchPart part, ISelection selection) { - update(selection); - } - - public void update(ISelection selection) { - if (selection instanceof IStructuredSelection) - { - Object obj = ((IStructuredSelection)selection).getFirstElement(); - if (obj == null) - { - fExtendedPage.fAddButton.setEnabled(false); - fSimplePage.fAddButton.setEnabled(false); - return; - } - - fExtendedPage.update(selection); - fSimplePage.update(selection); - - if (obj instanceof IDebugElement) - { - IDebugElement elm = (IDebugElement)obj; - IMemoryBlockRetrieval retrieval = (IMemoryBlockRetrieval)elm.getAdapter(IMemoryBlockRetrieval.class); - if (retrieval == null) - retrieval = elm.getDebugTarget(); - - // watch expression can have null debug target - if (retrieval == null) - { - return; - } - - if (!(retrieval instanceof IMemoryBlockRetrievalExtension)) - showPageWithLength(true); - else - showPageWithLength(false); - } - } - } - - private MemoryView getMemoryView() - { - if (fViewPart instanceof MemoryView) - return (MemoryView)fViewPart; - return null; - } - - private void addDefaultRenderings(IMemoryBlock memoryBlock) - { - IMemoryRenderingType primaryType = DebugUITools.getMemoryRenderingManager().getPrimaryRenderingType(memoryBlock); - IMemoryRenderingType renderingTypes[] = DebugUITools.getMemoryRenderingManager().getDefaultRenderingTypes(memoryBlock); - - - // create primary rendering - try { - if (primaryType != null) - { - createRenderingInContainer(memoryBlock, primaryType, IDebugUIConstants.ID_RENDERING_VIEW_PANE_1); - } - else if (renderingTypes.length > 0) - { - primaryType = renderingTypes[0]; - createRenderingInContainer(memoryBlock, renderingTypes[0], IDebugUIConstants.ID_RENDERING_VIEW_PANE_1); - } - } catch (CoreException e1) { - DebugUIPlugin.log(e1); - } - - for (int i = 0; i<renderingTypes.length; i++) - { - try { - boolean create = true; - if (primaryType != null) - { - if (primaryType.getId().equals(renderingTypes[i].getId())) - create = false; - } - if (create) - createRenderingInContainer(memoryBlock, renderingTypes[i], IDebugUIConstants.ID_RENDERING_VIEW_PANE_2); - } catch (CoreException e) { - DebugUIPlugin.log(e); - } - } - } - - /** - * @param memoryBlock - * @param primaryType - * @throws CoreException - */ - private void createRenderingInContainer(IMemoryBlock memoryBlock, IMemoryRenderingType primaryType, String paneId) throws CoreException { - IMemoryRendering rendering = primaryType.createRendering(); - IMemoryRenderingContainer container = ((IMemoryRenderingSite)getMemoryView()).getContainer(paneId); - rendering.init(container, memoryBlock); - container.addMemoryRendering(rendering); - } - - public void handleDebugEvents(DebugEvent[] events) { - for (int i=0; i<events.length; i++) - { - if (events[i].getKind() == DebugEvent.TERMINATE && - events[i].getSource() instanceof ITerminate) - { - IAdaptable context = DebugUITools.getDebugContext(); - if (context != null && context instanceof IDebugElement) - { - IDebugElement elm = (IDebugElement)context; - if (elm.getDebugTarget().isDisconnected() || - elm.getDebugTarget().isTerminated()) - { - // causes action to disable - UIJob job = new UIJob("Update") { //$NON-NLS-1$ - - public IStatus runInUIThread(IProgressMonitor monitor) { - // updating actions need to run on UI thread - update(StructuredSelection.EMPTY); - return Status.OK_STATUS; - }}; - job.setSystem(true); - job.schedule(); - } - } - } - } - } - -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryBlocksTreeViewPane.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryBlocksTreeViewPane.java index 275261a4e..ab82d49a5 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryBlocksTreeViewPane.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryBlocksTreeViewPane.java @@ -336,7 +336,7 @@ public class MemoryBlocksTreeViewPane implements ISelectionListener, ISelectionC public Control createViewPane(Composite parent, String paneId, String label) { fPaneId = paneId; - fTreeViewer = new AsynchronousTreeViewer(parent); + fTreeViewer = new MemoryViewTreeViewer(parent); fLabel = label; IMemoryRenderingSite site = getMemoryRenderingSite(); diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryView.java index 9ac94223a..85d44e0ec 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryView.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryView.java @@ -12,9 +12,7 @@ package org.eclipse.debug.internal.ui.views.memory; import java.util.ArrayList; import java.util.Enumeration; -import java.util.HashSet; import java.util.Hashtable; -import java.util.Set; import java.util.StringTokenizer; import org.eclipse.core.commands.AbstractHandler; @@ -23,9 +21,6 @@ import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.Preferences; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.IMemoryBlockListener; -import org.eclipse.debug.core.model.IMemoryBlock; import org.eclipse.debug.internal.ui.DebugUIMessages; import org.eclipse.debug.internal.ui.DebugUIPlugin; import org.eclipse.debug.internal.ui.views.variables.VariablesViewMessages; @@ -103,13 +98,11 @@ public class MemoryView extends ViewPart implements IMemoryRenderingSite { private MemoryViewSynchronizationService fSyncService; - private boolean fPinMBDisplay = true; // pin memory block display, on by default + private boolean fPinMBDisplay = false; // pin memory block display, on by default private static int fViewCnt = 0; private IContextActivation fContext; - private Set fRegisteredMemoryBlocks = new HashSet(); - private AbstractHandler fAddHandler; private AbstractHandler fToggleMonitorsHandler; private AbstractHandler fNextMemoryBlockHandler; @@ -118,18 +111,6 @@ public class MemoryView extends ViewPart implements IMemoryRenderingSite { private int fViewOrientation = HORIZONTAL_VIEW_ORIENTATION; private String fActivePaneId; - - private IMemoryBlockListener fMemoryBlockListener = new IMemoryBlockListener() { - - public void memoryBlocksAdded(IMemoryBlock[] memory) { - // do nothing - } - - public void memoryBlocksRemoved(IMemoryBlock[] memory) { - // clean up registered memory blocks - unRegisterMemoryBlocks(memory); - }}; - class MemoryViewSelectionProvider implements ISelectionProvider, ISelectionChangedListener { @@ -356,7 +337,6 @@ public class MemoryView extends ViewPart implements IMemoryRenderingSite { fPartListener = new MemoryViewPartListener(this); getSite().getPage().addPartListener(fPartListener); - DebugPlugin.getDefault().getMemoryBlockManager().addListener(fMemoryBlockListener); // restore view pane after finishing creating all the view panes restoreView(); @@ -533,7 +513,6 @@ public class MemoryView extends ViewPart implements IMemoryRenderingSite { public void dispose() { getSite().getPage().removePartListener(fPartListener); - DebugPlugin.getDefault().getMemoryBlockManager().removeListener(fMemoryBlockListener); Enumeration enumeration = fViewPanes.elements(); while (enumeration.hasMoreElements()) @@ -554,8 +533,6 @@ public class MemoryView extends ViewPart implements IMemoryRenderingSite { fSyncService.shutdown(); - fRegisteredMemoryBlocks.clear(); - if (fAddHandler != null) fAddHandler.dispose(); @@ -823,23 +800,6 @@ public class MemoryView extends ViewPart implements IMemoryRenderingSite { return VIEW_PANE_ORIENTATION_PREF; } - public void registerMemoryBlocks(IMemoryBlock[] memoryBlocks) - { - for (int i=0; i<memoryBlocks.length; i++) - fRegisteredMemoryBlocks.add(memoryBlocks[i]); - } - - public void unRegisterMemoryBlocks(IMemoryBlock[] memoryBlocks) - { - for (int i=0; i<memoryBlocks.length; i++) - fRegisteredMemoryBlocks.remove(memoryBlocks[i]); - } - - public boolean isMemoryBlockRegistered(IMemoryBlock memoryBlock) - { - return fRegisteredMemoryBlocks.contains(memoryBlock); - } - private void createOrientationActions() { IActionBars actionBars = getViewSite().getActionBars(); diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewTab.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewTab.java index 5017fbe30..f7c145efd 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewTab.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewTab.java @@ -61,12 +61,6 @@ public class MemoryViewTab implements IMemoryViewTab, IPropertyChangeListener, L control.addListener(SWT.Activate, this); control.addListener(SWT.Deactivate, this); - // force the new control to have focus -// control.setFocus(); - - // activate rendering upon creations - fRendering.activated(); - fTabItem.setControl(control); fTabItem.setData(this); fTabItem.setText(getLabel()); diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewTreeViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewTreeViewer.java new file mode 100644 index 000000000..6001b2e59 --- /dev/null +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewTreeViewer.java @@ -0,0 +1,124 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.debug.internal.ui.views.memory; + +import org.eclipse.debug.core.DebugPlugin; +import org.eclipse.debug.core.model.IMemoryBlock; +import org.eclipse.debug.core.model.IMemoryBlockRetrieval; +import org.eclipse.debug.internal.ui.viewers.AbstractUpdatePolicy; +import org.eclipse.debug.internal.ui.viewers.AsynchronousTreeViewer; +import org.eclipse.debug.internal.ui.viewers.TreeUpdatePolicy; +import org.eclipse.debug.internal.ui.viewers.provisional.IModelDelta; +import org.eclipse.debug.internal.ui.viewers.provisional.IPresentationContext; +import org.eclipse.swt.widgets.Composite; + +/** + * Customized tree viewer for the Memory View + * This Tree Viewer has a specialized update policy for the memory view. + * When the model fires a ADDED delta, the update policy handles the event as follows: + * If the ADDED delta is accompanied by SELECT, and the added element is an memory blok, then + * the udpate policy asks the Memory View if the it is currently pinned to a memory block. If the view + * is currently pinned, then the SELECT delta is ignored. + * + * If the ADDED delta and SELECT delta are recieved in separate nodes, then the delta will be handled as-is and would + * not take the pinning state of the memory view into account. + * + */ +public class MemoryViewTreeViewer extends AsynchronousTreeViewer { + + private class MemoryViewTreeUpdatePolicy extends TreeUpdatePolicy + { + protected void updateNodes(IModelDelta[] nodes) { + AsynchronousTreeViewer viewer = (AsynchronousTreeViewer) getViewer(); + if (viewer == null) { + return; + } + + for (int i = 0; i < nodes.length; i++) { + IModelDelta node = nodes[i]; + int flags = node.getFlags(); + + if ((flags & IModelDelta.ADDED) != 0) + { + if (node.getElement() instanceof IMemoryBlock) + { + if ((flags & IModelDelta.SELECT) != 0) + { + IPresentationContext context = getViewer().getPresentationContext(); + if (context.getPart() instanceof MemoryView) + { + MemoryView view = (MemoryView)context.getPart(); + if (view.isPinMBDisplay()) + { + // turn off select if the view is currently pinned + flags |= IModelDelta.SELECT; + flags ^= IModelDelta.SELECT; + } + } + } + + // override and select the first memory block + if (isFirstMemoryBlock()) + { + flags |= IModelDelta.SELECT; + } + } + } + + if ((flags & IModelDelta.ADDED) != 0) { + handleAdd(viewer, node); + } + if ((flags & IModelDelta.REMOVED) != 0) { + handleRemove(viewer, node); + } + if ((flags & IModelDelta.CONTENT) != 0) { + handleContent(viewer, node); + } + if ((flags & IModelDelta.EXPAND) != 0) { + handleExpand(viewer, node); + } + if ((flags & IModelDelta.SELECT) != 0) { + handleSelect(viewer, node); + } + if ((flags & IModelDelta.STATE) != 0) { + handleState(viewer, node); + } + if ((flags & IModelDelta.INSERTED) != 0) { + } + if ((flags & IModelDelta.REPLACED) != 0) { + } + + updateNodes(node.getNodes()); + } + } + } + + public MemoryViewTreeViewer(Composite parent) { + super(parent); + } + + public AbstractUpdatePolicy createUpdatePolicy() { + return new MemoryViewTreeUpdatePolicy(); + } + + private boolean isFirstMemoryBlock() + { + if (getInput() instanceof IMemoryBlockRetrieval) + { + IMemoryBlock[] memoryBlocks = DebugPlugin.getDefault().getMemoryBlockManager().getMemoryBlocks((IMemoryBlockRetrieval)getInput()); + if (memoryBlocks.length == 1) + return true; + } + return false; + } + +} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/RenderingViewPane.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/RenderingViewPane.java index 0edb3cd93..644cfb8f7 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/RenderingViewPane.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/RenderingViewPane.java @@ -14,7 +14,6 @@ import java.util.ArrayList; import java.util.Enumeration; import java.util.HashSet; import java.util.Hashtable; -import java.util.Iterator; import java.util.Set; import org.eclipse.core.runtime.IAdaptable; @@ -109,7 +108,6 @@ public class RenderingViewPane extends AbstractMemoryViewPane implements IMemory * @see org.eclipse.debug.internal.core.memory.IMemoryBlockListener#MemoryBlockAdded(org.eclipse.debug.core.model.IMemoryBlock) */ public void memoryBlocksAdded(final IMemoryBlock[] memoryBlocks) { - Display.getDefault().asyncExec(new Runnable() { public void run() { @@ -124,83 +122,9 @@ public class RenderingViewPane extends AbstractMemoryViewPane implements IMemory { IMemoryBlock memory = memoryBlocks[i]; - // if there is already and tab folder for this memory block, display it - if (fTabFolderForMemoryBlock.containsKey(memory)) { - if (fStackLayout.topControl != (TabFolder)fTabFolderForMemoryBlock.get(memory)) { - - if (fParent instanceof MemoryView) - { - MemoryView mv = (MemoryView)fParent; - if (!mv.isPinMBDisplay() || isFirstMemoryBlockForRetrieval(getMemoryBlockRetrieval(memory)) - || mv.isMemoryBlockRegistered(memory)) - { - // disable current view tab before handling new memory blocks - if (getTopMemoryTab() != null) - getTopMemoryTab().setEnabled(false); - - setTabFolder((TabFolder)fTabFolderForMemoryBlock.get(memory)); - } - } - else - { - // disable current view tab before handling new memory blocks - if (getTopMemoryTab() != null) - getTopMemoryTab().setEnabled(false); - - setTabFolder((TabFolder)fTabFolderForMemoryBlock.get(memory)); - } - fViewPaneCanvas.layout(); - } - } - else { //otherwise, add a new one - - TabFolder folder = new TabFolder(fViewPaneCanvas, SWT.NULL); - - fTabFolderForMemoryBlock.put(memory, folder); - fMemoryBlockFromTabFolder.put(folder, memory); - fTabFolderForDebugView.put(getMemoryBlockRetrieval(memory), folder); - - // check renderings, only create if there is no rendering - IMemoryRendering[] renderings = fRenderingMgr.getRenderingsFromMemoryBlock(memory); - - MemoryViewTab createTab = null; - if (renderings.length == 0) - { - TabItem newItem = new TabItem(folder, SWT.NULL); - CreateRendering rendering = new CreateRendering(getInstance()); - rendering.init(getInstance(), memory); - createTab = new MemoryViewTab(newItem, rendering, getInstance()); - folder.setSelection(0); - } - - // switch to tab folder if display is not pinned - if (fParent instanceof MemoryView) - { - MemoryView mv = (MemoryView)fParent; - if (!mv.isPinMBDisplay() || isFirstMemoryBlockForRetrieval(getMemoryBlockRetrieval(memory)) - || mv.isMemoryBlockRegistered(memory)) - { - // disable current view tab before handling new memory blocks - if (getTopMemoryTab() != null) - getTopMemoryTab().setEnabled(false); - - setTabFolder((TabFolder)fTabFolderForMemoryBlock.get(memory)); - if (createTab != null) - setRenderingSelection(createTab.getRendering()); - } - } - else - { - // disable current view tab before handling new memory blocks - if (getTopMemoryTab() != null) - getTopMemoryTab().setEnabled(false); - - setTabFolder((TabFolder)fTabFolderForMemoryBlock.get(memory)); - if (createTab != null) - setRenderingSelection(createTab.getRendering()); - } - - fViewPaneCanvas.layout(); + if (!fTabFolderForMemoryBlock.containsKey(memory)) + { + createFolderForMemoryBlock(memory); } fAddedMemoryBlocks.add(memory); updateToolBarActionsEnablement(); @@ -208,21 +132,6 @@ public class RenderingViewPane extends AbstractMemoryViewPane implements IMemory }}); } - private boolean isFirstMemoryBlockForRetrieval(IMemoryBlockRetrieval retrieval) - { - Iterator iter = fAddedMemoryBlocks.iterator(); - while (iter.hasNext()) - { - IMemoryBlock memoryBlock = (IMemoryBlock)iter.next(); - IMemoryBlockRetrieval memRetrieval = getMemoryBlockRetrieval(memoryBlock); - - if (memRetrieval == retrieval) - return false; - } - return true; - } - - private IMemoryBlockRetrieval getMemoryBlockRetrieval(IMemoryBlock memoryBlock) { IMemoryBlockRetrieval retrieval = (IMemoryBlockRetrieval)memoryBlock.getAdapter(IMemoryBlockRetrieval.class); @@ -533,31 +442,13 @@ public class RenderingViewPane extends AbstractMemoryViewPane implements IMemory IMemoryBlock memoryblk = rendering.getMemoryBlock(); - // disable current view tab - if (getTopMemoryTab() != null) { - deactivateRendering(getTopMemoryTab()); - getTopMemoryTab().setEnabled(false); - } - - if (fTabFolderForMemoryBlock.containsKey(memoryblk)) { - if (fStackLayout.topControl != (TabFolder) fTabFolderForMemoryBlock.get(memoryblk)) { - setTabFolder((TabFolder) fTabFolderForMemoryBlock.get(memoryblk)); - fViewPaneCanvas.layout(); - } - } else { // otherwise, add a new one - TabFolder folder = new TabFolder(fViewPaneCanvas, SWT.NULL); - - fTabFolderForMemoryBlock.put(memoryblk, folder); - fMemoryBlockFromTabFolder.put(folder, memoryblk); - setTabFolder((TabFolder) fTabFolderForMemoryBlock.get(memoryblk)); - - fViewPaneCanvas.layout(); - - fAddedMemoryBlocks.add(memoryblk); + TabFolder tabFolder = (TabFolder) fTabFolderForMemoryBlock.get(memoryblk); + + if (tabFolder == null) + { + tabFolder = createFolderForMemoryBlock(memoryblk); } - TabFolder tabFolder = (TabFolder) fStackLayout.topControl; - if (tabFolder.getItemCount() >= 1) { // remove "Create rendering tab" TabItem item = tabFolder.getItem(0); @@ -568,23 +459,35 @@ public class RenderingViewPane extends AbstractMemoryViewPane implements IMemory } } } - + + if (tabFolder == fStackLayout.topControl) + { + // disable current view tab + if (getTopMemoryTab() != null) { + deactivateRendering(getTopMemoryTab()); + getTopMemoryTab().setEnabled(false); + } + } fAddedRenderings.add(rendering); TabItem tab = new TabItem(tabFolder, SWT.NULL); MemoryViewTab viewTab = new MemoryViewTab(tab, rendering,getInstance()); tabFolder.setSelection(tabFolder.indexOf(tab)); - setRenderingSelection(viewTab.getRendering()); - - // disable top view tab if the view pane is not visible - IMemoryViewTab top = getTopMemoryTab(); - if (top != null) - top.setEnabled(fVisible); + + if (tabFolder == fStackLayout.topControl) + { + setRenderingSelection(viewTab.getRendering()); - // activate after the rendering is created if the view pane is - // visible - if (fVisible) - activateRendering(top); + // disable top view tab if the view pane is not visible + IMemoryViewTab top = getTopMemoryTab(); + if (top != null) + top.setEnabled(fVisible); + } + else + { + deactivateRendering(viewTab); + viewTab.setEnabled(false); + } updateToolBarActionsEnablement(); } @@ -1160,21 +1063,6 @@ public class RenderingViewPane extends AbstractMemoryViewPane implements IMemory return null; } - private void activateRendering(IMemoryViewTab viewTab) - { - if (viewTab == null) - return; - - if (!viewTab.isDisposed()) - { - viewTab.getRendering().activated(); - setRenderingSelection(viewTab.getRendering()); - - // force to fire a selection change event - fSelectionProvider.fireChanged(); - } - } - private void deactivateRendering(IMemoryViewTab viewTab) { if (viewTab == null) @@ -1328,7 +1216,8 @@ public class RenderingViewPane extends AbstractMemoryViewPane implements IMemory if (lastViewTab != null) lastViewTab.setEnabled(false); - emptyFolder(); + if (fStackLayout.topControl != fEmptyTabFolder) + emptyFolder(); } return Status.OK_STATUS; @@ -1339,4 +1228,28 @@ public class RenderingViewPane extends AbstractMemoryViewPane implements IMemory public void contextChanged(ISelection selection, IWorkbenchPart part) { } + + /** + * @param memory + */ + private TabFolder createFolderForMemoryBlock(IMemoryBlock memory) { + TabFolder folder = new TabFolder(fViewPaneCanvas, SWT.NULL); + + fTabFolderForMemoryBlock.put(memory, folder); + fMemoryBlockFromTabFolder.put(folder, memory); + fTabFolderForDebugView.put(getMemoryBlockRetrieval(memory), folder); + + // check renderings, only create if there is no rendering + IMemoryRendering[] renderings = fRenderingMgr.getRenderingsFromMemoryBlock(memory); + if (renderings.length == 0) + { + TabItem newItem = new TabItem(folder, SWT.NULL); + CreateRendering rendering = new CreateRendering(getInstance()); + rendering.init(getInstance(), memory); + new MemoryViewTab(newItem, rendering, getInstance()); + folder.setSelection(0); + } + + return folder; + } } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AsyncTableRenderingViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AsyncTableRenderingViewer.java index 38cbafa78..087b4f63e 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AsyncTableRenderingViewer.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AsyncTableRenderingViewer.java @@ -109,7 +109,6 @@ public class AsyncTableRenderingViewer extends AsyncVirtualContentTableViewer { fTableCursor.setForeground(display.getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT)); fTableCursor.setFont(JFaceResources.getFont(IInternalDebugUIConstants.FONT_NAME)); - fTableCursor.setFocus(); fCursorKeyAdapter = new KeyAdapter() { public void keyPressed(KeyEvent e) 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 a8d525919..c4ba46365 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 @@ -23,12 +23,10 @@ import org.eclipse.debug.core.model.IMemoryBlockExtension; import org.eclipse.debug.core.model.IMemoryBlockRetrievalExtension; import org.eclipse.debug.internal.ui.DebugUIMessages; import org.eclipse.debug.internal.ui.DebugUIPlugin; -import org.eclipse.debug.internal.ui.views.memory.MemoryView; import org.eclipse.debug.internal.ui.views.memory.MemoryViewUtil; import org.eclipse.debug.ui.DebugUITools; import org.eclipse.debug.ui.IDebugUIConstants; import org.eclipse.debug.ui.memory.IMemoryRendering; -import org.eclipse.debug.ui.memory.IMemoryRenderingSite; import org.eclipse.debug.ui.memory.IMemoryRenderingType; import org.eclipse.jface.action.Action; import org.eclipse.jface.window.Window; @@ -181,21 +179,11 @@ public class GoToAddressAction extends Action try { if (retrieval != null) - { - // save the pin setting in the parent view - IMemoryRenderingSite site = fRendering.getMemoryRenderingContainer().getMemoryRenderingSite(); - MemoryView view = null; - if (site instanceof MemoryView) - { - view = (MemoryView)site; - } - + { IMemoryBlockExtension mbext = retrieval.getExtendedMemoryBlock(expression, elem); if (mbext != null) { IMemoryBlock[] memArray = new IMemoryBlock[]{mbext}; - if (view != null) - view.registerMemoryBlocks(memArray); DebugPlugin.getDefault().getMemoryBlockManager().addMemoryBlocks(memArray); } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/GoToAddressComposite.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/GoToAddressComposite.java index c2540c099..2fd4ef732 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/GoToAddressComposite.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/GoToAddressComposite.java @@ -123,6 +123,8 @@ public class GoToAddressComposite { boolean hex = isHex(); int radix = hex?16:10; + expression = expression.trim(); + if (isGoToAddress()) { expression = expression.toUpperCase(); diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTableRendering.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTableRendering.java index e12ecc4e5..2055ad1a4 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTableRendering.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTableRendering.java @@ -1065,7 +1065,6 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering fTableCursor.setFont(JFaceResources.getFont(IInternalDebugUIConstants.FONT_NAME)); fTableCursor.setVisible(true); - fTableCursor.setFocus(); fCursorKeyAdapter = new KeyAdapter() { public void keyPressed(KeyEvent e) |