Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Issue with icons displayed the Next Editor Dialog (CTRL + F6)(Issue with icons displayed the Next Editor Dialog (CTRL + F6))
Issue with icons displayed the Next Editor Dialog (CTRL + F6) [message #1059636] Mon, 20 May 2013 23:50 Go to next message
ALOK MANJREKAR is currently offline ALOK MANJREKAR
Messages: 12
Registered: May 2012
Junior Member
Hellp Everyone,

I was playing around with the "Next Editor" dialog, that is launched with the key combination CTRL + F6. To give a short background, this editor displays the list of all open editors, and the user can quickly jump to an editor of his choice.

I noticed something weird with the this dialog. The icons displayed for the editors listed in the dialog are not accurate and inline with the icons displayed for the editors in the workbench area.
I noticed that the implementation used to fetch the icon information in the "Next Editor" dialog is different from that used to display the icon for the editor in the workbench.
To display the icon for an editor in the workbench, eclipse's uses the ViewPart implementation's method public Image getTitleImage();

However, the "Next Editor" dialog seems to be using the image information that comes from the icon attribute of the org.eclipse.ui.editors extension registration of the editor.
I verified this by looking at the code of the handler class "CycleEditorHandler" which is invoked on "CTRL + F6".

The method that adds the items in the dialog is as follows.

I have highlighted the code that sets the image for the editor in the dialog.

protected void addItems(Table table, WorkbenchPage page) {
List<EditorReference> refs = page.getSortedEditorReferences();
for (EditorReference ref : refs) {
TableItem item = null;
item = new TableItem(table, SWT.NONE);
if (ref.isDirty()) {
item.setText("*" + ref.getTitle()); //$NON-NLS-1$
} else {
item.setText(ref.getTitle());
}
item.setImage(ref.getTitleImage());
item.setData(ref);
}
}
The EditorReference implementation of getTitleImage() seems to be returning the Image from the image-descriptor that is obtained from the "Icon" attribute of the org.eclipse.ui.editors extension for that particular editor.

That is not necessarily the same as the icon displayed in the workbench area.
Eclipse's implementation supports declaring an editor using the org.eclipse.ui.editor extension, where-in we register a editor with a id and an implementation class.

We can technically associated multiple objects with the same editor id and have the editor part implementation's getViewTitle() return different icons based on the object type.


Is the behaviour I am observing a bug in eclipse? I presume it would be, since eclipse is using 2 different mechanisms to retrieve the icon for a editor.
Could someone in this forum please confirm my observation or clarify the behaviour of eclipse in such scenarios?

-Alok


Re: Issue with icons displayed the Next Editor Dialog (CTRL + F6) [message #1059819 is a reply to message #1059636] Tue, 21 May 2013 13:53 Go to previous messageGo to next message
ALOK MANJREKAR is currently offline ALOK MANJREKAR
Messages: 12
Registered: May 2012
Junior Member
Hi,
In other words, it seems that the EditorReference implementation is returning the Image information for the editor using the "Icon" attribute in the org.eclipse.ui.editor extension of an editor.
But the Image that is displayed for the editor in the workbench area does not reply on this and instead relies on the getTitleImage() implementation of IEditorPart.

Anyone who relies on the EditorReference of the editor to get the image could potentially get a different image than the one displayed for the editor in the workbench area.
Any comments on this? Is this something that needs to be fixed within eclipse?
Re: Issue with icons displayed the Next Editor Dialog (CTRL + F6) [message #1060873 is a reply to message #1059819] Tue, 28 May 2013 15:09 Go to previous message
ALOK MANJREKAR is currently offline ALOK MANJREKAR
Messages: 12
Registered: May 2012
Junior Member
Hi,
I have registered a new bug to track this issue.
The link to the bug is
https://bugs.eclipse.org/bugs/show_bug.cgi?id=409332
Previous Topic:How to scroll to a position in Viewpart
Next Topic:How to supress Message "Java was started but returned exit code"
Goto Forum:
  


Current Time: Thu Aug 28 23:26:52 EDT 2014

Powered by FUDForum. Page generated in 0.01715 seconds