views:

24

answers:

0

Dear All:

I thought I could write an Eclipse plug-in to alter my theme automatically for GNOME Darklooks.

I made a simple test:

/**
 * 
 */
package org.misha680.darklooks.actions;

import org.eclipse.jface.resource.ColorRegistry;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.ui.IStartup;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.themes.ITheme;

/**
 * @author misha
 * 
 */
public class Startup implements IStartup {

    /*
     * (non-Javadoc)
     * 
     * @see org.eclipse.ui.IStartup#earlyStartup()
     */
    @Override
    public void earlyStartup() {
        ColorRegistry cr = PlatformUI.getWorkbench().getThemeManager()
                .getCurrentTheme().getColorRegistry();

        for (Object obj : cr.getKeySet()) {
            String key = (String) obj;          
            cr.put(key, new RGB(0,0,0));
        }
    }

}

That uses the org.eclipse.ui.startup extension.

This has the desired effect on all colors under General -> Appearance -> Colors and Fonts, but not on other colors, such as under Java -> Editor -> Syntax Coloring (I am on Eclipse 3.6, amd64 on Ubuntu 10.04 and I am referring to Window -> Preferences).

Any hints how one could access colors defined by Java -> Editor -> Syntax Coloring, and perhaps others from an Eclipse plug-in?

Thank you

Sincerely yours Misha