Skip to content

Conversation

Copy link

Copilot AI commented Nov 8, 2025

Fixes eclipse-platform#3509. During application shutdown, context deactivation triggers part activation logic that attempts to set a window as the selected element after its toBeRendered flag has been set to false, causing ElementContainerImpl.setSelectedElement() to throw IllegalArgumentException: The selected element must be visible in the UI presentation.

Changes

Added isToBeRendered() guards before setSelectedElement() calls in shutdown-sensitive code paths:

  • PartServiceImpl: activate(), switchPerspective(), createElement(), internalHidePart()
  • ModelServiceImpl: bringToTop(), showElementInWindow()
  • ApplicationPartServiceImpl: switchPerspectiveInternal()
  • CommandLineOptionModelProcessor: process()

Example pattern applied:

// Before
window.getParent().setSelectedElement(window);

// After
if (window.isToBeRendered()) {
    window.getParent().setSelectedElement(window);
}

This pattern already existed in the codebase (line 1407 of PartServiceImpl) but wasn't consistently applied across all setSelectedElement() call sites.

Testing

Added EPartServiceTest.testActivatePartDuringWindowCleanup() to verify activation logic works correctly when window is marked for removal.

Original prompt

Analyze and propose a fix for eclipse-platform#3509


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits November 8, 2025 05:12
…lipse-platform#3509)

Co-authored-by: laeubi <1331477+laeubi@users.noreply.github.com>
Co-authored-by: laeubi <1331477+laeubi@users.noreply.github.com>
Copilot AI changed the title [WIP] Analyze and propose a fix for issue 3509 Fix IllegalArgumentException during E4/RCP application shutdown Nov 8, 2025
Copilot finished work on behalf of laeubi November 8, 2025 05:18
Copilot AI requested a review from laeubi November 8, 2025 05:18
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.

IllegalArgumentException when exiting e4-RCP application.

2 participants