Fix Ctrl+F7 view switcher showing same name for multi-instance views - #4134
Philipp0205 wants to merge 1 commit into
Conversation
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
7837dac to
b566f4b
Compare
|
@Philipp0205 : I've rebased your branch on latest master state. Your state was very old. |
|
@iloveeclipse thanks, I forgot to update my fork 🙃 |
|
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. |
|
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. |
|
I have investigated this a bit further and I found that the problem can be reproduced for all these views:
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 :) |
Change made: Removed the
getPartName()override fromViewReference.java.Views like Terminal call
setPartName("Terminal " + secondaryId)which triggersCompatibilityPartto update the E4 model viapart.setLabel(computeLabel()). The parent classWorkbenchPartReference.getPartName()returnspart.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