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 167893 - Copy/Paste does not work for the properties node
Summary: Copy/Paste does not work for the properties node
Status: RESOLVED FIXED
Alias: None
Product: utilities
Classification: Unclassified
Component: Properties (show other bugs)
Version: 6.x
Hardware: All Linux
: P3 blocker (vote)
Assignee: Victor Vasilyev
URL:
Keywords: NETFIX
Depends on:
Blocks:
 
Reported: 2009-06-30 14:55 UTC by Vojtech Sigler
Modified: 2010-04-08 11:03 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Changed paste implementation of PropertiesDataNode (8.48 KB, patch)
2010-04-07 15:44 UTC, kapitarg
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Vojtech Sigler 2009-06-30 14:55:08 UTC
Product Version: NetBeans IDE Dev (Build 200906300200)
Java: 1.6.0_14; Java HotSpot(TM) Client VM 14.0-b16
System: Linux version 2.6.28-13-generic running on i386; UTF-8; en_US (nb)

If I expand a properties node and select a subnode, then invoke copy, nothing is copied. By that I mean that the Paste
action is greyed out on the properties node. Even copy+paste between two different .properties files does not work.
Invoking paste in a text file also produces nothing.
Comment 1 Victor Vasilyev 2009-09-17 19:37:45 UTC
It is valid issue. Additional investigation is needed to understand why the implementation doesn't work.

Note, the Architecture Description file "No answer" here:
http://hg.netbeans.org/main/file/08f0948ec986/properties/arch.xml#l473
Comment 2 Jiri Kovalsky 2010-03-26 14:48:08 UTC
This issue was added to the list of NetFIX [1] candidates. If module owner does not agree, please speak up. Thanks!

[1] http://wiki.netbeans.org/NetFIXIssues
Comment 3 kapitarg 2010-04-07 15:44:31 UTC
Created attachment 96867 [details]
Changed paste implementation of PropertiesDataNode

I think the problem is that the properties files are represented by
PropertiesDataNodes in the project tree. But this class creates PasteTypes only if the clipboard contains a PropertiesLocalNode. However the subnodes of a properties file are KeyNodes. So when they are copied and the properties file is right clicked, no PasteType instances are created, so the paste action is greyed out.

The strange thing is, that the class PropertiesLocalNode already contains a KeyNode based paste implementation, but PropertiesLocalNodes are not on the project tree (at least I never saw them). They are instantiated only when a properties file is displayed in the editor.

Even if I customize the properties file by adding a new locale, there will be 2 single files, both represented by PropertiesDataNodes (no PropertiesLocalNodes in between).

So in the patch I copied most of the paste implementation from ProperiesLocalNode to replace the paste related stuff in PropertiesDataNode. So works now. But since I only have limited knowledge of the module I'm not sure that this is the best thing to do here. Could you please have a look? Any comments and suggestions are welcome.
Comment 4 Jiri Kovalsky 2010-04-07 16:43:40 UTC
Victor, can you please review Gabor's patch and integrate it if you don't have any objections? Thanks!
Comment 5 Victor Vasilyev 2010-04-08 01:20:26 UTC
The proposed patch is OK from viewpoint of copy/paste of key nodes, and I've committed it with minor refactoring
http://hg.netbeans.org/main/rev/3e943de0f2c6 

Nevertheless, I've rollback these changes, because it destroys copy/paste for nodes of the properties files
http://hg.netbeans.org/main/rev/34cd3b509aca

So we need have copy/paste processing for both key nodes and nodes of the properties files.
Comment 6 Jiri Kovalsky 2010-04-08 07:15:35 UTC
Thanks Victor for the review & polishing & integration and especially thank you Gabor for your patch!
Comment 7 Victor Vasilyev 2010-04-08 11:03:55 UTC
Fixed again in the main trunk:
http://hg.netbeans.org/main/rev/14ab22d60b21

I didn't notice very small bug yesterday. Now, it is fixed, and seems all functionality is working well.

Gabor, 
Thanks a million for the patch. It has made the NetBeans a bit better. Good work.