listening to preference changes [message #460129] |
Thu, 14 December 2006 09:44  |
Eclipse User |
|
|
|
Hello.
I wrote an editor with syntax highlights which takes the colors (through a
rule based scanner) directly from the ConfigurationScope when a document
is first opened. But now I would like to update the open document when the
user changes the color.
If I understand correctly, I need to create an IPropertyChangeListener at
the editor side and register it at the preference page.
My question is how do I get access to the preference page so I can
register the listener? and where is the correct place to listen from?
I read somewhere that I can get access through the plugin class, but I
don't have such a class.
Thanks in advance,
ruthie
|
|
|
|
Re: listening to preference changes [message #460135 is a reply to message #460132] |
Thu, 14 December 2006 10:19   |
Eclipse User |
|
|
|
Michael Spector wrote:
> ruthie wrote:
>> Hello.
>>
>> I wrote an editor with syntax highlights which takes the colors (through a
>> rule based scanner) directly from the ConfigurationScope when a document
>> is first opened. But now I would like to update the open document when the
>> user changes the color.
>> If I understand correctly, I need to create an IPropertyChangeListener at
>> the editor side and register it at the preference page.
>>
>> My question is how do I get access to the preference page so I can
>> register the listener? and where is the correct place to listen from?
>>
>> I read somewhere that I can get access through the plugin class, but I
>> don't have such a class.
>>
> How come you don't have a plug-in class, what is written in your MANIFEST.MF
> file after "Bundle-Activator: "? Anyway, the correct placeto listen to
> preference change, IMHO, is in your color manager (the place where you hold
> the mapping between colors and TextAttributes).
I don't have a "Bundle-Activator". (I probably don't have it since in the
new project wizard I unchecked the "Generate the Java class that ... "
following the acvice in McAffer and Lemieux book)
My MANIFEST.MF is:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Coverageng Plug-in
Bundle-SymbolicName: lt.vt.coverageng; singleton:=true
Bundle-Version: 1.0.0
Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.ui,
org.eclipse.ui.workbench.texteditor,
org.eclipse.jface.text
Eclipse-AutoStart: true
thanks,
ruthie
|
|
|
Re: listening to preference changes [message #460214 is a reply to message #460135] |
Mon, 18 December 2006 03:38  |
Eclipse User |
|
|
|
ruthie wrote:
> I don't have a "Bundle-Activator". (I probably don't have it since in
> the new project wizard I unchecked the "Generate the Java class that ...
> " following the acvice in McAffer and Lemieux book)
Even if you do not explicitly define a bundle-activator, there will
be one created for your plugin. Personally I prefer to define one
explicitly for simpler debugging purposes.
There is no problem to add a bundle activator after plug-in creation,
just use the plug-in editor, page "Overview" and click on the link
"Activator" in the "General Information" section.
Greetings from Bremen,
Daniel Krügler
|
|
|
Powered by
FUDForum. Page generated in 0.05188 seconds