Bug 496319 - Add Ctrl+C to About box to copy the build ID
Summary: Add Ctrl+C to About box to copy the build ID
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.4   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 4.7 M1   Edit
Assignee: Patrik Suzzi CLA
QA Contact:
URL:
Whiteboard:
Keywords: noteworthy
Depends on:
Blocks: 498301
  Show dependency tree
 
Reported: 2016-06-17 14:27 EDT by Lars Vogel CLA
Modified: 2016-08-02 10:08 EDT (History)
2 users (show)

See Also:


Attachments
Analysus of the problem and description of the approach. (386.46 KB, application/pdf)
2016-06-22 12:42 EDT, Patrik Suzzi CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lars Vogel CLA 2016-06-17 14:27:07 EDT
We have Ctrl+3 following by "Copy Build id into the clipboard". 

Other IDEs makes that smarter. If you open the "About" dialog you can copy the Build ID via Ctrl+C.

I suggest to add this to our about dialog also.
Comment 1 Lars Vogel CLA 2016-06-17 14:27:38 EDT
Patrik, can you take this one?
Comment 2 Lars Vogel CLA 2016-06-17 14:29:07 EDT
If possible it should include the product name and the version, like:

Eclipse SDK

Version: Neon (4.6)
Build id: I20160524-2000
Comment 3 Patrik Suzzi CLA 2016-06-18 06:37:37 EDT
I'll work on this. It seems feasible. 

In org.eclipse.ui\plugin.xml, I observed that "M1+C" is assigned to the command "org.eclipse.ui.edit.copy", within context "org.eclipse.ui.contexts.dialogAndWindow". No scope is assigned.

To fix this, I see two possible ways:

(1.) Add another "M1+C" bindings in dialogAndWindow, under a different scope. Then hook the command org.eclipse.ui.ide.copyBuildIdCommand. In this case I'm going to re-use the copyBuildId command, and I will edit is so that will return three lines (Product, Version, BuildId). 

(2.) A second, more direct way: Avoid dealing with Binding infrastructure, and directly listen to SWT.KeyDown in the dialog

I think that, Ideally, I should go for (1.) ; But eventually I'll implement the (2.) as it is more direct and will avoid possible troubles within AboutDialog. 

It will be good to
- have feedback 
- know if there are similar cases that we can consider "best-practices". 

