Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgor Fedorenko2011-04-21 12:30:24 -0400
committerIgor Fedorenko2011-04-21 12:30:24 -0400
commitb78d8b9eda977be0174a25f8004218a7374ab3c5 (patch)
tree0d5c8803488d7aa72fcaee5b233054cc8e43fb9c
parent8e465f10e2e4739b7a6fe8ebd1ed117ef8435073 (diff)
downloadm2e-core-b78d8b9eda977be0174a25f8004218a7374ab3c5.tar.gz
m2e-core-b78d8b9eda977be0174a25f8004218a7374ab3c5.tar.xz
m2e-core-b78d8b9eda977be0174a25f8004218a7374ab3c5.zip
Removed remntants of nested project support
Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/registry/MavenProjectFacade.java2
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/registry/ProjectRegistryManager.java4
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/registry/ProjectRegistryRefreshJob.java54
3 files changed, 16 insertions, 44 deletions
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/registry/MavenProjectFacade.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/registry/MavenProjectFacade.java
index c5169357..cbe570e2 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/registry/MavenProjectFacade.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/registry/MavenProjectFacade.java
@@ -275,7 +275,7 @@ public class MavenProjectFacade implements IMavenProjectFacade, Serializable {
}
i++;
}
- return timestamp[timestamp.length - 1] != getModificationStamp(pom);
+ return false;
}
private void updateTimestamp() {
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/registry/ProjectRegistryManager.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/registry/ProjectRegistryManager.java
index e096f795..ca7c9a95 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/registry/ProjectRegistryManager.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/registry/ProjectRegistryManager.java
@@ -101,11 +101,9 @@ public class ProjectRegistryManager {
* Path of project metadata files, relative to the project. These
* files are used to determine if project dependencies need to be
* updated.
- *
- * Note that path of pom.xml varies for nested projects and pom.xml
- * are treated separately.
*/
public static final List<? extends IPath> METADATA_PATH = Arrays.asList( //
+ new Path("pom.xml"), // //$NON-NLS-1$
new Path(".project"), // //$NON-NLS-1$
new Path(".classpath"), // //$NON-NLS-1$
new Path(".settings/" + IMavenConstants.PLUGIN_ID + ".prefs")); // dirty trick! //$NON-NLS-1$ //$NON-NLS-2$
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/registry/ProjectRegistryRefreshJob.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/registry/ProjectRegistryRefreshJob.java
index d2ccc79a..f043a1c2 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/registry/ProjectRegistryRefreshJob.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/registry/ProjectRegistryRefreshJob.java
@@ -19,13 +19,10 @@ import java.util.Set;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceChangeEvent;
import org.eclipse.core.resources.IResourceChangeListener;
import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.resources.IResourceDeltaVisitor;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
@@ -39,7 +36,6 @@ import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener;
import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
-import org.eclipse.m2e.core.core.IMavenConstants;
import org.eclipse.m2e.core.embedder.IMavenConfiguration;
import org.eclipse.m2e.core.internal.Messages;
import org.eclipse.m2e.core.jobs.IBackgroundProcessingQueue;
@@ -138,22 +134,13 @@ public class ProjectRegistryRefreshJob extends Job implements IResourceChangeLis
// if (IResourceChangeEvent.POST_CHANGE == type)
IResourceDelta delta = event.getDelta(); // workspace delta
IResourceDelta[] projectDeltas = delta.getAffectedChildren();
- Set<IProject> removeProjects = new LinkedHashSet<IProject>();
Set<IProject> refreshProjects = new LinkedHashSet<IProject>();
for(int i = 0; i < projectDeltas.length; i++ ) {
- try {
- projectChanged(projectDeltas[i], removeProjects, refreshProjects);
- } catch(CoreException ex) {
- log.error(ex.getMessage(), ex);
+ if(projectChanged(projectDeltas[i])) {
+ refreshProjects.add((IProject) projectDeltas[i].getResource());
}
}
-
- if(!removeProjects.isEmpty()) {
- IProject[] projects = removeProjects.toArray(new IProject[removeProjects.size()]);
- MavenUpdateRequest updateRequest = new MavenUpdateRequest(projects, offline, updateSnapshots);
- updateRequest.setForce(false);
- queue(updateRequest);
- }
+
if(!refreshProjects.isEmpty()) {
IProject[] projects = refreshProjects.toArray(new IProject[refreshProjects.size()]);
MavenUpdateRequest updateRequest = new MavenUpdateRequest(projects, offline, updateSnapshots);
@@ -169,33 +156,14 @@ public class ProjectRegistryRefreshJob extends Job implements IResourceChangeLis
}
}
- private void projectChanged(IResourceDelta delta, Set<IProject> removeProjects, final Set<IProject> refreshProjects)
- throws CoreException {
- final IProject project = (IProject) delta.getResource();
-
+ private boolean projectChanged(IResourceDelta projectDelta) {
for(IPath path : ProjectRegistryManager.METADATA_PATH) {
- if (delta.findMember(path) != null) {
- removeProjects.add(project);
- return;
- }
- }
-
- delta.accept(new IResourceDeltaVisitor() {
- public boolean visit(IResourceDelta delta) {
- IResource resource = delta.getResource();
- if(resource instanceof IFile && IMavenConstants.POM_FILE_NAME.equals(resource.getName())) {
- // XXX ignore output folders
- if(delta.getKind() == IResourceDelta.REMOVED
- || delta.getKind() == IResourceDelta.ADDED
- || (delta.getKind() == IResourceDelta.CHANGED && ((delta.getFlags() & DELTA_FLAGS) != 0)))
- {
- // XXX check for interesting resources
- refreshProjects.add(project);
- }
- }
+ IResourceDelta delta = projectDelta.findMember(path);
+ if(delta != null && isInterestingDelta(delta)) {
return true;
}
- });
+ }
+ return false;
}
private void queue(MavenUpdateRequest updateRequest) {
@@ -219,4 +187,10 @@ public class ProjectRegistryRefreshJob extends Job implements IResourceChangeLis
return queue.isEmpty();
}
}
+
+ protected boolean isInterestingDelta(IResourceDelta delta) {
+ return delta.getKind() == IResourceDelta.REMOVED
+ || delta.getKind() == IResourceDelta.ADDED
+ || (delta.getKind() == IResourceDelta.CHANGED && ((delta.getFlags() & DELTA_FLAGS) != 0));
+ }
}

Back to the top