Skip to main content
summaryrefslogtreecommitdiffstats
path: root/memory
diff options
context:
space:
mode:
authorAnton Leherbauer2010-07-21 08:24:13 -0400
committerAnton Leherbauer2010-07-21 08:24:13 -0400
commitfaf5bdce2198a5cc0a00e1fb33b48f54f509586d (patch)
treee75ff43ddaf81dc7fdf8962f8857c60daf084246 /memory
parent5a1885c1a6f6cbce96d5121aeea59e1f3963d161 (diff)
downloadorg.eclipse.cdt-faf5bdce2198a5cc0a00e1fb33b48f54f509586d.tar.gz
org.eclipse.cdt-faf5bdce2198a5cc0a00e1fb33b48f54f509586d.tar.xz
org.eclipse.cdt-faf5bdce2198a5cc0a00e1fb33b48f54f509586d.zip
Bug 320372 - Memory Browser should invoke becomesVisible/becomesHidden on renderings
Also re-adds public constant MemoryBrowser.ID which got removed in version 1.21
Diffstat (limited to 'memory')
-rw-r--r--memory/org.eclipse.cdt.debug.ui.memory.memorybrowser/src/org/eclipse/cdt/debug/ui/memory/memorybrowser/MemoryBrowser.java67
1 files changed, 54 insertions, 13 deletions
diff --git a/memory/org.eclipse.cdt.debug.ui.memory.memorybrowser/src/org/eclipse/cdt/debug/ui/memory/memorybrowser/MemoryBrowser.java b/memory/org.eclipse.cdt.debug.ui.memory.memorybrowser/src/org/eclipse/cdt/debug/ui/memory/memorybrowser/MemoryBrowser.java
index 388d6bbce1..43a25c5e48 100644
--- a/memory/org.eclipse.cdt.debug.ui.memory.memorybrowser/src/org/eclipse/cdt/debug/ui/memory/memorybrowser/MemoryBrowser.java
+++ b/memory/org.eclipse.cdt.debug.ui.memory.memorybrowser/src/org/eclipse/cdt/debug/ui/memory/memorybrowser/MemoryBrowser.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009-2010 Wind River Systems, Inc. and others.
+ * Copyright (c) 2009, 2010 Wind River Systems, Inc. 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
@@ -117,6 +117,8 @@ import org.eclipse.ui.progress.WorkbenchJob;
@SuppressWarnings("restriction")
public class MemoryBrowser extends ViewPart implements IDebugContextListener, IMemoryRenderingSite, IDebugEventSetListener
{
+ public static final String ID = "org.eclipse.cdt.debug.ui.memory.memorybrowser.MemoryBrowser"; //$NON-NLS-1$
+
protected StackLayout fStackLayout;
private Composite fRenderingsComposite;
private GoToAddressBarWidget fGotoAddressBar;
@@ -125,7 +127,8 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IM
private Label fUnsupportedLabel;
private Composite fMainComposite;
private String defaultRenderingTypeId = null;
-
+ private IMemoryRendering fActiveRendering;
+
/**
* Every memory retrieval object is given its own tab folder. Typically all
* elements of a "process" (process, threads, frames) have the same
@@ -197,6 +200,7 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IM
return fMainComposite;
}
+ @Override
public void createPartControl(Composite parent) {
// set default rendering type. use the traditional rendering if available. fallback on first registered type.
// this should eventually be configurable via a preference page.
@@ -326,6 +330,7 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IM
return site.getId() + (site.getSecondaryId() != null ? (":" + site.getSecondaryId()) : ""); //$NON-NLS-1$ //$NON-NLS-2$
}
+ @Override
public void dispose() {
DebugPlugin.getDefault().removeDebugEventListener(this);
IDebugContextService contextService =
@@ -407,6 +412,7 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IM
fContextFolders.put(retrieval, activeFolder);
activeFolder.setSelection(item);
getSite().getSelectionProvider().setSelection(new StructuredSelection(item.getData(KEY_RENDERING)));
+ handleTabActivated(item);
} catch (DebugException e1) {
fGotoAddressBar.handleExpressionStatus(new Status(Status.ERROR, MemoryBrowserPlugin.PLUGIN_ID,
Messages.getString("MemoryBrowser.FailedToGoToAddressTitle"), e1)); //$NON-NLS-1$
@@ -426,6 +432,7 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IM
rendering = populateTabWithRendering(item, retrieval, context, memorySpaceId, expression);
activeFolder.setSelection(item);
getSite().getSelectionProvider().setSelection(new StructuredSelection(item.getData(KEY_RENDERING)));
+ handleTabActivated(item);
} catch (DebugException e) {
fGotoAddressBar.handleExpressionStatus(new Status(Status.ERROR, MemoryBrowserPlugin.PLUGIN_ID,
Messages.getString("MemoryBrowser.FailedToGoToAddressTitle"), e)); //$NON-NLS-1$
@@ -442,6 +449,7 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IM
rendering instanceof IRepositionableMemoryRendering) {
final IRepositionableMemoryRendering renderingFinal = (IRepositionableMemoryRendering) rendering;
new Thread() {
+ @Override
public void run() {
try {
BigInteger newBase = getExpressionAddress(retrieval, expression, context, memorySpaceId);
@@ -542,6 +550,7 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IM
// listener to dispose rendering resources for each closed tab
folder.addCTabFolder2Listener(new CTabFolder2Adapter() {
+ @Override
public void close(CTabFolderEvent event) {
event.doit = true;
CTabItem item = (CTabItem) event.item;
@@ -590,6 +599,9 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IM
// always deactivate rendering before disposing it.
rendering.deactivated();
rendering.dispose();
+ if (rendering == fActiveRendering) {
+ fActiveRendering = null;
+ }
}
map.clear();
@@ -640,7 +652,8 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IM
final Action action = new Action(
type.getLabel(), IAction.AS_RADIO_BUTTON)
{
- public void run()
+ @Override
+ public void run()
{
setDefaultRenderingTypeId(type.getId());
}
@@ -699,6 +712,7 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IM
});
}
+ @Override
public void setFocus() {
getControl().setFocus();
}
@@ -760,6 +774,7 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IM
public void propertyChange(final PropertyChangeEvent event) {
WorkbenchJob job = new WorkbenchJob("MemoryBrowser PropertyChanged") { //$NON-NLS-1$
+ @Override
public IStatus runInUIThread(IProgressMonitor monitor) {
if(tab.isDisposed())
return Status.OK_STATUS;
@@ -803,6 +818,7 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IM
if (retrieval instanceof IMemorySpaceAwareMemoryBlockRetrieval) {
final IMemoryBlockRetrieval _retrieval = retrieval;
((IMemorySpaceAwareMemoryBlockRetrieval)retrieval).getMemorySpaces(context, new GetMemorySpacesRequest(){
+ @Override
public void done() {
updateTab(_retrieval, context, isSuccess() ? getMemorySpaces() : new String[0]);
}
@@ -848,6 +864,7 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IM
CTabFolder tabFolder = fContextFolders.get(retrieval);
if(tabFolder != null) {
fStackLayout.topControl = tabFolder;
+ handleTabActivated(tabFolder.getSelection());
}
else {
tabFolder = createTabFolder(fRenderingsComposite);
@@ -858,6 +875,7 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IM
updateExpression(tabItem);
updateMemorySpaceControlSelection(tabItem);
getSite().getSelectionProvider().setSelection(new StructuredSelection(tabItem.getData(KEY_RENDERING)));
+ handleTabActivated(tabItem);
}
});
@@ -907,17 +925,39 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IM
}
/**
- * Update the expression text in goto address widget to reflect the memory
- * rendering expression
- *
- * @param item
- * the active tab; may be null if in a "fresh" memory browser instance
- */
- protected void updateExpression(CTabItem activeFolder) {
- String expression = (activeFolder != null) ? (String) activeFolder.getData(KEY_EXPRESSION) : null;
- if (expression != null) {
- fGotoAddressBar.setExpressionText(expression);
+ * Update the expression text in goto address widget to reflect the memory
+ * rendering expression
+ *
+ * @param item
+ * the active tab; may be null if in a "fresh" memory browser instance
+ */
+ protected void updateExpression(CTabItem activeFolder) {
+ String expression = (activeFolder != null) ? (String) activeFolder.getData(KEY_EXPRESSION) : null;
+ if (expression != null) {
+ fGotoAddressBar.setExpressionText(expression);
+ }
+ }
+
+
+ protected final void handleTabActivated(CTabItem item) {
+ if (item != null) {
+ updateActiveRendering((IMemoryRendering) item.getData(KEY_RENDERING));
+ }
+ }
+
+ private void updateActiveRendering(IMemoryRendering rendering) {
+ if (fActiveRendering == rendering) {
+ return;
+ }
+ if (fActiveRendering != null) {
+ fActiveRendering.deactivated();
+ fActiveRendering.becomesHidden();
+ }
+ if (rendering != null) {
+ rendering.activated();
+ rendering.becomesVisible();
}
+ fActiveRendering = rendering;
}
private void setMemorySpaceControlVisible(boolean visible) {
@@ -1155,6 +1195,7 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IM
}
else {
UIJob job = new UIJob("Memory Browser UI Job"){ //$NON-NLS-1$
+ @Override
public IStatus runInUIThread(IProgressMonitor monitor) {
runnable.run();
return Status.OK_STATUS;

Back to the top