1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 17:56:01 +02:00

Bug 312098: do not create a rendering automatically when Memory Browser is opened (fixed regression to memory space support)

This commit is contained in:
John Cortell 2010-05-17 20:01:01 +00:00
parent a491012509
commit ccb7b7ed22

View file

@ -771,33 +771,41 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IM
return; return;
} }
CTabItem tabItem = activeFolder.getSelection(); if (memorySpaces.length > 0) {
if (tabItem != null) {
if(memorySpaces.length > 0) {
fGotoMemorySpaceControl.setVisible(true);
fGotoMemorySpaceControl.setItems(memorySpaces); fGotoMemorySpaceControl.setItems(memorySpaces);
fGotoMemorySpaceControl.add(NA_MEMORY_SPACE_ID, 0); //$NON-NLS-1$ the n/a entry; don't think this needs to be translated
// the n/a entry; don't think this needs to be translated setMemorySpaceControlVisible(true);
fGotoMemorySpaceControl.add(NA_MEMORY_SPACE_ID, 0); //$NON-NLS-1$
} }
else { else {
fGotoMemorySpaceControl.setVisible(false);
fGotoMemorySpaceControl.setItems(new String[0]); fGotoMemorySpaceControl.setItems(new String[0]);
setMemorySpaceControlVisible(false);
} }
updateMemorySpaceControlSelection(tabItem); updateMemorySpaceControlSelection(activeFolder.getSelection());
}
fStackLayout.topControl.getParent().layout(true); fStackLayout.topControl.getParent().layout(true);
} }
}); });
} }
private void setMemorySpaceControlVisible(boolean visible) {
FormData data = (FormData)fGotoAddressBarControl.getLayoutData();
if (visible) {
data.left = new FormAttachment(fGotoMemorySpaceControl);
}
else {
data.left = new FormAttachment(0);
}
fGotoMemorySpaceControl.setVisible(visible);
}
/** /**
* Update the selection in the memory space combobox to reflect the memory * Update the selection in the memory space combobox to reflect the memory
* space being shown in the given tab * space being shown in the given tab
* *
* @param item * @param item
* the active tab * the active tab; may be null if in a "fresh" memory browser instance
*/ */
private void updateMemorySpaceControlSelection(CTabItem item) { private void updateMemorySpaceControlSelection(CTabItem item) {
String[] memorySpaces = fGotoMemorySpaceControl.getItems(); String[] memorySpaces = fGotoMemorySpaceControl.getItems();
@ -806,6 +814,7 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IM
// is one of the ones now available. If it isn't, then select // is one of the ones now available. If it isn't, then select
// the first available one and update the tab data // the first available one and update the tab data
boolean foundIt = false; boolean foundIt = false;
if (item != null) {
String currentMemorySpace = (String) item.getData(KEY_MEMORY_SPACE); String currentMemorySpace = (String) item.getData(KEY_MEMORY_SPACE);
if (currentMemorySpace != null) { if (currentMemorySpace != null) {
assert currentMemorySpace.length() > 0; assert currentMemorySpace.length() > 0;
@ -817,10 +826,13 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IM
} }
} }
} }
}
if (!foundIt) { if (!foundIt) {
fGotoMemorySpaceControl.select(0); fGotoMemorySpaceControl.select(0);
if (item != null) {
item.setData(KEY_MEMORY_SPACE, null); item.setData(KEY_MEMORY_SPACE, null);
} }
}
fGotoMemorySpaceControl.setVisible(true); fGotoMemorySpaceControl.setVisible(true);
} }
else { else {