Syntax highlighting, and integration with "Eclipse Color Theme" plugin

450 views
Skip to first unread message

Steve Perkins

unread,
Nov 17, 2014, 10:34:18 PM11/17/14
to gocl...@googlegroups.com
Like many Eclipse users, I use the "Eclipse Color Theme" plugin (https://github.com/eclipse-color-theme/eclipse-color-theme) to easily toggle pre-defined themes like Zenburn, etc.  I've noticed that when I change themes, Goclipse does not update its text color settings.  Goclipse always uses the Eclipse default colors no matter what, and they are completely unusable on a dark background.

I've done some digging into this.  Apparently two years ago, GitHub user "devoncarew" wrote about this in the old Google Code issue-tracker for Goclipse:

https://code.google.com/p/goclipse/issues/detail?id=15

... and he was nice enough to solve the problem and issue a pull request to the "Eclipse Color Theme" project maintainers, who merged it:

https://github.com/eclipse-color-theme/eclipse-color-theme/pull/102/files

In a nutshell, that "Eclipse Color Theme" plugin just needs a simple XML file for each plugin that it integrates with, and an entry in the root "plugin.xml" mapping each XML file to each plugin ID.

This fix has since stopped working (at least for me!).  I *believe* the issue is that the plugin ID for Goclipse used to be "goclipse" when that pull request was made, and has changed since then... breaking the mapping in "Eclipse Color Theme".  Now there are multiple JAR files installed with the Goclipse plugin, with fully-qualified plugin ID's such as "com.googlecode.goclipse.core", "com.googlecode.goclipse.ui", etc.  I have tried adding XML files and "plugin.xml" entries for all of them, with no effect.

I'm starting to get a little over my head with my present knowledge of Eclipse plugin development.  I would like to dive in and figure this out eventually (as I really hate working on a light background!), but that will have to be on a slow background thread with the limited time I have available.  I'm wondering if anyone with more current insight and expertise might read the summary that I've recapped above, and have it jar loose some thoughts which might lead to a quick and easy fix.

Alternatively, I can't help but notice that on the main Goclipse website (https://code.google.com/p/goclipse/)... there's a screenshot with a dark color theme!  Where'd ya get that?

brunomedeiros

unread,
Nov 24, 2014, 11:02:16 AM11/24/14
to gocl...@googlegroups.com
The screenshot is from an old version of Goclipse. But it can still be configured to look like that, I think (if you configure the Goclipse editor syntax highlighting prefs directly in the Goclipse preferences).

I'm not familiar with the "Eclipse Color Theme" plugin, but indeed since I took up the Goclipse project a lot of internal refactoring was done, and several API changes were made. In the com.googlecode.goclipse.ui.text.GoColorPreferencesEnter class (and directly related ones) you can find out the current preference key API. In particular, the plugin id where the preferences are stored has changed, just as you figured out: it's now `com.googlecode.goclipse.ui` instead of `goclipse`. But also the preference *keys* for the colors have changed, it's `syntax_highlighting_text` now, instead of `syntax_highlighting_text_color`, and so on for the other syntax elements. That might well be why your ` com.github.eclipsecolortheme/mappings/goclipse.xml` mappings are not working, try it out.

Steve Perkins

unread,
Nov 24, 2014, 10:47:14 PM11/24/14
to gocl...@googlegroups.com
Extremely confusing.  I've updated my fork to reflect your suggestions (thanks!), and I did get it work.  However, there's a wrinkle.

In my mapping XML file, setting the plugin ID to "com.googlecode.goclipse.ui" has no effect.  Nor does "com.googlecode.goclipse.core", or just plain "com.googlecode.goclipse".  However, in tracing my way through the Goclipse code, it looks like the plugin ID originates from this file:

https://github.com/GoClipse/goclipse/blob/master/plugin_ide.ui/src/melnorme/lang/ide/ui/LangUIPlugin_Actual.java

There is of course PLUGIN_ID on line 18, which has the expected value "com.googlecode.goclipse.ui".  However, there is *also* a DEBUG_PLUGIN_ID field on 24, with the value "com.googlecode.goclipse.debug". 

When I download the "eclipse-color-theme" source and create a "Plug-in Project" in Eclipse, change the Goclipse ID in that mapping XML file to "com.googlecode.goclipse.debug", and run it (in a child Eclipse environment)... it works!  However, that's the only scenario in which it works.  To sum up:
  • When I run "eclipse-color-theme" as a "Plug-in Project", using "com.googlecode.goclipse.debug" for the Goclipse ID, it works!
  • When I run "eclipse-color-theme" as a "Plug-in Project", using any other value for the Goclipse ID, no success.
  • When I crack open with a ZIP application the "plugins/com.github.eclipsecolortheme_1.0.0.201410260308.jar" file from my normal Eclipse environment, and change the Goclipse plugin ID to "com.googlecode.goclipse.debug", no success.
  • When I modify the plugin JAR file in my normal Eclipse environment with any other Goclipse plugin ID value, no success.

Any thoughts?  Obviously I am *very* close to a solution here, because I can get it work in the first bullet-point use case.  I just can't figure out why the Goclipse plugin ID changes from "com.googlecode.goclipse.debug" to something else, depending on how it's run... and what exactly is that "something else"?




--
You received this message because you are subscribed to a topic in the Google Groups "goclipse" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/goclipse/iO1wfn4ovbc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to goclipse+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Message has been deleted

brunomedeiros

unread,
Nov 26, 2014, 6:52:21 AM11/26/14
to gocl...@googlegroups.com
The Goclipse plugin ID doesn't change, rather Goclipse is made of several different plugins, each with their own id.
I don't see why anything other than "com.googlecode.goclipse.ui" would work when changing the eclipse-color-theme mapping XML (much less why "com.googlecode.goclipse.debug" in particular). Maybe it's some issue with refresh or restarting, or something out-of-date like that? At this point I would have to actually test this with eclipse-color-theme to try to figure it out, as I'm not familiar with it.

Steve Perkins

unread,
Nov 26, 2014, 12:34:01 PM11/26/14
to gocl...@googlegroups.com
I believe that I must have had some kind of pollution in my environment from trying too many things.  When I wiped out my Eclipse installation and workspace, and started over from scratch, everything worked using the expected Goclipse plugin ID. 

Thank you so much for your help and insight over the past couple of days!  I've submitted a pull request to the "eclipse-color-theme" plugin maintainers (https://github.com/eclipse-color-theme/eclipse-color-theme/pull/216).  Hopefully, Goclipse will soon once again have easy one-click access to attractive color options!

Curiously, I never could get my change to work by cracking open the installed com.github.eclipsecolortheme_1.0.0.201410260308.jar file and editing its XML contents directly.  I assume that something is cached somewhere, or perhaps tampering with the JAR file's contents like that breaks a digital signing check inside of Eclipse (I'm not familiar enough with the low-level depths of Eclipse plugin development).  Regardless, when I built a clean copy of their plugin from scratch and install that instead, everything works flawlessly.

