Issue with icons displayed the Next Editor Dialog (CTRL + F6) [message #1059636] |
Mon, 20 May 2013 23:50  |
Eclipse User |
|
|
|
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
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03443 seconds