[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.rcp] context sensitiv help for textfields (contentProducer)

Hi,

I would like to get context sensitiv help for textfields in Eclipse 3.1M7.
First of all:
I know this ins't "eclipse like" - but i have to implement it nevertheless!

I have created an extension of "org.eclipse.help.contentProducer" and all
works absolutly fine - for editors, views but not for my textfields.
I've already tried the following steps:

1. inside my "createControl(Composite parent)" method
-------------------------------------------------------
Composite container = new Composite(parent, SWT.NONE);
Textfield textField = new Text(container, SWT.BORDER);
// Set active help
PlatformUI.getWorkbench().getHelpSystem().setHelp(textField, IHelpContextIds.ACTIVE_HELP_TEXTFIELD);
-------------------------------------------------------
If the help-view is already visible I get my textfield-help in the moment
my composite has the focus - not only if my textfield has focus.
Also if I define a different helpcontent (with a new extension and so on)
for a second textfield and the second textfield gets the focus nothing
happens in the help-view.



2. also inside my "createControl(Composite parent)" method
-------------------------------------------------------
Composite container = new Composite(parent, SWT.NONE);
Textfield textField = new Text(container, SWT.BORDER);
textField.addHelpListener(new HelpListener() {
public void helpRequested(HelpEvent e) {
PlatformUI.getWorkbench().getHelpSystem().displayHelp(IHelpContextIds.ACTIVE_HELP_VIEW_THREE_NAME);
}
});
-------------------------------------------------------
This works if my textfield has focus and I press F1
- but if the help-view is already visible to the user and I select my textfield
nothing changes inside the help-view.


3. also inside my "createControl(Compoiste parent)" method
-------------------------------------------------------
   Composite container = new Composite(parent, SWT.NONE);
   Textfield textField = new Text(container, SWT.BORDER);
   textField.addFocusListener(new FocusListener() {
	public void focusGained(FocusEvent e) {
		if (PlatformUI.getWorkbench().getHelpSystem().isContextHelpDisplayed()) {
                PlatformUI.getWorkbench().getHelpSystem().displayHelp(IHelpContextIds.ACTIVE_HELP_VIEW_THREE_NAME);	
 		}
		else System.out.println("No ContextHelp is displayed");
	}

public void focusLost(FocusEvent e) {
// TODO Auto-generated method stub
}
});
-------------------------------------------------------
Without the if-clause (isContextHelpDisplayed()) this works in the following way:
If no help-view was displayed and the textfield gets the focus the help-view opens
without pressing F1. (That's not what I want)
And with the if-clause nothing happens - because it returns false nevertheless the
help-view is already open.



So has anybody an idea how I can realise a context sensitive (== F1) help for
textfields?


Thanks a lot!
Dara Meinhard

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/