Editor's popumenu doesn't bring focus to editor if editor contains some selected
text. this results in the copy/paste/delete action from popup act on different
Created attachment 21523 [details]
nbm file to reproduce this bug
I have attached a module to reproduce this bug.
o install the module in netbeans IDE 4.0 beta1.
o select Window > [ISSUE# 57711] from menubar
o a topcomponent opens in editor mode, which contains a splitpane with 2
JEditorPanes. the editor panes are named "inputEditorPane" and
o now type "aaaaaaaaaaaa" in inputEditorPane
o now type "bbbbbbbbbbbb" in outputEditorPane
o select the complete text in inputEditorPane using mouse
o select the complete text in outputEditorPane using mouse
(now focus is in outputEditorPane)
press ctrl+C. now "bbbbbbbbbbbb" is copied to clipboard
o now rightclick in inputEditorPane; the popup shown
(note: still focus is in outputEditorPane. this is bug)
select "cut" from menu.
the selected text in outputEditorPane gets cleared
----> bug. the text in inputEditorPane has to be cleared.
the problem this with focus.
Created attachment 21524 [details]
source code of the module used to reproduce the bug
in the bugs.zip (attached)
can I expect the fix in 4.1 release...
I cannot install attached nbm. There are some dependency problems.
Anyway, it seems the issue is similar to issue #51527
Is the issue reproducible in NB without installing any additional module? If
yes, could you please describe the exact steps of the reproduction. I tried
I split two editors, and followed your repro steps, it worked OK for me in
latest dev build. Also, please provide info of your OS and JDK version, thanks.
I tried to install the nbm in Netbeans IDE 4.1 Beta. it works fine.
ofcouse the updatecenter wizard says that some dependencies are not
satisfied. and asks whether to install the module anyway??
select [yes], the module gets installed property. and restart netbeans.
I am using Windows 2000, Netbeans IDE 4.1 Beta, jdk 1.4.0_02.
i tried with JDK 1.5.0_02 also. I am able to reproduce it.
I have also attched the sourcecode (2nd attachment) for your reference.
for your convinience i am also attaching online demo (uses .swf file)
Created attachment 21530 [details]
demoes the issue....
Thanks for the detailed description. I was able to install your module to NB 41
beta (I tried to install to NB40_beta1 before, as you suggested) and reproduce
I will try to find out where is the problem.. As for getting this into NB 4.1,
at the present time, NB is in high resistance mode. Only critical P1 and P2
issues are allowed to be fixed. Setting TM to 4.2. If you consider this as a
critical issue, try to escalate it to P2. Thanks.
sorry, I mistyped the netbeans version in comment# 3
happy to hear that, you are able to reproduce at your end;
There are two base problems:
a)Open some java editor (JavaEditor$JavaEditorComponent) and EditorBugTC
(attached in this issue)
b)Click on tab of JEC, focus is transfered correctly, caret is blinking
c)Click on tab of EBTC, caret is not blinking
After investigating this a little bit it seems that JEC implements
componentActivated() method and call JEditorPane.requestFocusInWindow() there.
OTOH, EBTC doesn't implement this method and default
TopComponent.componentActivated() is called that does nothing, the method is empty.
a)Drag java editor to right side and EBTC to left side, so you can see both
editors. Make a selection in java editor, and the both EBTC editors
(inputEditorPane, outputEditorPane). The focus is in outputEditorPane
b)right click to java editor. Popup will open. hit esc. Focus is in java editor.
caret is blinking. (In org.netbeans.core.windows.Central.setActiveMode
activeMode!=old) => mode.setActive will be called
c) after that click to outputEditorPane, popup will open, but after esc, focus
remains in java editor. (although,in Central.setActiveMode activeMode!=old. I
didn't investigate it further, perhaps it is the problem mentioned at item 1 -
componentActivated is not implemented)
d)focus is in InputEditorPane. Selection in both (inputEditorPane,
outputEditorPane). Right click on OutputEditorPane. (IN Central.setActiveMode
activeMode==old, mode.setActive is not called, focus is not transefered)
Perhaps the problem will disappear after EBTC.componentActivated is implemented,
but I am not sure. Reassigning to core/winsys, to check it, possibly fix
possible bug. Thanks.
> Perhaps the problem will disappear after EBTC.componentActivated is implemented
but here the bug is not about across multiple TopComponents.
the bug is about single TopComponent contains 2 JEditorPanes
I analyzed given source and I found that the problem is missing
EditorBugTC.requestFocusInWindow and and EditorBugTC.requestFocus override. As
their javadoc says in TopComponent, clients should override these methods to
tranfer focus to inner components. Your situation is somewhat complicated
because you have two inner components inside your TopComponent. I advice you to
also call requestFocusInWindow on right inner component when you catch popup
menu trigger. Hope it helps.
Closing as invalid as this is not a bug in netbeans, as netbeans can't manage
focus inside client's TopComponent impl. However let us know if my advice