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 121329 - Wrong lines are locked as if they were GUI builder managed.
Summary: Wrong lines are locked as if they were GUI builder managed.
Status: RESOLVED DUPLICATE of bug 116456
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: PC Windows XP
: P3 blocker (vote)
Assignee: issues@guibuilder
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-11-06 22:52 UTC by marimes
Modified: 2007-11-07 14:08 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Screen Shot Showing Incorrect Locking in Line 2134 (grayed out) (236.71 KB, image/jpeg)
2007-11-06 22:53 UTC, marimes
Details
source code (123.81 KB, text/plain)
2007-11-07 10:57 UTC, marimes
Details
Form (134.78 KB, text/plain)
2007-11-07 10:58 UTC, marimes
Details
Screen schot with wrong insertion of method (438.11 KB, image/jpeg)
2007-11-07 10:59 UTC, marimes
Details

Note You need to log in before you can comment on or make changes to this bug.
Description marimes 2007-11-06 22:52:32 UTC
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.
Comment 1 marimes 2007-11-06 22:53:54 UTC
Created attachment 52628 [details]
Screen Shot Showing Incorrect Locking in Line 2134 (grayed out)
Comment 2 Jiri Prox 2007-11-07 09:16:40 UTC
Please attach the source file. Do you have any steps to reproduce this? 
Which build do you use?
Comment 3 marimes 2007-11-07 10:56:25 UTC
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.
Comment 4 marimes 2007-11-07 10:57:58 UTC
Created attachment 52644 [details]
source code
Comment 5 marimes 2007-11-07 10:58:27 UTC
Created attachment 52645 [details]
Form
Comment 6 marimes 2007-11-07 10:59:36 UTC
Created attachment 52646 [details]
Screen schot with wrong insertion of method
Comment 7 marimes 2007-11-07 11:54:33 UTC
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
Comment 8 Marian Mirilovic 2007-11-07 12:33:10 UTC
Jana please look at this - broken form/source ?
Comment 9 Tomas Pavek 2007-11-07 13:03:56 UTC
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 ***
Comment 10 marimes 2007-11-07 13:42:37 UTC
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!
Comment 11 Tomas Pavek 2007-11-07 14:08:00 UTC
> 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.