[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.technology.albireo] Re: Context Help in SwingControl

Johannes Utzig wrote:
...
When I click back into the Swing Editor, the HelpView correctly invokes the handlePartActivation method.
In handlePartActivation, the following check is done:


Control c = display.getFocusControl();
if (c != null && c.isVisible() && !c.isDisposed())

In my case, display.getFocusControl returns null.
I am assuming, that is because the SwingControl passed the focus to the embedded swing editor and therefore no SWT control is focused.

In the case of an embedded Swing component, Display.getFocusControl() normally returns the parent SWT composite. (To be fair, I've only verified this on Windows.) If that happened correctly for you, then there would be no problem in updating the help view.


However, we've learned the hard way that getFocusControl() will not return reliable results immediately after an embedded Swing Control gains focus due to timing issues. My guess is that this is the problem you are seeing. Under these conditions, getFocusControl() will sometimes return the previously focused component and sometimes null, in my experience.

See this bugzilla:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=221241

However, without a focused control, the help view refuses to update the help content and the only way to display the correct context is by closing it and pressing F1 again.
Am I doing anything wrong?

Nope :-)

Any hints on how to work around that?
Or is this more an issue with the code of the help view that I should post in another newsgroup?

I don't think there is anything the help view itself can or should do differently. Can you trigger a programmatic help view update somehow? After some amount of time, Display.getFocusControl() should return the right value. If the help "activation" code can be rerun at that point, it should update correctly. Or if there's some other way to nudge the view...


If you find a solution, please post back here. Also, feel free to open an Albireo bug entry. Maybe there's something that can be done at the Albireo level, although I can't think of anything at the moment.


Thanks in advance and best regards, Johannes