Skip to content

Commit bb10ac9

Browse files
committed
Bring back to front a tab of an already open file apache#5184
1 parent 82c27c0 commit bb10ac9

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

ui/src/main/java/org/apache/hop/ui/core/widget/TreeMemory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public boolean isExpanded(String treeName, String[] path) {
114114

115115
Boolean expanded = map.get(key);
116116
if (expanded != null) {
117-
return expanded.booleanValue();
117+
return expanded;
118118
} else {
119119
return false;
120120
}

ui/src/main/java/org/apache/hop/ui/hopgui/perspective/explorer/ExplorerPerspective.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -918,8 +918,7 @@ public CTabFolder getTabFolder() {
918918
* @param event The selection event
919919
*/
920920
private void handleTabSelectionEvent(Event event) {
921-
if (event.item instanceof CTabItem cTabItem) {
922-
CTabItem tabItem = cTabItem;
921+
if (event.item instanceof CTabItem tabItem) {
923922
ExplorerFile explorerFile = (ExplorerFile) tabItem.getData();
924923
selectInTree(explorerFile.getFilename());
925924
updateGui();
@@ -929,6 +928,15 @@ private void handleTabSelectionEvent(Event event) {
929928
public void addFile(ExplorerFile explorerFile) {
930929

931930
if (files.contains(explorerFile)) {
931+
// Select and show tab item
932+
for (CTabItem tabItem : tabFolder.getItems()) {
933+
ExplorerFile file = (ExplorerFile) tabItem.getData();
934+
if (explorerFile.getFilename().equals(file.getFilename())) {
935+
tabFolder.setSelection(tabItem);
936+
tabFolder.showItem(tabItem);
937+
tabFolder.setFocus();
938+
}
939+
}
932940
return;
933941
}
934942

0 commit comments

Comments
 (0)