From 236eac6336fbd9a9b6facb29b94e9be32f1732ce Mon Sep 17 00:00:00 2001 From: Philipp K <36603238+Philipp0205@users.noreply.github.com> Date: Mon, 22 Jun 2026 22:09:43 +0200 Subject: [PATCH] Fix Ctrl+F7 view switcher showing same name for multi-instance views 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(). Re-enable testCustomName and testCustomNameAndContentDescription in ViewPartTitleTest. They were disabled before the JUnit4 migration (bug 474832) and fail without this fix. This is a generic fix for all multi-instance views (Terminal, Console, Search) that customize their part name. Fixes https://github.com/eclipse-platform/eclipse.platform/issues/2774 Co-authored-by: Luise Ravnskjaer <13628062+ravnskjaer@users.noreply.github.com> --- .../eclipseui/org/eclipse/ui/internal/ViewReference.java | 5 ----- .../ui/tests/api/workbenchpart/ViewPartTitleTest.java | 7 ++----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/ViewReference.java b/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/ViewReference.java index 61e60508ece..660cccc4089 100644 --- a/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/ViewReference.java +++ b/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/ViewReference.java @@ -68,11 +68,6 @@ public void persist() { } } - @Override - public String getPartName() { - return descriptor == null ? "" : descriptor.getLabel(); //$NON-NLS-1$ - } - @Override public String getSecondaryId() { MPart part = getModel(); diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/workbenchpart/ViewPartTitleTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/workbenchpart/ViewPartTitleTest.java index 6aac0374308..a2add368225 100644 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/workbenchpart/ViewPartTitleTest.java +++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/workbenchpart/ViewPartTitleTest.java @@ -25,7 +25,6 @@ import org.junit.After; import org.junit.Assert; import org.junit.Before; -import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; @@ -152,8 +151,7 @@ public void testNullTitle() throws Throwable { } @Test - @Ignore - public void XXXtestCustomName() throws Throwable { + public void testCustomName() throws Throwable { view.setPartName("CustomPartName"); verifySettings("CustomPartName", "CustomPartName", ""); verifyEvents(true, true, false); @@ -175,8 +173,7 @@ public void testCustomContentDescription() throws Throwable { } @Test - @Ignore - public void XXXtestCustomNameAndContentDescription() throws Throwable { + public void testCustomNameAndContentDescription() throws Throwable { view.setPartName("CustomName"); view.setContentDescription("CustomContentDescription"); verifySettings("CustomName (CustomContentDescription)", "CustomName",