Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Re: dynamically updating colors changed in a preference screen HOW?
Re: dynamically updating colors changed in a preference screen HOW? [message #136733] Fri, 26 September 2003 13:12 Go to next message
Eclipse UserFriend
Originally posted by: jmyron.ioconcepts.com

Its hard for me to believe there is no simple way to do this. But then...
Its always a tradeoff leveraging other peoples code: You get a lot of
powerful functionality up front but when you need to change something: what
should be simple it ends up being a royal pain
Re: dynamically updating colors changed in a preference screen HOW? [message #137706 is a reply to message #136733] Mon, 29 September 2003 18:02 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jmyron.ioconcepts.com

For anyone else following this thread. I was able to get the colors updating
dynamically in the editor class by doing the following in the handler
function:

handlePreferenceStoreChanged()
if (property.equals( keyword_color)) {

cfg.keywordRepairer.setTextAttribute( new TextAttribute(

cfg.getContentColor( property), null, SWT.BOLD ));

sourceViewer.invalidateTextPresentation();

}

this of course requires you keep instance variables for all your repairers
in your configuration. Also make sure you associate your editor to the
preference store you are using by calling the setPreferenceStore() in your
constructor of your editor class
Re: dynamically updating colors changed in a preference screen HOW? [message #137853 is a reply to message #137706] Tue, 30 September 2003 09:22 Go to previous message
Eclipse UserFriend
Originally posted by: mark.melvin.dspfactory.com

On Mon, 29 Sep 2003 15:02:23 -0700, J Myron Smith <jmyron@ioconcepts.com>
wrote:

> For anyone else following this thread. I was able to get the colors
> updating
> dynamically in the editor class by doing the following in the handler
> function:
>
> handlePreferenceStoreChanged()
> if (property.equals( keyword_color)) {
>
> cfg.keywordRepairer.setTextAttribute( new TextAttribute(
>
> cfg.getContentColor( property), null, SWT.BOLD ));
>
> sourceViewer.invalidateTextPresentation();
>
> }
>
> this of course requires you keep instance variables for all your
> repairers
> in your configuration. Also make sure you associate your editor to the
> preference store you are using by calling the setPreferenceStore() in
> your
> constructor of your editor class
>

Thanks for following up. I, for one, am still learning all this stuff so
it is good to see how others are making out.

I also got this working but through a *much* longer (but probably more
extensible) route. I have made my own class AbstractRuleBasedScanner,
which contains all the code to respond to token colour and style changes
a-la-the AbstractJavaScanner in the JDT. It was more work, but I can now
subclass it for future CodeScanners and it seems to work OK.

I'm just a little confused about when I need to unhook my listeners in the
dispose() method. I posted a question over in tools.jdt but no takers,
yet... ;o)

Cheers,

Mark.
Previous Topic:key shortcut for maximizing and restoring editor. For Switching tabs in MPE ??
Next Topic:Get IProject by IProjectDescription
Goto Forum:
  


Current Time: Sun May 11 06:29:09 EDT 2025

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

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

Back to the top