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;
}
CTabItem tabItem = activeFolder.getSelection();
if (tabItem != null) {
if(memorySpaces.length > 0) {
fGotoMemorySpaceControl.setVisible(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);
if (memorySpaces.length > 0) {
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
setMemorySpaceControlVisible(true);
}
else {
fGotoMemorySpaceControl.setItems(new String[0]);
setMemorySpaceControlVisible(false);
}
updateMemorySpaceControlSelection(activeFolder.getSelection());
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
* space being shown in the given tab
*
* @param item
* the active tab
* the active tab; may be null if in a "fresh" memory browser instance
*/
private void updateMemorySpaceControlSelection(CTabItem item) {
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
// the first available one and update the tab data
boolean foundIt = false;
String currentMemorySpace = (String) item.getData(KEY_MEMORY_SPACE);
if (currentMemorySpace != null) {
assert currentMemorySpace.length() > 0;
for (String memorySpace : memorySpaces) {
if (memorySpace.equals(currentMemorySpace)) {
foundIt = true;
fGotoMemorySpaceControl.setText(currentMemorySpace);
break;
if (item != null) {
String currentMemorySpace = (String) item.getData(KEY_MEMORY_SPACE);
if (currentMemorySpace != null) {
assert currentMemorySpace.length() > 0;
for (String memorySpace : memorySpaces) {
if (memorySpace.equals(currentMemorySpace)) {
foundIt = true;
fGotoMemorySpaceControl.setText(currentMemorySpace);
break;
}
}
}
}
if (!foundIt) {
fGotoMemorySpaceControl.select(0);
item.setData(KEY_MEMORY_SPACE, null);
if (item != null) {
item.setData(KEY_MEMORY_SPACE, null);
}
}
fGotoMemorySpaceControl.setVisible(true);
}