Skip to content

Conversation

@vogella
Copy link
Contributor

@vogella vogella commented Jan 27, 2026

Fixes Eclipse Bug 576186.

The StackRenderer now correctly updates its UI when a part within the stack is moved. This was achieved by handling UIEvents.isMOVE events for MPartStack children in StackRenderer.java. CTabItems, which represent tabs, cannot be reordered directly and must be disposed of and recreated at the new index. The methods calcIndexFor and findItemForPart in StackRenderer were updated to accept a more generic MElementContainer<? extends MUIElement> parameter to resolve type compatibility issues with MPartStack.

Also a test is added for this behaivor

@vogella vogella force-pushed the test-stack-renderer-reordering branch from 874fa44 to 709a71f Compare January 27, 2026 10:39
@vogella vogella marked this pull request as draft January 27, 2026 10:39
@github-actions
Copy link
Contributor

github-actions bot commented Jan 27, 2026

Test Results

 3 024 files  ±0   3 024 suites  ±0   2h 19m 8s ⏱️ + 5m 42s
 8 230 tests +1   7 982 ✅ +1  248 💤 ±0  0 ❌ ±0 
23 514 runs  +3  22 723 ✅ +3  791 💤 ±0  0 ❌ ±0 

Results for commit 8f5acb7. ± Comparison against base commit e5503ef.

♻️ This comment has been updated with latest results.

@vogella vogella marked this pull request as ready for review January 27, 2026 14:17
@vogella vogella marked this pull request as draft January 27, 2026 16:19
@vogella
Copy link
Contributor Author

vogella commented Jan 27, 2026

Does not work, in case I use the example with from the Bug 576186 the UI gets correctly updated BUT if you start interacting with the UI you get additional tabs. We would not see that in the IDE because move alone (without additonal code)cannot be used due to the bug.

Example code for moving a part around.

@execute
public void execute(MPart part, EModelService modelService, MWindow window) {
MPartStack find = (MPartStack) modelService.find("atest.partstack.sample", window);
modelService.move(part, find, 2);
}
}

image

@vogella vogella force-pushed the test-stack-renderer-reordering branch 2 times, most recently from 164ac71 to ce0ff9e Compare January 27, 2026 19:38
newItem.setFont(font);
newItem.setData(data);
newItem.setData(OWNING_ME, movedElement);
newItem.setControl(control);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the currently selected tab is moved, the selection is not preserved. I should try to save it

java boolean wasSelected = tabFolder.getSelection() == item;
// ... dispose and recreate ...
if (wasSelected) {
tabFolder.setSelection(newItem);
}


// The old item1 should be disposed
assertTrue(item1.isDisposed(), "Old item for part1 should be disposed");

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also check assertFalse(item2.isDisposed(), "Item2 should not be disposed");

Copy link
Contributor Author

@vogella vogella left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs adjustments

@vogella
Copy link
Contributor Author

vogella commented Jan 28, 2026

FYI: EModelService.move is not used at all in platform accoding to call hierachy

@vogella vogella marked this pull request as ready for review January 29, 2026 09:20
Fixes Eclipse Bug 576186.

The StackRenderer now correctly updates its UI when a part within the stack is moved. This was achieved by handling UIEvents.isMOVE events for MPartStack children in StackRenderer.java. CTabItems, which represent tabs, cannot be reordered directly and must be disposed of and recreated at the new index. The methods calcIndexFor and findItemForPart in StackRenderer were updated to accept a more generic MElementContainer<? extends MUIElement> parameter to resolve type compatibility issues with MPartStack.
Ensure OWNING_ME data is preserved when a CTabItem is recreated during a move operation. This prevents the renderer from creating duplicate tabs for the same part.
@vogella vogella force-pushed the test-stack-renderer-reordering branch from 67d31e2 to 8f5acb7 Compare January 29, 2026 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant