|
Lines 771-803
Link Here
|
| 771 |
return; |
771 |
return; |
| 772 |
} |
772 |
} |
| 773 |
|
773 |
|
| 774 |
CTabItem tabItem = activeFolder.getSelection(); |
774 |
if (memorySpaces.length > 0) { |
| 775 |
if (tabItem != null) { |
775 |
fGotoMemorySpaceControl.setItems(memorySpaces); |
| 776 |
if(memorySpaces.length > 0) { |
776 |
fGotoMemorySpaceControl.add(NA_MEMORY_SPACE_ID, 0); //$NON-NLS-1$ the n/a entry; don't think this needs to be translated |
| 777 |
fGotoMemorySpaceControl.setVisible(true); |
777 |
setMemorySpaceControlVisible(true); |
| 778 |
fGotoMemorySpaceControl.setItems(memorySpaces); |
778 |
} |
| 779 |
|
779 |
else { |
| 780 |
// the n/a entry; don't think this needs to be translated |
780 |
fGotoMemorySpaceControl.setItems(new String[0]); |
| 781 |
fGotoMemorySpaceControl.add(NA_MEMORY_SPACE_ID, 0); //$NON-NLS-1$ |
781 |
setMemorySpaceControlVisible(false); |
| 782 |
} |
|
|
| 783 |
else { |
| 784 |
fGotoMemorySpaceControl.setVisible(false); |
| 785 |
fGotoMemorySpaceControl.setItems(new String[0]); |
| 786 |
} |
| 787 |
|
| 788 |
updateMemorySpaceControlSelection(tabItem); |
| 789 |
} |
782 |
} |
|
|
783 |
|
| 784 |
updateMemorySpaceControlSelection(activeFolder.getSelection()); |
| 785 |
|
| 790 |
fStackLayout.topControl.getParent().layout(true); |
786 |
fStackLayout.topControl.getParent().layout(true); |
| 791 |
} |
787 |
} |
| 792 |
}); |
788 |
}); |
| 793 |
} |
789 |
} |
|
|
790 |
|
| 791 |
private void setMemorySpaceControlVisible(boolean visible) { |
| 792 |
FormData data = (FormData)fGotoAddressBarControl.getLayoutData(); |
| 793 |
if (visible) { |
| 794 |
data.left = new FormAttachment(fGotoMemorySpaceControl); |
| 795 |
} |
| 796 |
else { |
| 797 |
data.left = new FormAttachment(0); |
| 798 |
} |
| 799 |
fGotoMemorySpaceControl.setVisible(visible); |
| 800 |
|
| 801 |
} |
| 794 |
|
802 |
|
| 795 |
/** |
803 |
/** |
| 796 |
* Update the selection in the memory space combobox to reflect the memory |
804 |
* Update the selection in the memory space combobox to reflect the memory |
| 797 |
* space being shown in the given tab |
805 |
* space being shown in the given tab |
| 798 |
* |
806 |
* |
| 799 |
* @param item |
807 |
* @param item |
| 800 |
* the active tab |
808 |
* the active tab; may be null if in a "fresh" memory browser instance |
| 801 |
*/ |
809 |
*/ |
| 802 |
private void updateMemorySpaceControlSelection(CTabItem item) { |
810 |
private void updateMemorySpaceControlSelection(CTabItem item) { |
| 803 |
String[] memorySpaces = fGotoMemorySpaceControl.getItems(); |
811 |
String[] memorySpaces = fGotoMemorySpaceControl.getItems(); |
|
Lines 806-825
Link Here
|
| 806 |
// is one of the ones now available. If it isn't, then select |
814 |
// is one of the ones now available. If it isn't, then select |
| 807 |
// the first available one and update the tab data |
815 |
// the first available one and update the tab data |
| 808 |
boolean foundIt = false; |
816 |
boolean foundIt = false; |
| 809 |
String currentMemorySpace = (String) item.getData(KEY_MEMORY_SPACE); |
817 |
if (item != null) { |
| 810 |
if (currentMemorySpace != null) { |
818 |
String currentMemorySpace = (String) item.getData(KEY_MEMORY_SPACE); |
| 811 |
assert currentMemorySpace.length() > 0; |
819 |
if (currentMemorySpace != null) { |
| 812 |
for (String memorySpace : memorySpaces) { |
820 |
assert currentMemorySpace.length() > 0; |
| 813 |
if (memorySpace.equals(currentMemorySpace)) { |
821 |
for (String memorySpace : memorySpaces) { |
| 814 |
foundIt = true; |
822 |
if (memorySpace.equals(currentMemorySpace)) { |
| 815 |
fGotoMemorySpaceControl.setText(currentMemorySpace); |
823 |
foundIt = true; |
| 816 |
break; |
824 |
fGotoMemorySpaceControl.setText(currentMemorySpace); |
|
|
825 |
break; |
| 826 |
} |
| 817 |
} |
827 |
} |
| 818 |
} |
828 |
} |
| 819 |
} |
829 |
} |
| 820 |
if (!foundIt) { |
830 |
if (!foundIt) { |
| 821 |
fGotoMemorySpaceControl.select(0); |
831 |
fGotoMemorySpaceControl.select(0); |
| 822 |
item.setData(KEY_MEMORY_SPACE, null); |
832 |
if (item != null) { |
|
|
833 |
item.setData(KEY_MEMORY_SPACE, null); |
| 834 |
} |
| 823 |
} |
835 |
} |
| 824 |
fGotoMemorySpaceControl.setVisible(true); |
836 |
fGotoMemorySpaceControl.setVisible(true); |
| 825 |
} |
837 |
} |