Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Platform - User Assistance (UA) » Eclipse Help Preferences(Changing Eclipse Help Preferences through code in a plugin)
Eclipse Help Preferences [message #1705109] Wed, 12 August 2015 07:40
Cristi Andrei is currently offline Cristi AndreiFriend
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?
Previous Topic:Creating MANIFEST.MF files for help plugins
Next Topic:JQuery in Eclipse Help HTML Content
Goto Forum:
  


Current Time: Mon Nov 11 23:30:29 GMT 2024

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

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

Back to the top