Steve


On Wed, Nov 26, 2014 at 6:51 AM, brunomedeiros <bruno.do...@gmail.com> wrote:
The Goclipse plugin ID doesn't change, rather Goclipse is made of several different plugins.

I don't see why anything other than "com.googlecode.goclipse.ui" would work when changing the eclipse-color-theme mapping XML (much less why "com.googlecode.goclipse.debug" in particular). Maybe it's some issue with refresh or restarting, or something out-of-date like that? At this point I would have to actually test this with eclipse-color-theme to try to figure it out, as I'm not familiar with it.



On Tuesday, 25 November 2014 03:47:14 UTC, Steve Perkins wrote:

brunomedeiros

unread,
Nov 27, 2014, 8:37:36 AM11/27/14
to gocl...@googlegroups.com
(Yeah, without going into details, opening the jar and modifying the XML directly is likely to break or not work.)
Anyways, glad you got that sorted then!


On Wednesday, 26 November 2014 17:34:01 UTC, Steve Perkins wrote:
I believe that I must have had some kind of pollution in my environment from trying too many things.  When I wiped out my Eclipse installation and workspace, and started over from scratch, everything worked using the expected Goclipse plugin ID. 

Thank you so much for your help and insight over the past couple of days!  I've submitted a pull request to the "eclipse-color-theme" plugin maintainers (https://github.com/eclipse-color-theme/eclipse-color-theme/pull/216).  Hopefully, Goclipse will soon once again have easy one-click access to attractive color options!

Curiously, I never could get my change to work by cracking open the installed com.github.eclipsecolortheme_1.0.0.201410260308.jar file and editing its XML contents directly.  I assume that something is cached somewhere, or perhaps tampering with the JAR file's contents like that breaks a digital signing check inside of Eclipse (I'm not familiar enough with the low-level depths of Eclipse plugin development).  Regardless, when I built a clean copy of their plugin from scratch and install that instead, everything works flawlessly.

Steve

Reply all
Reply to author
Forward
0 new messages