diff options
author | Patrik Suzzi | 2016-06-27 12:10:41 +0000 |
---|---|---|
committer | Patrik Suzzi | 2016-06-28 00:24:27 +0000 |
commit | 0f0d8b4f63b7b569f675138bde11bc576f14d9b9 (patch) | |
tree | 69dd8a89cfb0e2c309c9813be9b2c374f616beff | |
parent | 878e1f005bc16bd65c6ec9aa3c55d6b305280b3c (diff) | |
download | eclipse.platform.ui-0f0d8b4f63b7b569f675138bde11bc576f14d9b9.tar.gz eclipse.platform.ui-0f0d8b4f63b7b569f675138bde11bc576f14d9b9.tar.xz eclipse.platform.ui-0f0d8b4f63b7b569f675138bde11bc576f14d9b9.zip |
Bug 496319 - Add Ctrl+C to About box to copy the build ID
Now the "Copy Build Info" handelr adds another line that describes also
O.S.and windowing system information. See examples below:
OS: Windows 10, v.10.0, x86_64 / win32
OS: Linux, v.4.4.0-24-generic, x86_64 / gtk 3.18.9
OS: Linux, v.4.4.0-24-generic, x86_64 / gtk 3.18.9, WebKit 2.4.11
OS: Mac OS X, v.10.11.5, x86_64 / cocoa
Change-Id: I9b51ca27ea80168de2e085e1b786f82f15b472b3
Signed-off-by: Patrik Suzzi <psuzzi@gmail.com>
-rw-r--r-- | bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/commands/CopyBuildIdToClipboardHandler.java | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/commands/CopyBuildIdToClipboardHandler.java b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/commands/CopyBuildIdToClipboardHandler.java index 37908db2dc6..b52c4bf2e41 100644 --- a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/commands/CopyBuildIdToClipboardHandler.java +++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/commands/CopyBuildIdToClipboardHandler.java @@ -12,6 +12,8 @@ package org.eclipse.ui.internal.ide.commands; +import java.util.Properties; + import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; @@ -23,14 +25,27 @@ import org.eclipse.swt.dnd.Transfer; import org.eclipse.ui.internal.ProductProperties; /** - * Copies the main build information to the clipboard. Useful for debugging and - * bug reporting/verification. + * Copies the main build information to the clipboard, including os version and + * windowing system. Useful for debugging and bug reporting/verification. * * @since 3.4 * */ public class CopyBuildIdToClipboardHandler extends AbstractHandler { + /** Platform O.S. */ + private static final String OS_NAME = "os.name"; //$NON-NLS-1$ + /** O.S. Version */ + private static final String OS_VERSION = "os.version"; //$NON-NLS-1$ + /** Platform architecture property name */ + private static final String OSGI_ARCH = "osgi.arch"; //$NON-NLS-1$ + /** Platform windowing system */ + private static final String OSGI_WS = "osgi.ws"; //$NON-NLS-1$ + /** GTK version */ + private static final String SWT_GTK_VERSION = "org.eclipse.swt.internal.gtk.version"; //$NON-NLS-1$ + /** WebKitGTK version */ + static final String SWT_WEBKITGTK_VERSION = "org.eclipse.swt.internal.webkitgtk.version"; //$NON-NLS-1$ + @Override public Object execute(ExecutionEvent event) throws ExecutionException { @@ -44,7 +59,22 @@ public class CopyBuildIdToClipboardHandler extends AbstractHandler { throw new ExecutionException("Product About Text is not properly defined."); //$NON-NLS-1$ } - String toCopy = String.format("%s%n%s%n%s", lines[0], lines[2], lines[3]); //$NON-NLS-1$ + Properties sp = System.getProperties(); + String osInfo = String.format("OS: %s, v.%s, %s / %s", //$NON-NLS-1$ + sp.get(OS_NAME), sp.get(OS_VERSION), sp.get(OSGI_ARCH), sp.get(OSGI_WS)); + + // defined in gtk systems + String gtkVer = sp.getProperty(SWT_GTK_VERSION); + if (gtkVer != null) { + osInfo += String.format(" %s", gtkVer); //$NON-NLS-1$ + } + // defined after launching WebKit, e.g. in Welcome Window + String webkitGtkVer = sp.getProperty(SWT_WEBKITGTK_VERSION); + if (webkitGtkVer != null) { + osInfo += String.format(", WebKit %s", webkitGtkVer); //$NON-NLS-1$ + } + + String toCopy = String.format("%s%n%s%n%s%n%s%n", lines[0], lines[2], lines[3], osInfo); //$NON-NLS-1$ Clipboard clipboard = new Clipboard(null); try { |