Bug 493528 - [Perspectives] '.' character in the name invalidates a custom perspective
Summary: [Perspectives] '.' character in the name invalidates a custom perspective
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.5   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2016-05-12 09:39 EDT by Willy Michel CLA
Modified: 2020-06-03 15:08 EDT (History)
1 user (show)

See Also:


Attachments
Custom perspective (8.01 KB, image/png)
2016-05-12 09:39 EDT, Willy Michel CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Willy Michel CLA 2016-05-12 09:39:15 EDT
Created attachment 261692 [details]
Custom perspective

Steps to reproduce:
- Start Eclipse IDE
- Right-click the toolbar button of any perspective (e.g. "Debug")
- Select "Save As..."
- Use the '.' character in the name of new perspective (e.g. "My.Debug")
- Close the dialog with "OK"
- The button of the new custom perspective is shown in the toolbar correctly (with the right icon)
- Restart Eclipse IDE
- The button of the new custom perspective is shown in the toolbar but with the default perspective icon

The reason is in the PerspectiveRegistry and this methods:

private String createNewId(String label, PerspectiveDescriptor riginalDescriptor) {
   return originalDescriptor.getOriginalId() + '.' + label;
}

private String getOriginalId(String id) {
   int index = id.lastIndexOf('.');
   if (index == -1)
      return id;
   return id.substring(0, index);
}

If you save a new perspective, then the name you typed will be used to create the perspective ID. On the other side, while loading the perspective from the workspace, the "originalID" will be exctracted from the custom perspective ID. So if you have a '.' character in the perspective name, it will be truncated at the wrong location:

Custom perspective ID: "org.eclipse.debug.ui.DebugPerspective.My.Debug" ->
Original perspective ID: "org.eclipse.debug.ui.DebugPerspective.My"

Since there is no original perspective with such ID, you custom perspective has no parent and doesn't get any icon (therefore the default icon is shown).
Comment 1 Patrik Suzzi CLA 2016-05-12 10:04:43 EDT
I cannot reproduce this bug in Neon (4.6)
Build id: I20160509-2000

After restarting eclipse the My.Debug perspective has the correct (debug) icon.

Which version of Eclipse are you using?
Comment 2 Patrik Suzzi CLA 2016-05-13 08:34:24 EDT
If you give us your version number, we can reproduce the issue on that version and verify the bug is fixed on Neon release. 

Thanks in advance.
Comment 3 Eclipse Genie CLA 2020-06-03 15:08:36 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.