diff --git a/maven/src/org/netbeans/modules/maven/problems/Bundle.properties b/maven/src/org/netbeans/modules/maven/problems/Bundle.properties --- a/maven/src/org/netbeans/modules/maven/problems/Bundle.properties +++ b/maven/src/org/netbeans/modules/maven/problems/Bundle.properties @@ -60,7 +60,7 @@ BTN_Correct=Correct -ACT_DownloadDeps=Download Dependencies +ACT_validate=Revalidate ERR_MissingJ2eeModule=Maven J2EE support module missing MSG_MissingJ2eeModule=You are missing the Maven J2EE support module in your installation. This means that all J2EE related functionality (for example, Deployment, File templates) is missing. The most probable cause is that part of the general J2EE support is missing as well. Please go to Tools/Plugins and install the plugins related to J2EE. diff --git a/maven/src/org/netbeans/modules/maven/problems/ProblemReporterImpl.java b/maven/src/org/netbeans/modules/maven/problems/ProblemReporterImpl.java --- a/maven/src/org/netbeans/modules/maven/problems/ProblemReporterImpl.java +++ b/maven/src/org/netbeans/modules/maven/problems/ProblemReporterImpl.java @@ -49,6 +49,7 @@ import java.io.File; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.Comparator; import java.util.Iterator; import java.util.List; @@ -64,9 +65,10 @@ import org.apache.maven.project.validation.ModelValidationResult; import org.netbeans.modules.maven.NbMavenProjectImpl; import org.netbeans.modules.maven.api.NbMavenProject; +import org.netbeans.modules.maven.api.execute.RunUtils; import org.netbeans.modules.maven.api.problem.ProblemReporter; import org.netbeans.modules.maven.embedder.NbArtifact; -import org.netbeans.modules.maven.nodes.DependenciesNode; +import org.netbeans.modules.maven.execute.BeanRunConfig; import org.openide.cookies.EditCookie; import org.openide.filesystems.FileObject; import org.openide.filesystems.FileUtil; @@ -283,26 +285,38 @@ } } if (missingJars.size() > 0) { - //TODO create a correction action for this. Iterator it2 = missingJars.iterator(); String mess = ""; //NOI18N while (it2.hasNext()) { Artifact ar = it2.next(); mess = mess + ar.getId() + "\n"; //NOI18N } - AbstractAction act = new DependenciesNode.ResolveDepsAction(nbproject); - act.putValue(Action.NAME, org.openide.util.NbBundle.getMessage(ProblemReporterImpl.class, "ACT_DownloadDeps")); - ProblemReport report = new ProblemReport(ProblemReport.SEVERITY_MEDIUM, org.openide.util.NbBundle.getMessage(ProblemReporterImpl.class, "ERR_NonLocal"), org.openide.util.NbBundle.getMessage(ProblemReporterImpl.class, "MSG_NonLocal", mess), - act); + new RevalidateAction()); addReport(report); } } } } + + private final class RevalidateAction extends AbstractAction { + RevalidateAction() { + super(NbBundle.getMessage(ProblemReporterImpl.class, "ACT_validate")); + } + public @Override void actionPerformed(ActionEvent e) { + BeanRunConfig config = new BeanRunConfig(); + config.setExecutionDirectory(FileUtil.toFile(nbproject.getProjectDirectory())); + config.setGoals(Collections.singletonList("validate")); // NOI18N + config.setRecursive(false); + config.setProject(nbproject); + config.setExecutionName("validate"); // NOI18N + config.setTaskDisplayName(NbBundle.getMessage(ProblemReporterImpl.class, "ACT_validate")); + RunUtils.executeMaven(config); + } + } private void checkParent(final MavenProject project) { //mkleint: this code is never properly reached.. @@ -317,11 +331,10 @@ //getFile to create the fake file etc.. nbart.getFile(); if (nbart.getNonFakedFile() != null && !nbart.getNonFakedFile().exists()) { - //TODO create a correction action for this. ProblemReport report = new ProblemReport(ProblemReport.SEVERITY_HIGH, org.openide.util.NbBundle.getMessage(ProblemReporterImpl.class, "ERR_NoParent"), org.openide.util.NbBundle.getMessage(ProblemReporterImpl.class, "MSG_NoParent", nbart.getId()), - new OpenPomAction(nbproject)); + new RevalidateAction()); addReport(report); } }