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 58264 - Cannot create event listener in netbeans 5.0
Summary: Cannot create event listener in netbeans 5.0
Status: VERIFIED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Unsupported (show other bugs)
Version: 5.x
Hardware: All All
: P1 blocker (vote)
Assignee: Martin Matula
URL:
Keywords:
: 57957 58282 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-04-25 08:29 UTC by webhsw
Modified: 2007-09-26 09:14 UTC (History)
6 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
A debugging info from event handler generation with the document debugging options turned on (32.34 KB, text/plain)
2005-04-25 16:28 UTC, Miloslav Metelka
Details

Note You need to log in before you can comment on or make changes to this bug.
Description webhsw 2005-04-25 08:29:40 UTC
Since 1 or 2 weeks a event cannot be created in the form designer by double click.
To see the bug: 
  1. Open a Panel in the form designer
  2. Place a button on it.
  3. Perform a doubleclick onto the Button to create the actionPerformed event.
     If fails! The code is not created.
Comment 1 Jan Stola 2005-04-25 11:20:42 UTC
At first the even handler is correctly generated, but then the initComponents
section is regenerated and also the event handler is rewritten.
Reassigning to editor module for evaluation.
See org.netbeans.modules.form.JavaCodeGenerator:849 - this line seems
to remove also the event handler (when this line is commented out
the handler remains in the .java file).
Comment 2 Jan Stola 2005-04-25 11:22:38 UTC
*** Issue 57957 has been marked as a duplicate of this issue. ***
Comment 3 Jan Stola 2005-04-25 15:27:33 UTC
*** Issue 58282 has been marked as a duplicate of this issue. ***
Comment 4 Miloslav Metelka 2005-04-25 16:27:48 UTC
I'm sorry but I cannot find any problem that would be related to the editor
regarding this issue.
I have turned on the debugging of the document modifications by using

-J-Dnetbeans.debug.editor.document=true
-J-Dnetbeans.debug.editor.document.stack=true

and at certain point the initComponents() together with the event handler gets
removed by JavaCodeGenerator's code. I'm attaching the output from a simple form
with the debugging options turned on. I have no idea why that removing happens.
I thought that it could be related to issue #58074 fix but it's not true. I have
also looked at JavaEditor recent modifications and I've tried to rollback the
change 1.188 but it had no effect as well.
I have improved the debugging of the editor so with the two options above turned
on it should be feasible to find what's the cause of the problem.

Reassigning back to form module for evaluation.
Comment 5 Miloslav Metelka 2005-04-25 16:28:50 UTC
Created attachment 21855 [details]
A debugging info from event handler generation with the document debugging options turned on
Comment 6 Jan Stola 2005-04-26 09:18:50 UTC
JavaEditor.findSimpleSection("initComponents") doesn't contain only
initComponents() method, but also the newly generated event handler.
Reassigning to java module for evaluation.
Comment 7 Martin Matula 2005-04-26 10:45:59 UTC
Seems to be caused by the following commit:

User: pnejedly
Date: 05/04/07 01:18:34
--- PositionRef.java	22 Oct 2004 08:51:09 -0000	1.58
+++ PositionRef.java	7 Apr 2005 08:18:31 -0000	1.59

Nothing to do with java module. Definitely it got broken between Apr. 6 and Apr.
7 daily builds. When we copied openide.jar from Apr. 6 daily to Apr. 7 it
started to work. Reassigning to openide.
Comment 8 Petr Nejedly 2005-04-26 14:20:33 UTC
Yeah, I've fixed a bug in PositionRef, it used to twist the bias between
open/close and also on creation. The form/java module probably used to
workaround that PositionRef problem.
PositionRef behaves correctly now and it tested that it behaves right.

Milo, could you please check the test (o.o.text.PositionRefTest)?

It seems you need to fix the bias in form editor. Sorry for the inconvenience.
 
Comment 9 Jan Stola 2005-04-26 14:29:42 UTC
Form module does nothing with PositionRef. Reassigning to java module
to evaluate the issue again with respect to pnejedly's comment.
Comment 10 Martin Matula 2005-04-26 14:43:24 UTC
OK, I see. I can remove the workaround in java - hopefully this will not cause
further regressions.
Comment 11 Martin Matula 2005-04-26 14:45:09 UTC
Fixed.

Checking in src/org/netbeans/modules/java/JavaEditor.java;
/cvs/java/src/org/netbeans/modules/java/JavaEditor.java,v  <--  JavaEditor.java
new revision: 1.191; previous revision: 1.190
done
Comment 12 Miloslav Metelka 2005-04-26 15:03:14 UTC
The PositionRefTest in openide/text seems good to me.
Comment 13 Jiri Prox 2005-07-14 10:52:45 UTC
Verified in 4.2 (200507110943)
Comment 14 eyal 2006-03-14 23:37:48 UTC
I just downloaded netbeans 5.0
and started playing with it.

I did the same thing:
-Opened a Panel in the form designer
-Placed a button on it.
-Performed a doubleclick onto the Button to create the actionPerformed event.

The code is not created. It seems to flash and disappear right after

I'm going back to 4.2 - 5.0 sucks...
Comment 15 Jiri Prox 2006-03-15 08:42:05 UTC
Eyal,
 if you can provide reliable steps to reproduce, you can reopen this issue. In
such case provide also build number of NB. I've tested this it works fine in
NB5.0 fcs and in dev build of NB6.0 
  
Comment 16 eyal 2006-03-16 17:00:53 UTC
sorry about the tone on the previous post - I'll stop programming at 2am,
promise ;)

I tried it now with a button and it works fine,
the problem I had before was with a menu Item and a mouse click event.

I opened a new design, added a JMenuBar + JmenuItem
then right clicked the menu Item from the Inspector window, selected events -> 
mouse clicked event and the screen did jump to the source tab, but the 
generated code appeared for a second then disappeared.

I'll try to reproduce it sometimes today...
Eyal

P.S. I wonder if it's related to the java.lang.nullpointer execption that 
happens every two seconds...