Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 57711 - Editor's popumenu doesn't bring focus to editor if editor contains some selected text
Editor's popumenu doesn't bring focus to editor if editor contains some selec...
Product: platform
Classification: Unclassified
Component: Window System
All All
: P3 (vote)
: 5.x
Assigned To: David Simonek
Depends on:
  Show dependency treegraph
Reported: 2005-04-10 18:55 UTC by santhosh
Modified: 2008-12-22 20:53 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT

nbm file to reproduce this bug (15.44 KB, application/octet-stream)
2005-04-10 18:56 UTC, santhosh
source code of the module used to reproduce the bug (4.58 KB, application/octet-stream)
2005-04-10 19:06 UTC, santhosh
demoes the issue.... (100.82 KB, application/octet-stream)
2005-04-11 10:22 UTC, santhosh

Note You need to log in before you can comment on or make changes to this bug.
Description santhosh 2005-04-10 18:55:18 UTC
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
Comment 1 santhosh 2005-04-10 18:56:32 UTC
Created attachment 21523 [details]
nbm file to reproduce this bug
Comment 2 santhosh 2005-04-10 19:04:35 UTC
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.
Comment 3 santhosh 2005-04-10 19:06:01 UTC
Created attachment 21524 [details]
source code of the module used to reproduce the bug
Comment 4 santhosh 2005-04-10 19:07:09 UTC
com.fiorano.bugs.EditorBugAction and
in the (attached)
Comment 5 santhosh 2005-04-10 19:18:53 UTC
can I expect the fix in 4.1 release...
Comment 6 Martin Roskanin 2005-04-11 09:10:45 UTC
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.
Comment 7 santhosh 2005-04-11 10:20:54 UTC
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)
Comment 8 santhosh 2005-04-11 10:22:02 UTC
Created attachment 21530 [details]
demoes the issue....
Comment 9 Martin Roskanin 2005-04-11 13:31:36 UTC
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
the issue.
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.
Comment 10 santhosh 2005-04-11 15:19:09 UTC
sorry, I mistyped the netbeans version in comment# 3

happy to hear that, you are able to reproduce at your end;
Comment 11 Martin Roskanin 2005-04-12 10:43:20 UTC
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
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.
Comment 12 santhosh 2005-04-13 16:54:01 UTC
> 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
Comment 13 David Simonek 2005-09-21 17:28:15 UTC
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
helped, thanks. 

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo