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  +6   3 024 suites  +6   2h 24m 39s ⏱️ + 1m 35s
 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 67d31e2. ± Comparison against base commit 8567247.

This pull request removes 12 and adds 13 tests. Note that renamed tests count towards both.
UIAllTests StartupTestSuite EModelServicePerspectiveFindTest ‑ testAnywhere[0]
UIAllTests StartupTestSuite EModelServicePerspectiveFindTest ‑ testAnywhere[1]
UIAllTests StartupTestSuite EModelServicePerspectiveFindTest ‑ testInActivePerspective[0]
UIAllTests StartupTestSuite EModelServicePerspectiveFindTest ‑ testInActivePerspective[1]
UIAllTests StartupTestSuite EModelServicePerspectiveFindTest ‑ testInAnyPerspective[0]
UIAllTests StartupTestSuite EModelServicePerspectiveFindTest ‑ testInAnyPerspective[1]
UIAllTests StartupTestSuite EModelServicePerspectiveFindTest ‑ testInTrim[0]
UIAllTests StartupTestSuite EModelServicePerspectiveFindTest ‑ testInTrim[1]
UIAllTests StartupTestSuite EModelServicePerspectiveFindTest ‑ testOuterPerspective[0]
UIAllTests StartupTestSuite EModelServicePerspectiveFindTest ‑ testOuterPerspective[1]
…
UIAllTests StackRendererTest ‑ testPartReordering
UIAllTests StartupTestSuite EModelServicePerspectiveFindTest Simple ‑ testAnywhere
UIAllTests StartupTestSuite EModelServicePerspectiveFindTest Simple ‑ testInActivePerspective
UIAllTests StartupTestSuite EModelServicePerspectiveFindTest Simple ‑ testInAnyPerspective
UIAllTests StartupTestSuite EModelServicePerspectiveFindTest Simple ‑ testInTrim
UIAllTests StartupTestSuite EModelServicePerspectiveFindTest Simple ‑ testOuterPerspective
UIAllTests StartupTestSuite EModelServicePerspectiveFindTest Simple ‑ testPresentation
UIAllTests StartupTestSuite EModelServicePerspectiveFindTest Workbench ‑ testAnywhere
UIAllTests StartupTestSuite EModelServicePerspectiveFindTest Workbench ‑ testInActivePerspective
UIAllTests StartupTestSuite EModelServicePerspectiveFindTest Workbench ‑ testInAnyPerspective
…

♻️ 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 from 709a71f to a31fb7d Compare January 27, 2026 16:51
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 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

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