Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Piggott2011-04-08 13:57:54 -0400
committerMatthew Piggott2011-04-08 13:57:54 -0400
commite3a771b705ec432bd3f54a85b5d1662d895fe101 (patch)
tree29426e02a179afa3f2f8c87ba33f59d19cd87220 /org.eclipse.m2e.discovery
parentac3bdf0a062f420cbfa8d14e993baf8f7616a440 (diff)
downloadm2e-core-e3a771b705ec432bd3f54a85b5d1662d895fe101.tar.gz
m2e-core-e3a771b705ec432bd3f54a85b5d1662d895fe101.tar.xz
m2e-core-e3a771b705ec432bd3f54a85b5d1662d895fe101.zip
Catch & display provisioning errors in the marketplace wizard
Diffstat (limited to 'org.eclipse.m2e.discovery')
-rw-r--r--org.eclipse.m2e.discovery/src/org/eclipse/m2e/internal/discovery/wizards/MavenDiscoveryUi.java5
-rw-r--r--org.eclipse.m2e.discovery/src/org/eclipse/m2e/internal/discovery/wizards/MavenDiscoveryWizard.java14
2 files changed, 17 insertions, 2 deletions
diff --git a/org.eclipse.m2e.discovery/src/org/eclipse/m2e/internal/discovery/wizards/MavenDiscoveryUi.java b/org.eclipse.m2e.discovery/src/org/eclipse/m2e/internal/discovery/wizards/MavenDiscoveryUi.java
index 35a9eb7f..1912bcdd 100644
--- a/org.eclipse.m2e.discovery/src/org/eclipse/m2e/internal/discovery/wizards/MavenDiscoveryUi.java
+++ b/org.eclipse.m2e.discovery/src/org/eclipse/m2e/internal/discovery/wizards/MavenDiscoveryUi.java
@@ -14,6 +14,7 @@ package org.eclipse.m2e.internal.discovery.wizards;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.equinox.internal.p2.discovery.model.CatalogItem;
@@ -56,12 +57,14 @@ public abstract class MavenDiscoveryUi {
* @return
*/
public static boolean install(List<CatalogItem> descriptors, IRunnableWithProgress postInstallHook,
- IRunnableContext context) {
+ IRunnableContext context) throws CoreException {
try {
MavenDiscoveryInstallOperation runner = new MavenDiscoveryInstallOperation(descriptors, postInstallHook, true);
context.run(true, true, runner);
openInstallWizard(runner.getOperation(), true);
} catch (InvocationTargetException e) {
+ if (e.getCause() instanceof CoreException)
+ throw (CoreException) e.getCause();
IStatus status = new Status(IStatus.ERROR, DiscoveryActivator.PLUGIN_ID, NLS.bind(
Messages.ConnectorDiscoveryWizard_installProblems, new Object[] {e.getCause().getMessage()}), e.getCause());
StatusManager.getManager().handle(status, StatusManager.SHOW | StatusManager.BLOCK | StatusManager.LOG);
diff --git a/org.eclipse.m2e.discovery/src/org/eclipse/m2e/internal/discovery/wizards/MavenDiscoveryWizard.java b/org.eclipse.m2e.discovery/src/org/eclipse/m2e/internal/discovery/wizards/MavenDiscoveryWizard.java
index 28c6b034..596b4f27 100644
--- a/org.eclipse.m2e.discovery/src/org/eclipse/m2e/internal/discovery/wizards/MavenDiscoveryWizard.java
+++ b/org.eclipse.m2e.discovery/src/org/eclipse/m2e/internal/discovery/wizards/MavenDiscoveryWizard.java
@@ -11,9 +11,13 @@
package org.eclipse.m2e.internal.discovery.wizards;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.equinox.internal.p2.discovery.Catalog;
import org.eclipse.equinox.internal.p2.ui.discovery.wizards.CatalogPage;
import org.eclipse.equinox.internal.p2.ui.discovery.wizards.DiscoveryWizard;
+import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.m2e.internal.discovery.MavenDiscoveryIcons;
import org.eclipse.m2e.internal.discovery.Messages;
@@ -34,6 +38,14 @@ public class MavenDiscoveryWizard extends DiscoveryWizard {
@Override
public boolean performFinish() {
- return MavenDiscoveryUi.install(getCatalogPage().getInstallableConnectors(), null, getContainer());
+ try {
+ return MavenDiscoveryUi.install(getCatalogPage().getInstallableConnectors(), null, getContainer());
+ } catch(CoreException e) {
+ IWizardPage page = getContainer().getCurrentPage();
+ if (page instanceof WizardPage) {
+ ((WizardPage) page).setMessage(e.getMessage(), IMessageProvider.ERROR);
+ }
+ return false;
+ }
}
}

Back to the top