Author: fbricon
Date: 2012-04-27 18:23:45 -0400 (Fri, 27 Apr 2012)
New Revision: 40592
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/project/MavenProjectImportOperation.java
Log:
JBIDE-11166 : collect sub module projects during import
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/project/MavenProjectImportOperation.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/project/MavenProjectImportOperation.java 2012-04-27
22:14:22 UTC (rev 40591)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/project/MavenProjectImportOperation.java 2012-04-27
22:23:45 UTC (rev 40592)
@@ -12,7 +12,10 @@
import java.io.File;
import java.util.ArrayList;
+import java.util.Collection;
+import java.util.LinkedHashSet;
import java.util.List;
+import java.util.Set;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
@@ -42,7 +45,7 @@
MavenPluginActivator mavenPlugin = MavenPluginActivator.getDefault();
IProjectConfigurationManager configurationManager =
mavenPlugin.getProjectConfigurationManager();
MavenModelManager modelManager = mavenPlugin.getMavenModelManager();
- List<MavenProjectInfo> projectInfos = getMavenProjects(getProjectDirectory(),
modelManager, monitor);
+ Set<MavenProjectInfo> projectInfos = getMavenProjects(getProjectDirectory(),
modelManager, monitor);
ProjectImportConfiguration projectImportConfiguration = new
ProjectImportConfiguration();
List<IMavenProjectImportResult> importResults =
configurationManager.importProjects(projectInfos, projectImportConfiguration,
monitor);
@@ -60,12 +63,12 @@
return projects;
}
- private List<MavenProjectInfo> getMavenProjects(File directory, MavenModelManager
modelManager,
+ private Set<MavenProjectInfo> getMavenProjects(File directory, MavenModelManager
modelManager,
IProgressMonitor monitor) throws InterruptedException {
- LocalProjectScanner scanner = new LocalProjectScanner(directory, directory.toString(),
false,
+ LocalProjectScanner scanner = new LocalProjectScanner(directory.getParentFile(),
directory.toString(), false,
modelManager);
scanner.run(monitor);
- return scanner.getProjects();
+ return collectProjects(scanner.getProjects());
}
public boolean isMavenProject() {
@@ -76,4 +79,20 @@
return isReadable(new File(getProjectDirectory(), POM_FILE));
}
+
+ public Set<MavenProjectInfo> collectProjects(
+ Collection<MavenProjectInfo> projects) {
+ return new LinkedHashSet<MavenProjectInfo>() {
+ private static final long serialVersionUID = 1L;
+
+ public Set<MavenProjectInfo> collectProjects(
+ Collection<MavenProjectInfo> projects) {
+ for (MavenProjectInfo projectInfo : projects) {
+ add(projectInfo);
+ collectProjects(projectInfo.getProjects());
+ }
+ return this;
+ }
+ }.collectProjects(projects);
+ }
}
Show replies by date