This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 49076 - Editor cursor disappears when CLI activated
Summary: Editor cursor disappears when CLI activated
Status: CLOSED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Execution (show other bugs)
Version: 4.x
Hardware: All All
: P4 blocker (vote)
Assignee: Jaroslav Tulach
URL:
Keywords: FOCUS
Depends on:
Blocks:
 
Reported: 2004-09-15 13:25 UTC by pzajac
Modified: 2008-12-22 20:50 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description pzajac 2004-09-15 13:25:34 UTC
[20040915]
Steps to reproduction:
1) open a java file by CLI  -open:
./netbeans -open Java.java
The file got fucus.
2) open the same java (from other console) by CLI
-open
The file hasn't got focus.
Comment 1 Marian Petras 2004-09-15 13:50:40 UTC
Accepted.
Comment 2 Marian Petras 2004-09-17 10:50:51 UTC
Possible solution:

Once the JEditorPane is obtained, find its nearest (containment
hierarchy) parent TopComponent and activate it by calling
TopComponent.requestActive().

The described code should be put into file
utilities/src/org/netbeans/modules/openfile/DefaultOpenFileImpl.java,
 below statement "if (panes != null)" (currently at line 219).
Comment 3 Marian Petras 2004-09-21 14:59:04 UTC
I cannot reproduce this bug.

My configuration:
  NetBeans custom build 040920
  Fedora Core Linux running on Intel
  Sun JDK 1.4/1.5:  (tested on both)
       J2SDK 1.4.2_05
       J2SDK 1.5.0-rc

If you still can reproduce this bug, feel free to reopen it but do not
forget to accurately specify your platform, OS, Java version and
NetBeans build number.
Comment 4 pzajac 2004-10-05 10:13:17 UTC
the file doesn't get focus when is active in editor
Comment 5 Marian Petras 2004-10-05 10:38:06 UTC
Please specify your platform, OS, Java version and NetBeans build number.
Comment 6 pzajac 2004-10-05 10:42:17 UTC
RedHat Linux 9
Kde desktop
jdk :
ava version "1.4.2_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
Java HotSpot(TM) Client VM (build 1.4.2_04-b05, mixed mode)
Comment 7 Marian Petras 2004-10-07 14:13:02 UTC
Confirmed.

To reproduce:
1) shutdown NetBeans
2) open console and start NetBeans with parameter

             -open myfile.txt

   (the file gets open in editor, the editor window gets activated
   and cursor starts blinking at the first line of the file)

3) repeat step 2) in another console

The file remains open in editor, the editor is still activated (i.e.
its tab highlighted) but the cursor vanishes and the user cannot work
with the file until they do one of the following:
  - click in the editor window so that the cursor appears
  - activate another window and then activate the editor window again
Comment 8 Marian Petras 2004-10-08 16:17:01 UTC
Actually the bug is that the already opened (and focused) file
_looses_ focus. But this is not caused by the Utilities code at all.
The IDE looses focus as soon as the user invokes

    ./netbeans <whatever arguments>

Even if I disabled the CLI handler of the Utilities module, I still
encountered the same behaviour.

I am moving this issue to "core".
Comment 9 Jaroslav Tulach 2005-01-05 14:15:07 UTC
I know where the problem is - in CLIOptions*.java
Comment 10 Jaroslav Tulach 2005-01-05 14:31:28 UTC
/cvs/core/src/org/netbeans/core/CLIOptions2.java,v  <--  CLIOptions2.java
new revision: 1.4; previous revision: 1.3
done
Processing log script arguments...
Mailing the commit message to cvs@core.netbeans.org (from
jtulach@netbeans.org)
~/work/core$ cvs ci -m "#49076: Not calling mainFrame.requestFocus to
prevent the focus to be stolen from the editor"
Comment 11 pzajac 2005-02-08 10:20:57 UTC
v