Thanks and Regards.
Comment 4 Lars Vogel CLA 2016-06-18 07:50:22 EDT
(In reply to Patrik Suzzi from comment #3)
> I'll work on this. It seems feasible. 
> 
> In org.eclipse.ui\plugin.xml, I observed that "M1+C" is assigned to the
> command "org.eclipse.ui.edit.copy", within context
> "org.eclipse.ui.contexts.dialogAndWindow". No scope is assigned.

I would suggest to use the binding infrastructure. A user might have bound Ctrl+X to another key.
Comment 5 Patrik Suzzi CLA 2016-06-21 08:16:26 EDT
(In reply to Patrik Suzzi from comment #3)
> - know if there are similar cases that we can consider "best-practices". 

I used EGit as model, as reused Ctrl+C for org.eclipse.egit.ui.RepositoriesViewCopyPath 

(In reply to Lars Vogel from comment #4)
> I would suggest to use the binding infrastructure. A user might have bound
> Ctrl+X to another key.

Perfect, this is my plan: 

- edit CopyBuildIdToClipboardHandler, so it will copy three lines
- keep org.eclipse.ui.ide.copyBuildIdCommand as is now.
- add M1+C binding to the command with a new context org.eclipse.ui.AboutDialog
- activate the context when about Dialog is active

The only unclear point is: how to activate the new context in a Legacy dialog. 
-> I'm currently investigating this, then I can proceed. 

( Any suggestion would be useful :)
Comment 6 Patrik Suzzi CLA 2016-06-21 08:29:51 EDT
(In reply to Patrik Suzzi from comment #5)
> The only unclear point is: how to activate the new context in a Legacy
> dialog. 
> -> I'm currently investigating this, then I can proceed. 

I'll follow doc guidelines #1, Getting context instance via singleton: 

IContextService contextService = (IContextService)PlatformUI.getWorkbench()
	.getService(IContextService.class);

[#1] http://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Fguide%2Fworkbench_advext_contexts.htm
Comment 7 Eclipse Genie CLA 2016-06-21 13:00:22 EDT
New Gerrit change created: https://git.eclipse.org/r/75658
Comment 8 Patrik Suzzi CLA 2016-06-21 18:43:48 EDT
With the proposed change, the copyBuildId is now extended, and Ctrl+C will trigger the command, only when the AboutDialog is active.

see: http://i.imgur.com/o1Sapp7.gifv
Comment 9 Patrik Suzzi CLA 2016-06-22 12:42:59 EDT
Created attachment 262595 [details]
Analysus of the problem and description of the approach.
Comment 11 Patrik Suzzi CLA 2016-06-24 06:22:49 EDT
Adding also News and Noteworthy for the feature
Comment 12 Eclipse Genie CLA 2016-06-25 03:12:15 EDT
New Gerrit change created: https://git.eclipse.org/r/75961
Comment 13 Lars Vogel CLA 2016-06-25 03:33:37 EDT
To make it more useful, I suggest to add the GTK version, if invoked on Linux. Patric, what do you think?
Comment 14 Lars Vogel CLA 2016-06-25 03:48:12 EDT
(In reply to Lars Vogel from comment #13)
> To make it more useful, I suggest to add the GTK version, if invoked on
> Linux. Patric, what do you think?

Also the OS system? I think that would be useful for bug triage.
Comment 15 Patrik Suzzi CLA 2016-06-26 05:59:07 EDT
(In reply to Lars Vogel from comment #14)
> (In reply to Lars Vogel from comment #13)
> > To make it more useful, I suggest to add the GTK version, if invoked on
> > Linux. Patric, what do you think?
> 
> Also the OS system? I think that would be useful for bug triage.

It is a great Idea! 

For Linux, I suggest to report also the version of libwebkitgtk.

Adding Alex in c/c as he might be interested.
Comment 16 Eclipse Genie CLA 2016-06-27 08:11:01 EDT
New Gerrit change created: https://git.eclipse.org/r/76002
Comment 17 Patrik Suzzi CLA 2016-06-27 10:02:11 EDT
(In reply to Eclipse Genie from comment #16)
> New Gerrit change created: https://git.eclipse.org/r/76002

After last change, 
This is a sample of the Ctrl+C result in three different systems:

Eclipse SDK
Version: Neon (4.6)
Build id: I20160606-1100
OS: Mac OS X, v.10.11.5, x86_64 / cocoa

Eclipse SDK
Version: Neon (4.6)
Build id: I20160606-1100
OS: Linux, v.4.4.0-24-generic, x86_64 / gtk,v. 3.18.9

Eclipse SDK
Version: Neon (4.6)
Build id: I20160606-1100
OS: Windows 10, v.10.0, x86_64 / win32

Note: I was not able to get the libwebkitgtk used, as for this is required to deal directly with the O.S.
Comment 18 Lars Vogel CLA 2016-06-27 10:11:35 EDT
Looks great but I suggest to drop the ,v. in the the Gtk info. So only: "gtk 3.18.9" instead of "gtk,v. 3.18.9".
Comment 19 Patrik Suzzi CLA 2016-06-27 11:35:57 EDT
Ok. 

See also Bug 496854
Comment 22 Patrik Suzzi CLA 2016-06-30 08:22:31 EDT
Reopen to fix a minor bug: the id in the N&N: 

The id below should be edited to remove the last character (last hypen)

ctrl-c-binding-to-copy-build-information-in-about-dialog-
Comment 23 Eclipse Genie CLA 2016-06-30 08:26:00 EDT
New Gerrit change created: https://git.eclipse.org/r/76322
Comment 25 Eclipse Genie CLA 2016-07-06 00:00:44 EDT
New Gerrit change created: https://git.eclipse.org/r/76621