Today I tried to add a Preference Page to an RCP application that I’m working on with no luck. After executing the Extension → Add → Extension Wizards → Preference Page I end up with 3 new classes. But 2 of then have compilation errors, they refer to an unexisting PreferenceClass. After googling a bit I found this message in a mailing list describing the same exact problem:
>I ‘ve added preference page in my application using plugin.xml extensions template. Then, in a new package, Eclipse created 3 classes (Template preferences page extending FieldEditorPreferencePage, a preference constants class and a preference initializer class).
>The template preferences page uses a PreferenceClass which doesn’t already exists… I suppose this class has to initialize the preference store, in the preference template class constructor, unsing the plugin instance of the product :
>I’ve tried to extend the AbstractUIPlugin (I’ve read in differents articles from eclipse.org) to catch the plugin instance when it is created, but without succes (when to catch this single instance during startup of eclispe core runtime ?). Then I’ve found the existance of the WorkBenchPlugin class
which holds this static instance, I used it, discarding PreferenceClass , but Eclispe tells me that the use of this class is discouraged.
>Why ? How is it possible to store the plugin instance at startup ?
>Thanks a lot for your help,
Then I found the solution, if you haven’t defined an
Activator for the plugin yet it will not work. After creating an
Activator for the plugin and rerunning the wizard all went fine.