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.
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.
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).
*** Issue 57957 has been marked as a duplicate of this issue. ***
*** Issue 58282 has been marked as a duplicate of this issue. ***
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.
Created attachment 21855 [details] A debugging info from event handler generation with the document debugging options turned on
JavaEditor.findSimpleSection("initComponents") doesn't contain only initComponents() method, but also the newly generated event handler. Reassigning to java module for evaluation.
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.
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.
Form module does nothing with PositionRef. Reassigning to java module to evaluate the issue again with respect to pnejedly's comment.
OK, I see. I can remove the workaround in java - hopefully this will not cause further regressions.
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
The PositionRefTest in openide/text seems good to me.
Verified in 4.2 (200507110943)
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...
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
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...