Skip to main content
summaryrefslogtreecommitdiffstats
path: root/memory
diff options
context:
space:
mode:
authorTeodor Madan2010-07-19 03:08:16 -0400
committerTeodor Madan2010-07-19 03:08:16 -0400
commit11f72ba1e962a61165f85fe1d8b3e8680729de2b (patch)
treed35a4b41537aff472b15b9cab2ffe545306fa029 /memory
parent80d3376b55a52cdad8a78324b1d8da6638c0af66 (diff)
downloadorg.eclipse.cdt-11f72ba1e962a61165f85fe1d8b3e8680729de2b.tar.gz
org.eclipse.cdt-11f72ba1e962a61165f85fe1d8b3e8680729de2b.tar.xz
org.eclipse.cdt-11f72ba1e962a61165f85fe1d8b3e8680729de2b.zip
Bug 319193 - [Memory Browser]Switching between two cpus does not affect edit box where address is entered
Diffstat (limited to 'memory')
-rw-r--r--memory/org.eclipse.cdt.debug.ui.memory.memorybrowser/src/org/eclipse/cdt/debug/ui/memory/memorybrowser/GoToAddressBarWidget.java15
-rw-r--r--memory/org.eclipse.cdt.debug.ui.memory.memorybrowser/src/org/eclipse/cdt/debug/ui/memory/memorybrowser/MemoryBrowser.java46
2 files changed, 50 insertions, 11 deletions
diff --git a/memory/org.eclipse.cdt.debug.ui.memory.memorybrowser/src/org/eclipse/cdt/debug/ui/memory/memorybrowser/GoToAddressBarWidget.java b/memory/org.eclipse.cdt.debug.ui.memory.memorybrowser/src/org/eclipse/cdt/debug/ui/memory/memorybrowser/GoToAddressBarWidget.java
index 48f04c4d7d..607258118c 100644
--- a/memory/org.eclipse.cdt.debug.ui.memory.memorybrowser/src/org/eclipse/cdt/debug/ui/memory/memorybrowser/GoToAddressBarWidget.java
+++ b/memory/org.eclipse.cdt.debug.ui.memory.memorybrowser/src/org/eclipse/cdt/debug/ui/memory/memorybrowser/GoToAddressBarWidget.java
@@ -122,11 +122,24 @@ public class GoToAddressBarWidget {
return null;
}
+ /**
+ * Get expression text
+ * @return
+ */
public String getExpressionText()
{
return fExpression.getText().trim();
}
-
+
+ /**
+ * Update expression text from the widget
+ * @param text
+ */
+ public void setExpressionText(String text)
+ {
+ fExpression.setText(text);
+ }
+
public Text getExpressionWidget()
{
return fExpression;
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 f76c4308c8..388d6bbce1 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
@@ -176,13 +176,19 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IM
*/
private final static String KEY_MEMORY_BLOCKS = "MEMORY_BLOCKS"; //$NON-NLS-1$
+ /**
+ * Property we attach to a CTabItem to track the expression we used to
+ * create memory blocks on the tab's behalf. Value is an
+ * {@link String}
+ */
+ private final static String KEY_EXPRESSION = "EXPRESSION"; //$NON-NLS-1$
public static final String PREF_DEFAULT_RENDERING = "org.eclipse.cdt.debug.ui.memory.memorybrowser.defaultRendering"; //$NON-NLS-1$
/**
* The text we use in the combobox to represent no memory space specification
*/
- private static final String NA_MEMORY_SPACE_ID = " -----";
+ private static final String NA_MEMORY_SPACE_ID = " -----"; //$NON-NLS-1$
public MemoryBrowser() {
}
@@ -403,7 +409,7 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IM
getSite().getSelectionProvider().setSelection(new StructuredSelection(item.getData(KEY_RENDERING)));
} catch (DebugException e1) {
fGotoAddressBar.handleExpressionStatus(new Status(Status.ERROR, MemoryBrowserPlugin.PLUGIN_ID,
- Messages.getString("MemoryBrowser.FailedToGoToAddressTitle"), e1));
+ Messages.getString("MemoryBrowser.FailedToGoToAddressTitle"), e1)); //$NON-NLS-1$
item.dispose();
return;
}
@@ -413,7 +419,7 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IM
// out the rendering in the tab with either a new one or an
// existing one already associated with that memory space.
String oldMemorySpaceId = (String)activeFolder.getSelection().getData(KEY_MEMORY_SPACE);
- assert oldMemorySpaceId == null || !oldMemorySpaceId.equals(NA_MEMORY_SPACE_ID) : "should be null reference or an explicit, valid memory space ID (not including '----')";
+ assert oldMemorySpaceId == null || !oldMemorySpaceId.equals(NA_MEMORY_SPACE_ID) : "should be null reference or an explicit, valid memory space ID (not including '----')"; //$NON-NLS-1$
if ((oldMemorySpaceId != null && !oldMemorySpaceId.equals(memorySpaceId))
|| (oldMemorySpaceId == null && memorySpaceId != null)) {
try {
@@ -422,7 +428,7 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IM
getSite().getSelectionProvider().setSelection(new StructuredSelection(item.getData(KEY_RENDERING)));
} catch (DebugException e) {
fGotoAddressBar.handleExpressionStatus(new Status(Status.ERROR, MemoryBrowserPlugin.PLUGIN_ID,
- Messages.getString("MemoryBrowser.FailedToGoToAddressTitle"), e));
+ Messages.getString("MemoryBrowser.FailedToGoToAddressTitle"), e)); //$NON-NLS-1$
return;
}
}
@@ -452,7 +458,9 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IM
fGotoAddressBar.handleExpressionStatus(Status.OK_STATUS);
runOnUIThread(new Runnable(){
public void run() {
- updateLabel(activeFolder.getSelection(), renderingFinal);
+ CTabItem selection = activeFolder.getSelection();
+ selection.setData(KEY_EXPRESSION, expression);
+ updateLabel(selection, renderingFinal);
}
});
} catch (final DebugException e1) {
@@ -460,7 +468,7 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IM
runOnUIThread(new Runnable(){
public void run() {
fGotoAddressBar.handleExpressionStatus(new Status(Status.ERROR, MemoryBrowserPlugin.PLUGIN_ID,
- Messages.getString("MemoryBrowser.FailedToGoToAddressTitle"), e1));
+ Messages.getString("MemoryBrowser.FailedToGoToAddressTitle"), e1)); //$NON-NLS-1$
}
});
}
@@ -846,15 +854,18 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IM
tabFolder.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {}
public void widgetSelected(SelectionEvent e) {
- updateMemorySpaceControlSelection((CTabItem)e.item);
- getSite().getSelectionProvider().setSelection(new StructuredSelection(((CTabItem) e.item).getData(KEY_RENDERING)));
+ CTabItem tabItem = (CTabItem)e.item;
+ updateExpression(tabItem);
+ updateMemorySpaceControlSelection(tabItem);
+ getSite().getSelectionProvider().setSelection(new StructuredSelection(tabItem.getData(KEY_RENDERING)));
}
});
tabFolder.setData(KEY_RETRIEVAL, retrieval);
-
fContextFolders.put(retrieval, tabFolder);
fStackLayout.topControl = tabFolder;
+ // set empty initial expression
+ fGotoAddressBar.setExpressionText(""); //$NON-NLS-1$
}
// update debug context to the new selection
tabFolder.setData(KEY_CONTEXT, context);
@@ -887,6 +898,7 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IM
setMemorySpaceControlVisible(false);
}
+ updateExpression(activeFolder.getSelection());
updateMemorySpaceControlSelection(activeFolder.getSelection());
fStackLayout.topControl.getParent().layout(true);
@@ -894,6 +906,20 @@ 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);
+ }
+ }
+
private void setMemorySpaceControlVisible(boolean visible) {
FormData data = (FormData)fGotoAddressBarControl.getLayoutData();
if (visible) {
@@ -985,7 +1011,7 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IM
if (rendering == null) {
// No rendering yet. Create rendering and associated memory block.
// createMemoryBlock will throw if expression cannot be resolved
- IMemoryBlockExtension block = createMemoryBlock(retrieval, expression, context, memorySpaceId); //$NON-NLS-1$
+ IMemoryBlockExtension block = createMemoryBlock(retrieval, expression, context, memorySpaceId);
try {
rendering = type.createRendering();
} catch (CoreException e) {

Back to the top