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 170215 - Copy the contents of 'Usages' or 'Search' pane to the clipboard does not work
Summary: Copy the contents of 'Usages' or 'Search' pane to the clipboard does not work
Status: RESOLVED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: David Strupl
URL:
Keywords: NETFIX
: 125275 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-08-11 15:52 UTC by crimcat
Modified: 2011-08-02 11:52 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Proposed patch (12.32 KB, patch)
2010-09-06 16:09 UTC, Ralph Ruijs
Details | Diff
updated patch (12.32 KB, patch)
2010-09-07 14:40 UTC, Ralph Ruijs
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description crimcat 2009-08-11 15:52:20 UTC
Hello,

Let's have a C/C++ project.
Then try to search for usages of any given name in your program - Usages pane is opened automatically.
Then I need to have the contents of this page be copied into the clipboard to use in documentation or elsewhere.
I press Ctrl-A to select all lines, then Ctrl-C to copy.
In my notepad I then press Ctrl-V. Instead of expected list of files (or, maybe, found instances) I have the following:
rg.netbeans.modules.refactoring.java.ui.tree.ProjectTreeElement@1fb42e6
org.netbeans.modules.refactoring.java.ui.tree.FileTreeElement@fc533d
org.netbeans.modules.refactoring.java.ui.tree.FileTreeElement@12b2373
org.netbeans.modules.refactoring.java.ui.tree.FileTreeElement@177e312
org.netbeans.modules.refactoring.java.ui.tree.FileTreeElement@17b4ff1
<...lots of lines are skipped...>

The same happens if I try to copy from the 'Search Results' pane, put the copied content is a bit different, like this:
org.netbeans.modules.search.ResultTreeModel@4293a7[Found 146 match(es) in 50 file(s).]
org.netbeans.modules.search.MatchingObject@67f452[filename1.cc]
org.netbeans.modules.search.MatchingObject@1e253b6[filename2.c]
org.netbeans.modules.search.MatchingObject@88e2b9[filename3.c]
org.netbeans.modules.search.MatchingObject@585612[filename4.c]
org.netbeans.modules.search.MatchingObject@11117d4[filename5.c]
<...lots of lines are skipped...>

I think this is serious bug, so I prioritize it as P2.
Comment 1 Leonid Lenyashin 2009-08-12 15:22:36 UTC
Need to be fixed in 6.8. Does not qualify as P2, but still serious. We need to check if it is C/C++ specific [it does
not look so to me]. If it is not, then needs to be transfered to another component.
Comment 2 nnnnnk 2009-08-12 17:20:55 UTC
There is the same problem with Usages and Search Results in Java.
So it's common problem.
Comment 3 darkstar 2010-03-27 16:39:19 UTC
I'd like to NetFIX [1] this bug. Is it possible?
[1] http://wiki.netbeans.org/NetFIX
Comment 4 darkstar 2010-03-29 18:31:11 UTC
I see two possible ways to go:

1. copy the HTML that is shown in the "Usages"/"Search" pane

2. copy plain text without colouring or any other markup

The first solution would be easier to implement, but the second one would probably be more practical. So which one to choose?

(Some kind of context menu with the above two options is completely out of scope, I guess.)
Comment 5 David Strupl 2010-04-01 08:16:20 UTC
Please note that you can actually but both flavors to the clipboard and the target editor might select what it likes to paste when you paste it.
Comment 6 Jiri Kovalsky 2010-04-01 08:29:16 UTC
In my opinion it would be better to copy the text with the markup. You can always get rid of it quickly but formatting it is way harder. Would you agree Ondro?
Comment 7 Jiri Kovalsky 2010-04-01 08:30:51 UTC
BTW, David Strupl agreed to review & integrate the possible NetFIX patch.
Comment 8 Ondrej Langr 2010-04-01 15:08:24 UTC
(In reply to comment #6)
> In my opinion it would be better to copy the text with the markup. You can
> always get rid of it quickly but formatting it is way harder. Would you agree
> Ondro?

What sounds best to me is what dstrupl mentioned. You copy and when you paste, the client pastes the type it can handle. I copy part of a webpage (with some headers and links) and paste them into a rich text editor (office, keynote) - it gets pasted as rich text. If I past into a simple txt file, only text gets pasted.
Comment 9 Jiri Kovalsky 2010-04-01 15:14:46 UTC
I agree. Michael, can you implement it this way?
Comment 10 darkstar 2010-04-02 22:16:58 UTC
So I'd have to dive into the Nodes API and deal with DataFlavor, right?
I think I'll give it a try.
Comment 11 David Strupl 2010-04-03 10:41:11 UTC
You will need Nodes API only in case the results tree is implemented using nodes and explorer - I didn't check that. And yes data flavors are part of the swing clipboard APIs if I am not mistaken. BTW first googling around might give some useful hints regarding clipboard in NetBeans.
Comment 12 Ralph Ruijs 2010-09-03 15:34:07 UTC
It looks like this bug isn't being worked on at the moment, is it ok if I take a shot at it?
Comment 13 David Strupl 2010-09-03 17:40:01 UTC
In response to Comment #12 : Sure, just assign it to yourself and give it a try. Please attach a patch when you have something worth looking at. If you stop working on it (and its not finished) please assign back to the original alias (issues@editor.netbeans.org). Thanks and good luck.
Comment 14 Ralph Ruijs 2010-09-06 16:09:30 UTC
Created attachment 101898 [details]
Proposed patch

I've added copy support in the refactoring panel, the same way as it is done for the property sheet api. It supports plain text and html output. I'm not totally happy with the internal classes, but that's the way it is implemented in the property sheets.
Comment 15 David Strupl 2010-09-07 13:59:18 UTC
Looks good to me. Just a small question: why is the following line commented out?

+//            this.plainData = plainData;

I assume you don't have write access, right? If you think that it is ready to be integrated just let me know (assign the bug to myself) and I will apply it for 6.10. Thanks.
Comment 16 Ralph Ruijs 2010-09-07 14:38:48 UTC
(In reply to comment #15) : that's a mistake, I used it during some manual testing. I will attach a new patch and assign it back to you. Thanks!
Comment 17 Ralph Ruijs 2010-09-07 14:40:11 UTC
Created attachment 101919 [details]
updated patch
Comment 18 David Strupl 2010-09-08 12:03:59 UTC
The patch has been applied to my team repository as
http://hg.netbeans.org/jet-main/rev/f43403a03e3e
-- it should reach the main-silver repository today. Marking the issue as fixed. Thanks to everyone involved, especially Ralph for the actual fix.
Comment 19 Ralph Ruijs 2011-08-02 11:52:03 UTC
*** Bug 125275 has been marked as a duplicate of this bug. ***