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.
The editor locks lines that are not part of the automatically generated GUI code but are part of my own code. I will attach a screen shot which shows this behaviour on line 2134. I have renamed (re-factored) the name of a class which could not be replaced in the locked line - nor can I replace it now manually. A (probably) related issued is that I get inserts into wrong places in the code when I want the GUI builder to add an event handler inner class. That codes sometimes gets inserted into my own code and my only choice to save the situation is not discard all changes. Thanks for any help and/or hint.
Created attachment 52628 [details] Screen Shot Showing Incorrect Locking in Line 2134 (grayed out)
Please attach the source file. Do you have any steps to reproduce this? Which build do you use?
I will upload MindlinerMain.java and MindlinerMain.form. I can reproduce the problem as follows: - open MindlinerMain.java - hit ESC until all error message about missing component properties disappear (this error is not relevant for this issue) - add a JButton to the bottom left JInternalFrame (add button to TickerPanel in WorkFrame) - right click on button choose Event->Action->ActionPerformed The new method gets inserted right into another method (lines 2046 through 2049.
Created attachment 52644 [details] source code
Created attachment 52645 [details] Form
Created attachment 52646 [details] Screen schot with wrong insertion of method
Netbeans Version: Product Version: NetBeans IDE Dev (Build 200710201200) Java: 1.6.0-rc; Java HotSpot(TM) Client VM 1.6.0-rc-b104 System: Windows XP version 5.1 running on x86; Cp1252; de_CH (nb) Userdir: C:\Documents and Settings\messerli\.netbeans\dev
Jana please look at this - broken form/source ?
Looks like issue 116456 - caused by "Surround with try/catch" feature used in event handler method with guarded method header and footer. Still we would like to know the exact steps how to reproduce this situation, it does not seem to happen easily. The fact that a new event handler is added on a wrong place is just a consequence of this issue (wrong position of the ending guarded block of the previous event handler). To fix the wrong guarded line on your side, open the file in an external editor where you will see a special comment (something like //GEN-LAST:event_jButton1ActionPerformed) - move this comment to the last line of the method (on th eline with the closing brace). *** This issue has been marked as a duplicate of 116456 ***
Thanks, your comment is much appreciated! I have been doing some Surround with try/catch lately - sorry to be not more precise. I have also cut&pasted GUI elements from one java/form file pair to another - I did think for a while that this was the cause (I lost all guard lines on one of these cut/paste actions). Is there a way to re-build lost guard lines? Thanks, again!
> I lost all guard lines on one of these cut/paste actions. I've never heard about such a problem. You should never lose guarded code when using the IDE for editing. Did e.g. the initComponents() method disappeared completely? Looks like some strange bug. Would be helpful for us if you could find a reproducible test case for that. If already in situation like this, you may try to fix the guarded comments in an external editor - recreate them according to some file that is correct. There is no way to do it automatically - this thing should never happen in the first place.