Community
Participate
Working Groups
Created attachment 115533 [details] Screen shot Using Eclipse 3.5M2 from HEAD. Upon opening a component XML document in the Service Component editor and switching to the Source page and back to the Overview page results in the label "Specify the component's and class:" being selected. This is strange behavior; no labels should be selected in this way.
hum... very, very interesting. We don't set this on code. It seems as a default behavior. Any insights how can I fix it?
I've seen this happen recently too. I am not sure why it's happening yet but it needs investigating as it is affecting all PDE editors.
It could be the case that a bug in one of PDE's prerequisites has been fixed and that up until now PDE has been "getting away with" neglecting to do something... I'm just speculating. I must admit, selecting a label is quite peculiar.
Well, we could override behavior of the setFocus() method in our sections... the default behavior is this: * (non-Javadoc) * @see org.eclipse.ui.forms.AbstractFormPart#setFocus() */ public void setFocus() { Control client = section.getClient(); if (client != null) client.setFocus(); } This gets trigged from the editor: org.eclipse.pde.internal.ui.editor.PDEFormPage.updateFormSelection() Without debugging, I have a feeling that we're simply focusing on the first control that makes sense in the editor if there hasn't been focus before. We should be a bit more intelligent of where we should focus if we didn't have focus before.
I tried to override the setFocus() with an empty content in DSEditor, DSOverviewPage and DSComponentSection, but have no success. I found a comment in Control.java file, that maybe related to the problem: public boolean forceFocus () { ..... /* * This code is intentionally commented. * * When setting focus to a control, it is * possible that application code can set * the focus to another control inside of * WM_SETFOCUS. In this case, the original * control will no longer have the focus * and the call to setFocus() will return * false indicating failure. * * We are still working on a solution at * this time. */ // if (OS.GetFocus () != OS.SetFocus (handle)) return false; ..... }
well this is indeed something not specific to DS editor. This is due to updateFormSelection() in PDEFormPage which basically selects *any* text widget which had the focus (fLastFocusControl) while we were leaving the page we're switching back to again (ouch, is it correct english..??)
Created attachment 115635 [details] mylyn/context/zip
Just to be convinced, just test switching from a tab to another in the manifest editor 1/ leaving the Overview page with the focus inside a text field ==> the text fields gets selected once we come back 2/ leaving the Overview page with the focus inside the section header ==> the text "This section ....." is selected once we come back For some obscure reason, the header text *always* gets selected in the DS UI Overview page, but it should not be very hard to find where the "fLastFocusControl" does not get updated correctly
Created attachment 115639 [details] patch What seems to happen is that fLastFocusControl changes just after l277 has been executed (because the form header text may get the focus when the page gets the focus, and so is *unfocused* when we ask to set the focus on the textfield). The proposed patch just makes sure we keep working on the initial control until we're done with it
done. > 20091020 The fix seems fair. I can't think of any negative consequences at the moment.