Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Piggott2011-04-21 11:27:52 -0400
committerMatthew Piggott2011-04-21 15:18:28 -0400
commit8456e9bc35a129622975e07e02c7b20d05a0c56e (patch)
tree7cecdd857b05cf661858705ffc5e93b828c087bc
parentb78d8b9eda977be0174a25f8004218a7374ab3c5 (diff)
downloadm2e-core-8456e9bc35a129622975e07e02c7b20d05a0c56e.tar.gz
m2e-core-8456e9bc35a129622975e07e02c7b20d05a0c56e.tar.xz
m2e-core-8456e9bc35a129622975e07e02c7b20d05a0c56e.zip
Bug 339968 - Import Wizard update configuration after ignore
-rw-r--r--org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/Messages.java6
-rw-r--r--org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/messages.properties3
-rw-r--r--org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/wizards/LifecycleMappingPage.java2
-rw-r--r--org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/wizards/MavenImportWizard.java26
4 files changed, 33 insertions, 4 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 df8672e6..cde73f98 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
@@ -192,6 +192,10 @@ public class Messages extends NLS {
public static String MavenGoalSelectionDialog_message;
+ public static String MavenImportWizard_analyzingProject;
+
+ public static String MavenImportWizard_hideWarningMessage;
+
public static String MavenImportWizard_job;
public static String MavenImportWizard_title;
@@ -206,6 +210,8 @@ public class Messages extends NLS {
public static String MavenImportWizard_messageIncompleteMapping;
+ public static String MavenImportWizard_searchingTaskTitle;
+
public static String wizardImportValidatorProjectImported;
public static String MavenInstallationsPreferencePage_btnAdd;
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 0a98b044..44304e59 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
@@ -88,8 +88,11 @@ MavenGoalSelectionDialog_message=Select goal\:
MavenImportWizardPage_desc=Select Maven projects
MavenImportWizardPage_inherited=[inherited]
MavenImportWizardPage_title=Maven Projects
+MavenImportWizard_analyzingProject=Analyzing {0}
+MavenImportWizard_hideWarningMessage=Hide this warning in future
MavenImportWizard_job=Importing Maven projects
MavenImportWizard_messageIncompleteMapping=Continuing with import will result in projects with build errors, please see help for more information
+MavenImportWizard_searchingTaskTitle=Searching m2e marketplace
MavenImportWizard_title=Import Maven Projects
MavenImportWizard_titleIncompleteMapping=Incomplete Maven Goal Execution
MavenInstallFileArtifactWizardPage_btnChecksum=Create C&hecksum
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 a411a19f..5ce55253 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
@@ -566,7 +566,7 @@ public class LifecycleMappingPage extends WizardPage {
return false;
}
}
- return mappingConfiguration == null || mappingConfiguration.isMappingComplete();
+ return true;
}
/*
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 228e0169..6b7cb305 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
@@ -17,6 +17,7 @@ import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedHashMap;
+import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -59,12 +60,14 @@ import org.eclipse.m2e.core.internal.lifecyclemapping.discovery.MojoExecutionMap
import org.eclipse.m2e.core.internal.lifecyclemapping.discovery.ProjectLifecycleMappingConfiguration;
import org.eclipse.m2e.core.internal.preferences.MavenPreferenceConstants;
import org.eclipse.m2e.core.lifecyclemapping.model.PluginExecutionAction;
+import org.eclipse.m2e.core.project.IMavenProjectFacade;
import org.eclipse.m2e.core.project.IMavenProjectImportResult;
import org.eclipse.m2e.core.project.MavenProjectInfo;
import org.eclipse.m2e.core.project.ProjectImportConfiguration;
import org.eclipse.m2e.core.project.configurator.MojoExecutionKey;
import org.eclipse.m2e.core.ui.internal.M2EUIPluginActivator;
import org.eclipse.m2e.core.ui.internal.Messages;
+import org.eclipse.m2e.core.ui.internal.UpdateConfigurationJob;
import org.eclipse.m2e.core.ui.internal.actions.SelectionUtil;
import org.eclipse.m2e.core.ui.internal.editing.LifecycleMappingOperation;
import org.eclipse.m2e.core.ui.internal.editing.PomEdits;
@@ -178,9 +181,11 @@ public class MavenImportWizard extends AbstractMavenProjectWizard implements IIm
final IRunnableWithProgress ignoreJob = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ List<IProject> changed = new LinkedList<IProject>();
for(ILifecycleMappingLabelProvider prov : lifecycleMappingPage.getIgnore()) {
ILifecycleMappingRequirement req = prov.getKey();
if(req instanceof MojoExecutionMappingRequirement) {
+ changed.addAll(getProject(prov.getProjects()));
ignore(((MojoExecutionMappingRequirement) req).getExecution(), prov.getProjects());
}
}
@@ -188,9 +193,24 @@ public class MavenImportWizard extends AbstractMavenProjectWizard implements IIm
for(ILifecycleMappingLabelProvider prov : lifecycleMappingPage.getIgnoreParent()) {
ILifecycleMappingRequirement req = prov.getKey();
if(req instanceof MojoExecutionMappingRequirement) {
+ changed.addAll(getProject(prov.getProjects()));
ignoreAtDefinition(((MojoExecutionMappingRequirement) req).getExecution(), prov.getProjects());
}
}
+
+ new UpdateConfigurationJob(changed.toArray(new IProject[changed.size()])).schedule();
+ }
+
+ private Collection<IProject> getProject(Collection<MavenProject> projects) {
+ List<IProject> workspaceProjects = new LinkedList<IProject>();
+ for(MavenProject project : projects) {
+ IMavenProjectFacade facade = MavenPlugin.getMavenProjectRegistry().getMavenProject(project.getGroupId(),
+ project.getArtifactId(), project.getVersion());
+ if(facade != null) {
+ workspaceProjects.add(facade.getProject());
+ }
+ }
+ return workspaceProjects;
}
private void ignore(MojoExecutionKey key, Collection<MavenProject> projects) {
@@ -294,7 +314,7 @@ public class MavenImportWizard extends AbstractMavenProjectWizard implements IIm
}
Collection<ProjectLifecycleMappingConfiguration> projects = mappingConfiguration.getProjects();
- monitor.beginTask("Searching m2e marketplace", projects.size());
+ monitor.beginTask(Messages.MavenImportWizard_searchingTaskTitle, projects.size());
Map<ILifecycleMappingRequirement, List<IMavenDiscoveryProposal>> proposals = new LinkedHashMap<ILifecycleMappingRequirement, List<IMavenDiscoveryProposal>>();
@@ -307,7 +327,7 @@ public class MavenImportWizard extends AbstractMavenProjectWizard implements IIm
try {
proposals.putAll(discovery.discover(mavenProject, mojoExecutions,
mappingConfiguration.getSelectedProposals(),
- SubMonitor.convert(monitor, NLS.bind("Analysing {0}", project.getRelpath()), 1)));
+ SubMonitor.convert(monitor, NLS.bind(Messages.MavenImportWizard_analyzingProject, project.getRelpath()), 1)));
} catch(CoreException e) {
//XXX we shall not swallow this exception but associate with the project/execution
LOG.error(e.getMessage(), e);
@@ -327,7 +347,7 @@ public class MavenImportWizard extends AbstractMavenProjectWizard implements IIm
if (!skipIncompleteWarning()) {
MessageDialogWithToggle dialog = MessageDialogWithToggle.open(MessageDialog.CONFIRM, getShell(),
Messages.MavenImportWizard_titleIncompleteMapping, Messages.MavenImportWizard_messageIncompleteMapping,
- "Hide this warning in future", false, null, null, SWT.SHEET);
+ Messages.MavenImportWizard_hideWarningMessage, false, null, null, SWT.SHEET);
if(dialog.getReturnCode() == Window.OK) {
M2EUIPluginActivator.getDefault().getPreferenceStore()
.setValue(MavenPreferenceConstants.P_WARN_INCOMPLETE_MAPPING, dialog.getToggleState());

Back to the top