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 204180 - "// NOI18N" On setFont() Line Is Not Copied When Form Is Copied
Summary: "// NOI18N" On setFont() Line Is Not Copied When Form Is Copied
Status: RESOLVED FIXED
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: 7.1
Hardware: PC Windows Vista
: P3 normal (vote)
Assignee: issues@guibuilder
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-25 04:29 UTC by MackSix
Modified: 2011-10-26 15:36 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 MackSix 2011-10-25 04:29:50 UTC
The setFont() lines for components on a Form include the "// NOI18N" comment at the end, but if the Form is copied, "NOI18N" is omitted. This is in Generated Code that cannot be edited.
Comment 1 MackSix 2011-10-25 05:15:59 UTC
This is when using Refactoring. If not using Refactoring, it copies correctly.
Comment 2 MackSix 2011-10-25 06:04:22 UTC
Product Version: NetBeans IDE Dev (Build 201110240600)
Java: 1.7.0_01; Java HotSpot(TM) Client VM 21.1-b02
System: Windows Vista version 6.0 running on x86; Cp1252; en_US (nb)
Comment 3 Jan Stola 2011-10-26 15:16:39 UTC
This is caused by FontEditor.getDelegatedPropertyEditor() being stored as the property editor (in .form file) instead of FontEditor (to keep some backward compatibility).

Unfortunately, when the form is loaded then the delegate is not replaced by the original property editor immediately. The relevant code is in FormPropertyEditor.getAllEditors(). Therefore, it is never invoked when the form is invoked using refactoring.

The following test-case demonstrates the problem:
1. Create new JFrame.
2. Put JButton into JFrame.
3. Change the font of JButton to be Italic.
4. Save and Close the form (you can also verify that //NOI18N is generated).

5. Open the form again
   => JFrame is selected and its properties are shown in Properties window.
6. Select and unselect alwaysOnTop property to force code regeneration.
   => //NOI18N disappears from the generated code
7. Select the JButton
   => getAllEditors() is called on the background
8. Select JFrame again and select and unselect alwaysOnTop property
   to force code regeneration.
   => //NOI18N reappears in the generated code.
Comment 4 Jan Stola 2011-10-26 15:36:18 UTC
Fixed - I have modified the code that is loading the form to call getAllEditors() immediately.

Modified file: http://hg.netbeans.org/jet-main/rev/e43b89e60c55