Eclipse Help Preferences [message #1705109] |
Wed, 12 August 2015 07:40 |
Cristi Andrei Messages: 21 Registered: August 2015 |
Junior Member |
|
|
Hello,
I'm trying to make an Eclipse plugin which, among other stuff, will change Eclipse Help Preferences for a short while and then change it back.
Mostly it goes like this:
-> (1) it checks if Help>Open Modes>Open help search is set to In a browser
-> (2) if so, it will change Help>Open Modes>Open help search to In the dynamic help view
-> (3) gets the current Help Scope and stores it in a variable
-> (4) changes the Help Scope to RAP Developer Guide
-> (5) does some stuff (right now, just a search in the dynamic view)
-> (6) changes the Help Scope back to what it was
-> (7) and then, if the Help>Open Modes>Open help search was at first In a browser, then it will change it back.
Right now I have something like this:
////////////////////////////////////////////////////////////////////////
Boolean wasChanged = false;
IEclipsePreferences pref = InstanceScope.INSTANCE.getNode(HelpBasePlugin.PLUGIN_ID);
String initialHelpScope = pref.get(IHelpBaseConstants.P_KEY_HELP_SCOPE, null); // doesn't work
pref.put(IHelpBaseConstants.P_KEY_HELP_SCOPE, "RAP Developer Guide"); // doesn't work
String currentPreference = pref.get(IHelpBaseConstants.P_KEY_SEARCH_FROM_BROWSER, IHelpBaseConstants.P_IN_BROWSER); // funnily it returns the String: "true" if it's In a browser and "in browser" if In the dynamic help view
if (currentPreference == "true") // (1)
{
pref.put(IHelpBaseConstants.P_KEY_SEARCH_FROM_BROWSER, "whatever"); //second string seems to not be important at all, as long as it's not null, it will always change the help search opening to In the dynamic help view (2)
try {
pref.flush();
} catch (BackingStoreException e) {
e.printStackTrace();
}
wasChanged = true;
}
String currentHelpScope = pref.get(IHelpBaseConstants.P_KEY_HELP_SCOPE, null); // doesn't work (3)
pref.put(IHelpBaseConstants.P_KEY_HELP_SCOPE, "RAP Developer Guide"); // doesn't work (4)
searchInHelp(getCurrentSelection()); // (5)
pref.put(IHelpBaseConstants.P_KEY_HELP_SCOPE, initialHelpScope);// doesn't work (6)
if (wasChanged) {
pref.put(IHelpBaseConstants.P_KEY_SEARCH_FROM_BROWSER, IHelpBaseConstants.P_IN_BROWSER); // doesn't work, and this method call actually changes the help search opening to In the dynamic help view (7)
try {
pref.flush();
} catch (BackingStoreException e) {
e.printStackTrace();
}
}
////////////////////////////////////////////////////////////////////////
The most important point here is changing Help>Open Modes>Open help search back to In a browser, the Help Scope stuff is optional to me.
I looked through IHelpBaseConstants and it seems it's very limiting in the things you can do. The only option which seems to have a good implementation with keys and values is the Help>Open Modes>Open help view documents, the others, less so.
Could anybody help me out? What method or what keys and values should I try?
|
|
|
Powered by
FUDForum. Page generated in 0.02792 seconds