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 218932 - Patch for: Backport of the tooltip-Window to CVS-module which allows to copy the "commit message"/"author"/"date" via the annotationbar
Summary: Patch for: Backport of the tooltip-Window to CVS-module which allows to copy ...
Status: RESOLVED FIXED
Alias: None
Product: versioncontrol
Classification: Unclassified
Component: CVS (show other bugs)
Version: 7.3
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Ondrej Vrabec
URL:
Keywords: NETFIX, PATCH_AVAILABLE
Depends on:
Blocks:
 
Reported: 2012-09-25 05:03 UTC by markiewb
Modified: 2013-01-29 03:27 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
Screenshot showing the position of the future action (11.21 KB, image/png)
2012-09-25 05:04 UTC, markiewb
Details
Proposed patch (3.61 KB, patch)
2012-11-16 00:00 UTC, markiewb
Details | Diff
Patch with tooltip window (15.56 KB, patch)
2012-11-16 19:49 UTC, markiewb
Details | Diff
Patch with tooltip window - sanatized (13.13 KB, patch)
2012-11-16 19:55 UTC, markiewb
Details | Diff
Patch with tooltip window - sanatized - with StringBuilder (13.43 KB, patch)
2012-11-19 15:55 UTC, markiewb
Details | Diff
Unavailable AnnotationLine.getCommitMessage (92.19 KB, image/png)
2012-11-19 17:08 UTC, markiewb
Details
patch with tooltip window - sanatized - with StringBuilder - lines correctly displayed (13.69 KB, patch)
2012-11-20 09:16 UTC, Ondrej Vrabec
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description markiewb 2012-09-25 05:03:09 UTC
[ BUILD # : 201209110001 ]
[ JDK VERSION : 1.6.35 ]

Add action "copy annotation text" to the context menu of an annotation

See screenshot
Comment 1 markiewb 2012-09-25 05:04:27 UTC
Created attachment 124836 [details]
Screenshot showing the position of the future action
Comment 2 markiewb 2012-11-16 00:00:43 UTC
Created attachment 127900 [details]
Proposed patch

I like to propose a patch to solve this issue. 
It adds a simple action which copies the current commit message of the line to the clipboard.

Please review, discuss and commit. Thank you. markiewb
Comment 3 Ondrej Vrabec 2012-11-16 09:42:51 UTC
i think a much better solution would be to implement the same popup window for a right-click as in mercurial, subversion or git (ToolTipWindow.java). Then user could choose to copy message, username, date or anything else present to the clipboard. No offense but i don't think action "Copy message to clipboard" as a valid single action visible in a popup menu. What if i wanted to copy the username, should we add another action?
Are you willing to implement the ToolTipWinow? I believe you already know how it works since already fixed something in there, right?
Comment 4 markiewb 2012-11-16 19:49:45 UTC
Created attachment 127962 [details]
Patch with tooltip window

(In reply to comment #3)
> i think a much better solution would be to implement the same popup window for
> a right-click as in mercurial, subversion or git (ToolTipWindow.java). Then
> user could choose to copy message, username, date or anything else present to
> the clipboard. No offense but i don't think action "Copy message to clipboard"
> as a valid single action visible in a popup menu. What if i wanted to copy the
> username, should we add another action?
> Are you willing to implement the ToolTipWinow? I believe you already know how
> it works since already fixed something in there, right?

Valid arguments. I ported the TooltipWindow from the git module to the cvs module. See patch. But i had to remove all the hyperlinking stuff.

Please have a look.
Comment 5 markiewb 2012-11-16 19:55:55 UTC
Created attachment 127963 [details]
Patch with tooltip window - sanatized
Comment 6 Ondrej Vrabec 2012-11-19 10:10:48 UTC
OV1: use StringBuilder instead of StringBuffer in getCommitMessage()
OV2: You pass commitMessage as a parameter to ToolTipWindow in the same format as it's display in the tooltip over a line annotation. That means all "\n" are replaced with "<br>" and the tooltip window displays the commit message incorrectly. Pass just al.getMessage() and do not escape anything in the message.
Comment 7 markiewb 2012-11-19 15:55:06 UTC
Created attachment 128078 [details]
Patch with tooltip window - sanatized - with StringBuilder

(In reply to comment #6)
> OV1: use StringBuilder instead of StringBuffer in getCommitMessage()
Done - see new patch

> OV2: You pass commitMessage as a parameter to ToolTipWindow in the same format
> as it's display in the tooltip over a line annotation. That means all "\n" are
> replaced with "<br>" and the tooltip window displays the commit message
> incorrectly. Pass just al.getMessage() and do not escape anything in the
> message.

Thanks for the suggestion, BUT sorry this is not possible. The org.netbeans.lib.cvsclient.command.annotate.AnnotateLine does not provide getMessage(). That was the reason i had to pass-through the commit message from AnnotationBar to ToolTipWindow to ToolTipContentPanel. The impl for Hg/Git... provide such a method, but the CVS-code is much older.
Comment 8 Ondrej Vrabec 2012-11-19 16:08:10 UTC
> Thanks for the suggestion, BUT sorry this is not possible. The
> org.netbeans.lib.cvsclient.command.annotate.AnnotateLine does not provide
> getMessage(). That was the reason i had to pass-through the commit message from
> AnnotationBar to ToolTipWindow to ToolTipContentPanel. The impl for Hg/Git...
> provide such a method, but the CVS-code is much older.
What i meant was that:
> new TooltipWindow(this, al, getCommitMessage(al));
is wrong because getCommitMessage method escapes the commit message so it can be viewed in HTML (replaced \n with <br> etc.). You should simply instantiate the window as:
> new TooltipWindow(this, al, al.getCommitMessage());
because the ToolTipWindow does not display HTML but a JTextPane.

Test your code with commit messages containing multiple lines and you'll see what i mean.
Comment 9 markiewb 2012-11-19 17:08:32 UTC
Created attachment 128083 [details]
Unavailable AnnotationLine.getCommitMessage

(In reply to comment #8)
> > Thanks for the suggestion, BUT sorry this is not possible. The
> > org.netbeans.lib.cvsclient.command.annotate.AnnotateLine does not provide
> > getMessage(). That was the reason i had to pass-through the commit message from
> > AnnotationBar to ToolTipWindow to ToolTipContentPanel. The impl for Hg/Git...
> > provide such a method, but the CVS-code is much older.
> What i meant was that:
> > new TooltipWindow(this, al, getCommitMessage(al));
> is wrong because getCommitMessage method escapes the commit message so it can
> be viewed in HTML (replaced \n with <br> etc.). You should simply instantiate
> the window as:
> > new TooltipWindow(this, al, al.getCommitMessage());
> because the ToolTipWindow does not display HTML but a JTextPane.
> 
> Test your code with commit messages containing multiple lines and you'll see
> what i mean.

Sorry i do not get it. In my sources there is no AnnotationLine.getCommitMessage method available. See screenshot.
Comment 10 Ondrej Vrabec 2012-11-19 20:22:35 UTC
i see, you're right, sorry. Anyway, my concern and point was completely different (that TTWindow cannot use return value from getCommitMessage(al)). I'll update the patch tomorrow to show what i mean.
Comment 11 Ondrej Vrabec 2012-11-20 09:16:32 UTC
Created attachment 128116 [details]
patch with tooltip window - sanatized - with StringBuilder - lines correctly displayed

updated patch that correctly handles commit messages with more than one line and displays the message correctly in the TTW
Comment 12 Ondrej Vrabec 2013-01-28 13:20:19 UTC
thanks for the patch, applied as http://hg.netbeans.org/core-main/rev/54ff034b9bce
Comment 13 Quality Engineering 2013-01-29 03:27:57 UTC
Integrated into 'main-golden', will be available in build *201301290001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/54ff034b9bce
User: Benno Markiewicz <markiewb@netbeans.org>
Log: Issue #218932 - Backport of the tooltip-Window to CVS-module which allows to copy the commit message/author/date via the annotationbar