File tree Expand file tree Collapse file tree
bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt
tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/workbench/renderers/swt Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -438,6 +438,8 @@ void subscribeTopicChildrenMoved(@UIEventTopic(UIEvents.ElementContainer.TOPIC_C
438438 Font font = item .getFont ();
439439 Object data = item .getData ();
440440
441+ boolean wasSelected = tabFolder .getSelection () == item ;
442+
441443 item .dispose ();
442444
443445 CTabItem newItem = new CTabItem (tabFolder , (showClose ? SWT .CLOSE : SWT .NONE ), newIndex );
@@ -448,6 +450,9 @@ void subscribeTopicChildrenMoved(@UIEventTopic(UIEvents.ElementContainer.TOPIC_C
448450 newItem .setData (data );
449451 newItem .setData (OWNING_ME , movedElement );
450452 newItem .setControl (control );
453+ if (wasSelected ) {
454+ tabFolder .setSelection (newItem );
455+ }
451456 }
452457
453458 @ Inject
Original file line number Diff line number Diff line change 11package org .eclipse .e4 .ui .workbench .renderers .swt ;
22
33import static org .junit .jupiter .api .Assertions .assertEquals ;
4+ import static org .junit .jupiter .api .Assertions .assertFalse ;
45import static org .junit .jupiter .api .Assertions .assertNotSame ;
56import static org .junit .jupiter .api .Assertions .assertTrue ;
67
@@ -84,7 +85,8 @@ public void testPartMoveUpdatesWidget() throws Exception {
8485
8586 // The old item1 should be disposed
8687 assertTrue (item1 .isDisposed (), "Old item for part1 should be disposed" );
87-
88+ assertFalse (item2 .isDisposed (), "Item2 should not be disposed" );
89+
8890 // part1 should have a NEW widget item, but the part's widget (content) should be preserved
8991 assertNotSame (item1 , newItem1 );
9092 assertEquals (part1 , newItem1 .getData (AbstractPartRenderer .OWNING_ME ), "New item should have OWNING_ME set" );
You can’t perform that action at this time.
0 commit comments