Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Dynamic Languages Toolkit (DLTK) » Problem with syntax highlighting preference page
Problem with syntax highlighting preference page [message #506559] Fri, 08 January 2010 00:07 Go to next message
Eclipse UserFriend
Originally posted by: a0309169.unet.univie.ac.at

Hello all,

I've managed to create a preference page for the colors used in the
syntax highlighting for my editor, by an extending
AbstractConfigurationBlockPreferencePage with
PreferencesMessages.DLTKEditorPreferencePage_colors (and an extension of
AbstractScriptEditorColoringConfigurationBlock for the configuration
block).

Everything works fine and dandy, except that I have to reopen the editor
(and, indeed, the preference page for the preview) in order for the
preferences changes to propagate. In other words, the colors stay
unchanged until I close an editor an open it again.

What did I miss?

Kind regards,
Mikołaj Koziarkiewicz
Re: Problem with syntax highlighting preference page [message #506750 is a reply to message #506559] Sat, 09 January 2010 12:09 Go to previous messageGo to next message
Alex Panchenko is currently offline Alex PanchenkoFriend
Messages: 342
Registered: July 2009
Senior Member
Hi Mikołaj,

Something like the following your ScriptSourceViewerConfiguration should be used to handle preference change events:

public void handlePropertyChangeEvent(PropertyChangeEvent event) {
		if (this.fCodeScanner.affectsBehavior(event)) {
			this.fCodeScanner.adaptToPreferenceChange(event);
		}
		if (this.fStringScanner.affectsBehavior(event)) {
			this.fStringScanner.adaptToPreferenceChange(event);
		}
// etc


Regards,
Alex
Re: Problem with syntax highlighting preference page [message #507335 is a reply to message #506750] Tue, 12 January 2010 18:54 Go to previous message
Eclipse UserFriend
Originally posted by: a0309169.unet.univie.ac.at

Hi Alex,

thanks for the reply. I've applied the change (and additionally forced
affectsTextPresentation() to return true, analogically to the tutorial),
but unfortunately made no progress.

The adaptToColor() change method does get called and correctly replaces
the TextAttribute of the relevant tokens, but this does not affect the
presentation until the reload is completed.

Any more ideas?

Cheers,
Mikołaj

> Hi Mikołaj,
>
> Something like the following your ScriptSourceViewerConfiguration should
> be used to handle preference change events:
>
> public void handlePropertyChangeEvent(PropertyChangeEvent event) {
> if (this.fCodeScanner.affectsBehavior(event)) {
> this.fCodeScanner.adaptToPreferenceChange(event);
> }
> if (this.fStringScanner.affectsBehavior(event)) {
> this.fStringScanner.adaptToPreferenceChange(event);
> }
> // etc
>
>
> Regards,
> Alex
Previous Topic:XText Parser into DLTK Project
Next Topic:[BUILD] I-I201001191153-201001191153
Goto Forum:
  


Current Time: Sun Nov 23 03:45:59 GMT 2014

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

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