Skip to content

Fix Ctrl+F7 view switcher showing same name for multi-instance views - #4134

Closed
Philipp0205 wants to merge 1 commit into
eclipse-platform:masterfrom
Philipp0205:fix/view-switcher-multi-instance-names
Closed

Philipp0205 wants to merge 1 commit into
eclipse-platform:masterfrom
Philipp0205:fix/view-switcher-multi-instance-names

Conversation

@Philipp0205

@Philipp0205 Philipp0205 commented Jun 22, 2026 •

Copy link
Copy Markdown

Change made: Removed the getPartName() override from ViewReference.java.

Views like Terminal call setPartName("Terminal " + secondaryId) which triggers CompatibilityPart to update the E4 model via part.setLabel(computeLabel()). The parent class WorkbenchPartReference.getPartName() returns part.getLocalizedLabel() which reflects this dynamic name (e.g. Terminal 1, Terminal 2 instead of Terminal Terminal).

The removed override was bypassing this by always returning the static plugin.xml descriptor label. Generic fix: Works for all multi-instance views (Terminal, Console, Search).

Fixes eclipse-platform/eclipse.platform#2774

@iloveeclipse
iloveeclipse force-pushed the fix/view-switcher-multi-instance-names branch from 7837dac to b566f4b Compare June 22, 2026 20:17
@iloveeclipse

Copy link
Copy Markdown
Member

@Philipp0205 : I've rebased your branch on latest master state. Your state was very old.

@Philipp0205

Copy link
Copy Markdown
Author

@iloveeclipse thanks, I forgot to update my fork 🙃

@github-actions

github-actions Bot commented Jun 22, 2026 •

Copy link
Copy Markdown
Contributor

Test Results

   864 files  ±0     864 suites  ±0   55m 18s ⏱️ + 8m 13s
 8 395 tests ±0   8 153 ✅ ±0  242 💤 ±0  0 ❌ ±0 
21 054 runs  ±0  20 377 ✅ ±0  677 💤 ±0  0 ❌ ±0 

Results for commit 9ab0818. ± Comparison against base commit 0d11bad.

♻️ This comment has been updated with latest results.

@iloveeclipse

Copy link
Copy Markdown
Member

This works for Terminal views but doesn't work for Console / Search views - they also show exact same names in the tabs. I guess the way how Terminal (coming originally from CDT) manages its name differs from "regular" multi-instance views which were developed in the Platform.

Ideally we should investigate what is the difference and provide a fix that works consistently for all views.

@Philipp0205

Copy link
Copy Markdown
Author

okay, apparently I did not test this good enough. I also noticed that console and search views do not add numbers to their tab names if opened multiple times.

Let me have another look at the other views.

@ravnskjaer

Copy link
Copy Markdown
Contributor

I have investigated this a bit further and I found that the problem can be reproduced for all these views:

  • Problems
  • Tasks
  • Terminal
  • Search
  • Console

As you pointed out @Philipp0205 , the Search and Console views does not add numbers to the tabs. Your fix does however work for those too. I tried adding similar logic (based on secondaryId if present as in TerminalsView::createPartControl) for updating the partName in ConsoleView and SearchView, and then I verified with your fix.

I suggest that your fix should be accepted as it is and separate issues created if we want the names on the actual tab names to be changed for Search and Console views. I consider it to be different, although related topics.

I am new to this community so bear with me if I am doing this in the wrong way :)

@ravnskjaer

Copy link
Copy Markdown
Contributor

@iloveeclipse, to summarize my findings above with respect to your concern: this fix is already generic. The switcher shows whatever part name a view sets, for all multi-instance views. Console and Search still show identical names only because those views never set a distinct part name per instance, unlike Terminal.

Would you agree to track the Console/Search naming as a separate issue? If so, I can create that issue, and this PR could be merged as it is to close the original one.

Remove the getPartName() override in ViewReference that always returned
the static descriptor label from plugin.xml. The parent class
WorkbenchPartReference.getPartName() returns part.getLocalizedLabel()
which reflects the dynamic name set by views via setPartName().

This is a generic fix for all multi-instance views (Terminal, Console,
Search) that customize their part name.

Fixes eclipse-platform/eclipse.platform#2774
@iloveeclipse
iloveeclipse force-pushed the fix/view-switcher-multi-instance-names branch from b566f4b to 9ab0818 Compare October 7, 2026 18:59
@iloveeclipse

Copy link
Copy Markdown
Member

Yes

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Existing tests for dynamic view-reference names remain disabled, leaving the regression uncovered.

1 open finding
What changed in this PR

Removes the static view-name lookup so Ctrl+F7 reflects dynamically assigned names for multi-instance views.

Changes:

  • Inherits getPartName() from WorkbenchPartReference.
  • Uses the E4 model’s updated label.
File Description
ViewReference.java Removes the descriptor-based name override.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

return descriptor == null ? "" : descriptor.getLabel(); //$NON-NLS-1$
}

@Override
@iloveeclipse

Copy link
Copy Markdown
Member

@Philipp0205 or @ravnskjaer : please follow up on Copilot feedback.

@ravnskjaer

ravnskjaer commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Happy to take this over. @Philipp0205, do you want to handle the Copilot finding yourself, or shall I? The finding is valid, the tests fail on master and passes with your fix.

@Philipp0205

Philipp0205 commented Oct 7, 2026 •

Copy link
Copy Markdown
Author

@ravnskjaer If you have time at the moment that would be awesome ☺️

@ravnskjaer

Copy link
Copy Markdown
Contributor

Thanks, @Philipp0205. I'll open a new PR with your fix plus the re-enabled tests, keeping you as the author of the fix, and link it here.

@ravnskjaer

Copy link
Copy Markdown
Contributor

New PR 4459 with enabled tests. This PR can now be closed.

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.

Terminal views all show same name 'Terminal' in Ctrl+F7 view switcher popup

4 participants