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) { fGotoMemorySpaceControl.setItems(memorySpaces);
if(memorySpaces.length > 0) { fGotoMemorySpaceControl.add(NA_MEMORY_SPACE_ID, 0); //$NON-NLS-1$ the n/a entry; don't think this needs to be translated
fGotoMemorySpaceControl.setVisible(true); setMemorySpaceControlVisible(true);
fGotoMemorySpaceControl.setItems(memorySpaces);
// the n/a entry; don't think this needs to be translated
fGotoMemorySpaceControl.add(NA_MEMORY_SPACE_ID, 0); //$NON-NLS-1$
}
else {
fGotoMemorySpaceControl.setVisible(false);
fGotoMemorySpaceControl.setItems(new String[0]);
}
updateMemorySpaceControlSelection(tabItem);
} }
else {
fGotoMemorySpaceControl.setItems(new String[0]);
setMemorySpaceControlVisible(false);
}
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,20 +814,24 @@ 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;
String currentMemorySpace = (String) item.getData(KEY_MEMORY_SPACE); if (item != null) {
if (currentMemorySpace != null) { String currentMemorySpace = (String) item.getData(KEY_MEMORY_SPACE);
assert currentMemorySpace.length() > 0; if (currentMemorySpace != null) {
for (String memorySpace : memorySpaces) { assert currentMemorySpace.length() > 0;
if (memorySpace.equals(currentMemorySpace)) { for (String memorySpace : memorySpaces) {
foundIt = true; if (memorySpace.equals(currentMemorySpace)) {
fGotoMemorySpaceControl.setText(currentMemorySpace); foundIt = true;
break; fGotoMemorySpaceControl.setText(currentMemorySpace);
break;
}
} }
} }
} }
if (!foundIt) { if (!foundIt) {
fGotoMemorySpaceControl.select(0); fGotoMemorySpaceControl.select(0);
item.setData(KEY_MEMORY_SPACE, null); if (item != null) {
item.setData(KEY_MEMORY_SPACE, null);
}
} }
fGotoMemorySpaceControl.setVisible(true); fGotoMemorySpaceControl.setVisible(true);
} }