Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Piggott2011-04-01 16:35:20 -0400
committerMatthew Piggott2011-04-01 16:35:20 -0400
commiteb0ded0d3457c3183339a91b067142a0caf7be68 (patch)
treebcd2cab549dd27c908f191ea0e78f469e4772ef7 /org.eclipse.m2e.scm
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
Diffstat (limited to 'org.eclipse.m2e.scm')
-rw-r--r--org.eclipse.m2e.scm/src/org/eclipse/m2e/scm/internal/wizards/MavenCheckoutLocationPage.java48
1 files changed, 47 insertions, 1 deletions
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