Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Piggott2011-04-01 20:35:20 +0000
committerMatthew Piggott2011-04-01 20:35:20 +0000
commiteb0ded0d3457c3183339a91b067142a0caf7be68 (patch)
treebcd2cab549dd27c908f191ea0e78f469e4772ef7
parent0bf2796ebbad582100158a0cfa41cd3d17829f9d (diff)
downloadm2e-core-eb0ded0d3457c3183339a91b067142a0caf7be68.tar.gz
m2e-core-eb0ded0d3457c3183339a91b067142a0caf7be68.tar.xz
m2e-core-eb0ded0d3457c3183339a91b067142a0caf7be68.zip
Bug 335721 - Add a link to the discovery UI from the SCM wizard
-rw-r--r--org.eclipse.m2e.core.ui/plugin.xml1
-rw-r--r--org.eclipse.m2e.core.ui/schema/discoveryLaunch.exsd102
-rw-r--r--org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/IMavenDiscovery.java18
-rw-r--r--org.eclipse.m2e.discovery/plugin.xml6
-rw-r--r--org.eclipse.m2e.discovery/src/org/eclipse/m2e/internal/discovery/MavenDiscoveryLauncher.java27
-rw-r--r--org.eclipse.m2e.scm/src/org/eclipse/m2e/scm/internal/wizards/MavenCheckoutLocationPage.java48
6 files changed, 201 insertions, 1 deletions
diff --git a/org.eclipse.m2e.core.ui/plugin.xml b/org.eclipse.m2e.core.ui/plugin.xml
index e228adb4..81ab29e9 100644
--- a/org.eclipse.m2e.core.ui/plugin.xml
+++ b/org.eclipse.m2e.core.ui/plugin.xml
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
+ <extension-point id="discoveryLaunch" name="discoveryLaunch" schema="schema/discoveryLaunch.exsd"/>
<extension point="org.eclipse.ui.intro.configExtension">
<configExtension configId="org.eclipse.ui.intro.universalConfig"
diff --git a/org.eclipse.m2e.core.ui/schema/discoveryLaunch.exsd b/org.eclipse.m2e.core.ui/schema/discoveryLaunch.exsd
new file mode 100644
index 00000000..763a152f
--- /dev/null
+++ b/org.eclipse.m2e.core.ui/schema/discoveryLaunch.exsd
@@ -0,0 +1,102 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.m2e.core.ui" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.m2e.core.ui" id="discoveryLaunch" name="discoveryLaunch"/>
+ </appinfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="launcher"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="launcher">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.m2e.core.ui.internal.IMavenDiscovery"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/IMavenDiscovery.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/IMavenDiscovery.java
new file mode 100644
index 00000000..9ce145f9
--- /dev/null
+++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/IMavenDiscovery.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Sonatype, Inc.
+ * 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
+ *
+ * Contributors:
+ * Sonatype, Inc. - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.m2e.core.ui.internal;
+
+import org.eclipse.swt.widgets.Shell;
+
+public interface IMavenDiscovery {
+
+ public void launch(Shell shell);
+}
diff --git a/org.eclipse.m2e.discovery/plugin.xml b/org.eclipse.m2e.discovery/plugin.xml
index ed8c5a2f..04b83705 100644
--- a/org.eclipse.m2e.discovery/plugin.xml
+++ b/org.eclipse.m2e.discovery/plugin.xml
@@ -49,4 +49,10 @@
</adapter>
</factory>
</extension>
+ <extension
+ point="org.eclipse.m2e.core.ui.discoveryLaunch">
+ <launcher
+ class="org.eclipse.m2e.internal.discovery.MavenDiscoveryLauncher">
+ </launcher>
+ </extension>
</plugin>
diff --git a/org.eclipse.m2e.discovery/src/org/eclipse/m2e/internal/discovery/MavenDiscoveryLauncher.java b/org.eclipse.m2e.discovery/src/org/eclipse/m2e/internal/discovery/MavenDiscoveryLauncher.java
new file mode 100644
index 00000000..5f896513
--- /dev/null
+++ b/org.eclipse.m2e.discovery/src/org/eclipse/m2e/internal/discovery/MavenDiscoveryLauncher.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Sonatype, Inc.
+ * 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
+ *
+ * Contributors:
+ * Sonatype, Inc. - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.m2e.internal.discovery;
+
+import org.eclipse.m2e.core.ui.internal.IMavenDiscovery;
+import org.eclipse.swt.widgets.Shell;
+
+
+@SuppressWarnings("restriction")
+public class MavenDiscoveryLauncher implements IMavenDiscovery {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.m2e.core.ui.internal.IMavenDiscovery#launch(org.eclipse.swt.widgets.Shell)
+ */
+ public void launch(Shell shell) {
+ MavenDiscovery.launchWizard(shell);
+ }
+
+}
diff --git a/org.eclipse.m2e.scm/src/org/eclipse/m2e/scm/internal/wizards/MavenCheckoutLocationPage.java b/org.eclipse.m2e.scm/src/org/eclipse/m2e/scm/internal/wizards/MavenCheckoutLocationPage.java
index 2c0a2c2a..46504509 100644
--- a/org.eclipse.m2e.scm/src/org/eclipse/m2e/scm/internal/wizards/MavenCheckoutLocationPage.java
+++ b/org.eclipse.m2e.scm/src/org/eclipse/m2e/scm/internal/wizards/MavenCheckoutLocationPage.java
@@ -16,8 +16,16 @@ import java.util.Set;
import org.apache.maven.model.Scm;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.RegistryFactory;
import org.eclipse.jface.wizard.IWizardContainer;
+import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.m2e.core.project.ProjectImportConfiguration;
+import org.eclipse.m2e.core.ui.internal.IMavenDiscovery;
import org.eclipse.m2e.core.ui.internal.wizards.AbstractMavenWizardPage;
import org.eclipse.m2e.scm.ScmTag;
import org.eclipse.m2e.scm.ScmUrl;
@@ -38,6 +46,7 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Link;
import org.eclipse.swt.widgets.Text;
@@ -66,6 +75,8 @@ public class MavenCheckoutLocationPage extends AbstractMavenWizardPage {
private Button checkoutAllProjectsButton;
+ private Link m2eMarketplace;
+
protected MavenCheckoutLocationPage(ProjectImportConfiguration projectImportConfiguration) {
super("MavenCheckoutLocationPage", projectImportConfiguration);
setTitle(Messages.MavenCheckoutLocationPage_title);
@@ -252,7 +263,42 @@ public class MavenCheckoutLocationPage extends AbstractMavenWizardPage {
}
});
}
-
+ if(Platform.getBundle("org.eclipse.m2e.discovery") != null) {
+ m2eMarketplace = new Link(composite, SWT.NONE);
+ m2eMarketplace.setLayoutData(new GridData(SWT.END, SWT.END, true, true, 5, 1));
+ m2eMarketplace.setText("Find more SCM connectors in the <a>m2e Marketplace</a>");
+ m2eMarketplace.addSelectionListener(new SelectionListener() {
+
+ public void widgetSelected(SelectionEvent e) {
+ IWizardContainer container = getWizard().getContainer();
+ if(container instanceof WizardDialog) {
+ ((WizardDialog) container).close();
+ }
+ IExtensionRegistry registry = RegistryFactory.getRegistry();
+ IExtensionPoint point = registry.getExtensionPoint("org.eclipse.m2e.core.ui.discoveryLaunch");
+ if(point != null) {
+ IExtension[] extension = point.getExtensions();
+ if(extension.length > 0) {
+ for(IConfigurationElement element : extension[0].getConfigurationElements()) {
+ if(element.getName().equals("launcher")) {
+ try {
+ ((IMavenDiscovery) element.createExecutableExtension("class")).launch(Display.getCurrent()
+ .getActiveShell());
+ break;
+ } catch(CoreException e1) {
+ //
+ }
+ }
+ }
+ }
+ }
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+
+ }
+ });
+ }
updatePage();
}

Back to the top