Re: dynamically updating colors changed in a preference screen HOW? [message #136733] |
Fri, 26 September 2003 13:12  |
Eclipse User |
|
|
|
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 #137853 is a reply to message #137706] |
Tue, 30 September 2003 09:22  |
Eclipse User |
|
|
|
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.
|
|
|
Powered by
FUDForum. Page generated in 0.02886 seconds