Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Change EditorReference image
Change EditorReference image [message #526432] Sun, 11 April 2010 00:17 Go to next message
Fabio Zadrozny is currently offline Fabio ZadroznyFriend
Messages: 26
Registered: July 2009
Location: Brazil
Junior Member
I'm trying to change the editor image depending on the file name (my use case is that some files always have the same name -- e.g.: __init__.py or models.py, etc) and I'd like to show an icon that represents that file and show the name of the folder where it lies instead of that name...

Now, I can change the editor name and image without any problems in my subclass of TextEditor with setPartName/setTitleImage, and all goes well, but when the eclipse session is restored, although the title is properly persisted, the icon is not, so, I'm trying to find a way to update that icon, but the only way I found so far is by restoring the editor (while I'd like to only change the image without restoring it).

Anyone knows how to do that? I've experimented a bit with some internal APIs (to propose changing those to public later on), such as WorkbenchPartReference.setImageDescriptor, but even on that case it doesn't update the image properly.

Thanks,

Fabio
Re: Change EditorReference image [message #526621 is a reply to message #526432] Mon, 12 April 2010 12:13 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

There's no way to fix that currently. The Part API doesn't deal in
ImageDescriptors (URLImageDescriptors can be persisted) but in images,
which are binary and a scheme would have to be developed so they could
be referenced out of the workbench.xml/XMLMemento.

The reason the changes you make to EditorReference don't show up is it
was designed to be set before being rendered. So it has no code to
react to a change (to reset the image).

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Previous Topic:cycle editors in display order (tab order)
Next Topic:What is the best way to override resources in a plug-in?
Goto Forum:
  


Current Time: Thu Apr 25 08:51:12 GMT 2024

Powered by FUDForum. Page generated in 0.02937 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top