Changing the icon of a CompilationUnitEditor at runtime [message #1833508] |
Thu, 15 October 2020 07:19  |
Eclipse User |
|
|
|
When I have a lot of editors open I sometimes lose track of where I'm actually editing. This mainly happens when I'm developing unit tests and I have to look around in the code in other editors.
I came up with the idea to change the icon of the "main editor" I'm working in. I created a subclass of CompilationUnitEditor and working my way from there via JavaEditorErrorTickUpdater and JavaUILabelProvider I was able to install a custom subclass of JavaElementImageProvider that allows me to switch out the icon.
While that approach works (I've been using that plugin for quite some time now) it's a faily hacky thing to do. I have to poke around with reflection in the various classes because most of the fields are private and instantiated from within the class that holds it.
Does anyone have a better solution to this? Or would there be a chance to open up the JDT API a bit so I can implement my plugin using more "legal" APIs?
|
|
|
|
|
Re: Changing the icon of a CompilationUnitEditor at runtime [message #1833531 is a reply to message #1833529] |
Fri, 16 October 2020 03:32   |
Eclipse User |
|
|
|
I often run into this type of issue. I'll have 30-80 editors open after debugging, stopping at breakpoints, navigating via F3 to various declarations to look at APIs. Then I want to get back to my "important" editor where I was doing the actual work. Hopefully I can use "Back" or the "Previous Edit Location" buttons to find it easily. But often with Back, the tool bar changes depending on the editor type and then location of the Back button changes, so I hit wrong button. Then one is left with the "where oh where is that darn editor" problem. I suppose I could Detach it , or split the editor area, but with a split editor area, both areas start to fill up again and then I have the same problem again.
It seems to me though that what you're describing as a solution is much more general than just JDT. I.e., it seems to me that it would indeed be useful to have a general UI capability to mark any editor tab (one or more?) as "favorite" such that it is visibly decorated in a somewhat eye-catching way so that one can easily find it visually. But rather than implementing that as a separate plugin, where you'll always have the problem of digging deep in the internals, instead contributing such a thing directly to the Platform UI project so it's generally available everywhere (via the context menu on the editor tabs).
It's a very welcoming community for contributions:
https://wiki.eclipse.org/Platform/How_to_Contribute
https://wiki.eclipse.org/Platform_UI/How_to_Contribute/Oomph
https://wiki.eclipse.org/Eclipse_Platform_SDK_Provisioning
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.25875 seconds