Bug 525426 - a Help > Contribute menu

Signed-off-by: Mickael Istria <mistria@redhat.com>
Change-Id: I0d7148722a7748eed9103a14540eddfa4f34c52b
diff --git a/packages/org.eclipse.epp.package.common/.classpath b/packages/org.eclipse.epp.package.common/.classpath
new file mode 100644
index 0000000..eca7bdb
--- /dev/null
+++ b/packages/org.eclipse.epp.package.common/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/packages/org.eclipse.epp.package.common/.project b/packages/org.eclipse.epp.package.common/.project
index f8aabc7..7822934 100644
--- a/packages/org.eclipse.epp.package.common/.project
+++ b/packages/org.eclipse.epp.package.common/.project
@@ -6,6 +6,11 @@
 	</projects>
 	<buildSpec>
 		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
 			<name>org.eclipse.pde.ManifestBuilder</name>
 			<arguments>
 			</arguments>
@@ -18,5 +23,6 @@
 	</buildSpec>
 	<natures>
 		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
 	</natures>
 </projectDescription>
diff --git a/packages/org.eclipse.epp.package.common/.settings/org.eclipse.jdt.core.prefs b/packages/org.eclipse.epp.package.common/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..0c68a61
--- /dev/null
+++ b/packages/org.eclipse.epp.package.common/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/packages/org.eclipse.epp.package.common/META-INF/MANIFEST.MF b/packages/org.eclipse.epp.package.common/META-INF/MANIFEST.MF
index d177946..a15c054 100644
--- a/packages/org.eclipse.epp.package.common/META-INF/MANIFEST.MF
+++ b/packages/org.eclipse.epp.package.common/META-INF/MANIFEST.MF
@@ -4,7 +4,12 @@
 Bundle-SymbolicName: org.eclipse.epp.package.common;singleton:=true
 Bundle-Version: 4.8.0.qualifier
 Bundle-Vendor: Eclipse Packaging Project
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
 Require-Bundle: org.eclipse.platform,
- org.eclipse.equinox.app
+ org.eclipse.equinox.app,
+ org.eclipse.ui,
+ org.eclipse.core.commands,
+ org.eclipse.core.runtime,
+ org.eclipse.ui.workbench
+Bundle-Localization: plugin
 Eclipse-BundleShape: dir
diff --git a/packages/org.eclipse.epp.package.common/build.properties b/packages/org.eclipse.epp.package.common/build.properties
index 8871737..3309b61 100644
--- a/packages/org.eclipse.epp.package.common/build.properties
+++ b/packages/org.eclipse.epp.package.common/build.properties
@@ -1,3 +1,9 @@
+source.. = src/
+output.. = bin/
 bin.includes = META-INF/,\
                about.html,\
-               splash.bmp
+               splash.bmp,\
+               plugin.xml,\
+               plugin.properties,\
+               .,\
+               icons/
diff --git a/packages/org.eclipse.epp.package.common/icons/star.png b/packages/org.eclipse.epp.package.common/icons/star.png
new file mode 100644
index 0000000..ab87d9d
--- /dev/null
+++ b/packages/org.eclipse.epp.package.common/icons/star.png
Binary files differ
diff --git a/packages/org.eclipse.epp.package.common/icons/star@2x.png b/packages/org.eclipse.epp.package.common/icons/star@2x.png
new file mode 100644
index 0000000..ea917ab
--- /dev/null
+++ b/packages/org.eclipse.epp.package.common/icons/star@2x.png
Binary files differ
diff --git a/packages/org.eclipse.epp.package.common/plugin.properties b/packages/org.eclipse.epp.package.common/plugin.properties
new file mode 100644
index 0000000..8b73d83
--- /dev/null
+++ b/packages/org.eclipse.epp.package.common/plugin.properties
@@ -0,0 +1,9 @@
+###############################################################################
+# Copyright (c) 2017 Red Hat Inc. and others
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+###############################################################################
+contribute.command.label=Contribute
+contribute.command.desc=Contribute to the development and success of the Eclipse IDE!
\ No newline at end of file
diff --git a/packages/org.eclipse.epp.package.common/plugin.xml b/packages/org.eclipse.epp.package.common/plugin.xml
new file mode 100644
index 0000000..878de10
--- /dev/null
+++ b/packages/org.eclipse.epp.package.common/plugin.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+   <extension
+         point="org.eclipse.ui.commands">
+      <command
+            defaultHandler="org.eclipse.epp.common.ContributeHandler"
+            description="%contribute.command.desc"
+            id="org.eclipse.epp.package.common.contribute"
+            name="%contribute.command.label">
+      </command>
+   </extension>
+   <extension
+         point="org.eclipse.ui.menus">
+      <menuContribution
+            allPopups="false"
+            locationURI="menu:help?after=about">
+         <command
+               commandId="org.eclipse.epp.package.common.contribute"
+               style="push">
+         </command>
+      </menuContribution>
+   </extension>
+   <extension
+         point="org.eclipse.ui.commandImages">
+      <image
+            commandId="org.eclipse.epp.package.common.contribute"
+            icon="icons/star.png">
+      </image>
+   </extension>
+
+</plugin>
diff --git a/packages/org.eclipse.epp.package.common/src/org/eclipse/epp/common/ContributeHandler.java b/packages/org.eclipse.epp.package.common/src/org/eclipse/epp/common/ContributeHandler.java
new file mode 100644
index 0000000..f4d29d4
--- /dev/null
+++ b/packages/org.eclipse.epp.package.common/src/org/eclipse/epp/common/ContributeHandler.java
@@ -0,0 +1,46 @@
+/****************************************************************************
+* Copyright (c) 2017 Red Hat Inc. and others
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Eclipse Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+package org.eclipse.epp.common;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.swt.program.Program;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.browser.IWebBrowser;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+public class ContributeHandler extends AbstractHandler {
+
+	private static final String CONTRIBUTE_URL = "https://www.eclipse.org/contribute/";
+
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+		IWorkbenchWindow activeWorkbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event);
+		if (activeWorkbenchWindow == null) {
+			return new Status(IStatus.ERROR, "org.eclipse.epp.package.common", "No active workbench window");
+		}
+		try {
+			IWebBrowser browser = activeWorkbenchWindow.getWorkbench().getBrowserSupport().createBrowser(getClass().getName());
+			browser.openURL(new URL(CONTRIBUTE_URL));
+			return Status.OK_STATUS;
+		} catch (PartInitException e) {
+			Program.launch(CONTRIBUTE_URL);
+			return new Status(IStatus.OK, "org.eclipse.epp.package.common", e.getMessage(), e);
+		} catch (MalformedURLException e) {
+			return new Status(IStatus.ERROR, "org.eclipse.epp.package.common", e.getMessage(), e);
+		}
+	}
+
+}