summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorMatthew Piggott2011-03-03 15:38:59 (EST)
committer Pascal Rapicault2011-03-03 16:35:21 (EST)
commit35dc628bf776730c9e244fc82641cb87f5041e8b (patch)
tree413820f1972a165e3fca00d0fef664619e7ffef2
parentd72dde2c91da6d04a18455e291adc804b87dbdee (diff)
downloadm2e-core-35dc628bf776730c9e244fc82641cb87f5041e8b.zip
m2e-core-35dc628bf776730c9e244fc82641cb87f5041e8b.tar.gz
m2e-core-35dc628bf776730c9e244fc82641cb87f5041e8b.tar.bz2
Bug 337989 - Merged Discovery Install
-rw-r--r--org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/Messages.java2
-rw-r--r--org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/messages.properties1
-rw-r--r--org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/wizards/LifecycleMappingPage.java21
-rw-r--r--org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/wizards/MavenImportWizard.java22
4 files changed, 39 insertions, 7 deletions
diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/Messages.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/Messages.java
index 73c8881..da79e2a 100644
--- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/Messages.java
+++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/Messages.java
@@ -86,6 +86,8 @@ public class Messages extends NLS {
public static String IndexedArtifactNode_no_pack;
+ public static String LifecycleMappingPage_errorCreatingDiscoveryPage;
+
public static String LocalArchetypeCatalogDialog_btnBrowse;
public static String LocalArchetypeCatalogDialog_dialog_title;
diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/messages.properties b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/messages.properties
index 1e291b6..3af8a76 100644
--- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/messages.properties
+++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/messages.properties
@@ -30,6 +30,7 @@ EnableNatureAction_job_enable=Enabling Maven Dependency Management
EnableNatureAction_wizard_shell=Create new POM
GlobalRepositoriesNode_name=Global Repositories
IndexedArtifactNode_no_pack=[No Packaging]
+LifecycleMappingPage_errorCreatingDiscoveryPage=An error occurred creating discovery page.
LocalArchetypeCatalogDialog_btnBrowse=&Browse...
LocalArchetypeCatalogDialog_dialog_title=Select Archetype catalog
LocalArchetypeCatalogDialog_error_empty=Archetype catalog is empty
diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/wizards/LifecycleMappingPage.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/wizards/LifecycleMappingPage.java
index 1278d2d..8b91b0f 100644
--- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/wizards/LifecycleMappingPage.java
+++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/wizards/LifecycleMappingPage.java
@@ -34,6 +34,7 @@ import org.eclipse.jface.viewers.TreeViewerColumn;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.m2e.core.MavenPlugin;
import org.eclipse.m2e.core.internal.lifecyclemapping.discovery.ILifecycleMappingElementKey;
import org.eclipse.m2e.core.internal.lifecyclemapping.discovery.IMavenDiscovery;
import org.eclipse.m2e.core.internal.lifecyclemapping.discovery.IMavenDiscoveryProposal;
@@ -43,6 +44,7 @@ import org.eclipse.m2e.core.internal.lifecyclemapping.discovery.ProjectLifecycle
import org.eclipse.m2e.core.project.MavenProjectInfo;
import org.eclipse.m2e.core.project.ProjectImportConfiguration;
import org.eclipse.m2e.core.ui.internal.MavenImages;
+import org.eclipse.m2e.core.ui.internal.Messages;
import org.eclipse.m2e.core.ui.internal.lifecyclemapping.AggregateMappingLabelProvider;
import org.eclipse.m2e.core.ui.internal.lifecyclemapping.ILifecycleMappingLabelProvider;
import org.eclipse.m2e.core.ui.internal.lifecyclemapping.LifecycleMappingConfiguration;
@@ -60,6 +62,8 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeColumn;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
@@ -70,6 +74,8 @@ import org.eclipse.swt.widgets.TreeColumn;
@SuppressWarnings("restriction")
public class LifecycleMappingPage extends WizardPage {
+ private static final Logger log = LoggerFactory.getLogger(MavenPlugin.class);
+
private static final int MAVEN_INFO_IDX = 0;
private static final int ECLIPSE_INFO_IDX = 1;
@@ -94,8 +100,6 @@ public class LifecycleMappingPage extends WizardPage {
setTitle("Setup Maven plugin connectors");
setDescription("Discover and map Eclipse plugins to Maven plugin goal executions.");
adapterManager = Platform.getAdapterManager();
- setPageComplete(true);
-
}
/**
@@ -360,7 +364,6 @@ public class LifecycleMappingPage extends WizardPage {
loading = true;
treeViewer.refresh();
final IMavenDiscovery discovery = ((AbstractMavenProjectWizard) getWizard()).getDiscovery();
-
try {
getContainer().run(true, true, new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
@@ -397,7 +400,8 @@ public class LifecycleMappingPage extends WizardPage {
}
loading = false;
treeViewer.refresh();
-
+ setPageComplete(mappingConfiguration.getSelectedProposals().isEmpty());
+ getWizard().getContainer().updateButtons();
}
// protected String getMojoExecutionColumnText(MojoExecutionMappingConfiguration execution, int columnIndex) {
@@ -476,6 +480,9 @@ public class LifecycleMappingPage extends WizardPage {
}
}
+ public boolean canFlipToNextPage() {
+ return getNextPage() != null;
+ }
protected Collection<MavenProjectInfo> getProjects() {
return ((MavenImportWizard) getWizard()).getProjects();
@@ -499,7 +506,7 @@ public class LifecycleMappingPage extends WizardPage {
@Override
public IWizardPage getNextPage() {
IImportWizardPageFactory discovery = ((AbstractMavenProjectWizard) getWizard()).getPageFactory();
- if (discovery == null) {
+ if(discovery == null) {
return getWizard().getNextPage(this);
}
@@ -512,9 +519,9 @@ public class LifecycleMappingPage extends WizardPage {
discoveryPage.setWizard(getWizard());
}
} catch(InvocationTargetException e) {
- // TODO Auto-generated catch block
+ log.warn(Messages.LifecycleMappingPage_errorCreatingDiscoveryPage, e);
} catch(InterruptedException e) {
- // TODO Auto-generated catch block
+ // Thrown when the user cancels
}
}
return discoveryPage != null ? discoveryPage : getWizard().getNextPage(this);
diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/wizards/MavenImportWizard.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/wizards/MavenImportWizard.java
index b8e6feb..6644501 100644
--- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/wizards/MavenImportWizard.java
+++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/wizards/MavenImportWizard.java
@@ -24,6 +24,7 @@ import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.m2e.core.MavenPlugin;
import org.eclipse.m2e.core.internal.lifecyclemapping.discovery.IMavenDiscovery;
import org.eclipse.m2e.core.internal.lifecyclemapping.discovery.IMavenDiscoveryProposal;
@@ -151,6 +152,15 @@ public class MavenImportWizard extends AbstractMavenProjectWizard implements IIm
*/
@Override
public boolean canFinish() {
+ if(isCurrentPageKnown()) {
+ // Discovery pages aren't added to the wizard in case they need to go away
+ IWizardPage cPage = getContainer().getCurrentPage();
+ while(cPage != null && cPage.isPageComplete()) {
+ cPage = cPage.getNextPage();
+ }
+ return cPage == null || cPage.isPageComplete();
+ }
+
//in here make sure that the lifecycle page is hidden from view when the mappings are fine
//but disable finish when there are some problems (thus force people to at least look at the other page)
boolean complete = page.isPageComplete();
@@ -163,6 +173,18 @@ public class MavenImportWizard extends AbstractMavenProjectWizard implements IIm
return super.canFinish();
}
+ /*
+ * Is the current page known by the wizard (ie, has it been passed to addPage())
+ */
+ private boolean isCurrentPageKnown() {
+ for(IWizardPage p : getPages()) {
+ if(p == getContainer().getCurrentPage()) {
+ return false;
+ }
+ }
+ return true;
+ }
+
/**
* @return
*/