incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asa...@apache.org
Subject svn commit: r1404140 - in /sling/whiteboard/asanso/plugins/eclipse: slingclipse-api/src/org/apache/sling/slingclipse/api/ slingclipse-http/src/org/apache/sling/slingclipse/http/impl/ slingclipse-plugin/src/org/apache/sling/slingclipse/
Date Wed, 31 Oct 2012 13:50:38 GMT
Author: asanso
Date: Wed Oct 31 13:50:38 2012
New Revision: 1404140

URL: http://svn.apache.org/viewvc?rev=1404140&view=rev
Log:
SLING-2631 - [Tooling] SlingclipseListener incorrectly calculates parent paths. Applying patch
from Robert Munteanu!

Modified:
    sling/whiteboard/asanso/plugins/eclipse/slingclipse-api/src/org/apache/sling/slingclipse/api/FileInfo.java
    sling/whiteboard/asanso/plugins/eclipse/slingclipse-http/src/org/apache/sling/slingclipse/http/impl/AbstractRepository.java
    sling/whiteboard/asanso/plugins/eclipse/slingclipse-plugin/src/org/apache/sling/slingclipse/SlingclipseListener.java

Modified: sling/whiteboard/asanso/plugins/eclipse/slingclipse-api/src/org/apache/sling/slingclipse/api/FileInfo.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/asanso/plugins/eclipse/slingclipse-api/src/org/apache/sling/slingclipse/api/FileInfo.java?rev=1404140&r1=1404139&r2=1404140&view=diff
==============================================================================
--- sling/whiteboard/asanso/plugins/eclipse/slingclipse-api/src/org/apache/sling/slingclipse/api/FileInfo.java
(original)
+++ sling/whiteboard/asanso/plugins/eclipse/slingclipse-api/src/org/apache/sling/slingclipse/api/FileInfo.java
Wed Oct 31 13:50:38 2012
@@ -22,6 +22,13 @@ public class FileInfo {
 	private String name;
 	private String relativeLocation;
 	
+	/**
+	 * Constructs a new <tt>FileInfo</tt> object
+	 * 
+	 * @param location the absolute location of the file on the filesystem
+	 * @param relativeLocation the location of the file relative to the repository root 
+	 * @param name the name of the file
+	 */
 	public FileInfo(String location, String relativeLocation,String name) {
 		super();
 		this.location = location;
@@ -39,5 +46,11 @@ public class FileInfo {
 
 	public String getRelativeLocation() {
 		return relativeLocation;
+	}
+
+	@Override
+	public String toString() {
+		return "FileInfo [location=" + location + ", name=" + name
+				+ ", relativeLocation=" + relativeLocation + "]";
 	}	
 }

Modified: sling/whiteboard/asanso/plugins/eclipse/slingclipse-http/src/org/apache/sling/slingclipse/http/impl/AbstractRepository.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/asanso/plugins/eclipse/slingclipse-http/src/org/apache/sling/slingclipse/http/impl/AbstractRepository.java?rev=1404140&r1=1404139&r2=1404140&view=diff
==============================================================================
--- sling/whiteboard/asanso/plugins/eclipse/slingclipse-http/src/org/apache/sling/slingclipse/http/impl/AbstractRepository.java
(original)
+++ sling/whiteboard/asanso/plugins/eclipse/slingclipse-http/src/org/apache/sling/slingclipse/http/impl/AbstractRepository.java
Wed Oct 31 13:50:38 2012
@@ -26,5 +26,10 @@ public abstract class AbstractRepository
 	public void setRepositoryInfo(RepositoryInfo repositoryInfo){
 		this.repositoryInfo=repositoryInfo;
 	}
- 
+
+
+	@Override
+	public String toString() {
+		return "AbstractRepository [repositoryInfo=" + repositoryInfo + "]";
+	}
 }

Modified: sling/whiteboard/asanso/plugins/eclipse/slingclipse-plugin/src/org/apache/sling/slingclipse/SlingclipseListener.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/asanso/plugins/eclipse/slingclipse-plugin/src/org/apache/sling/slingclipse/SlingclipseListener.java?rev=1404140&r1=1404139&r2=1404140&view=diff
==============================================================================
--- sling/whiteboard/asanso/plugins/eclipse/slingclipse-plugin/src/org/apache/sling/slingclipse/SlingclipseListener.java
(original)
+++ sling/whiteboard/asanso/plugins/eclipse/slingclipse-plugin/src/org/apache/sling/slingclipse/SlingclipseListener.java
Wed Oct 31 13:50:38 2012
@@ -21,12 +21,14 @@ import org.apache.sling.slingclipse.api.
 import org.apache.sling.slingclipse.api.RepositoryInfo;
 import org.apache.sling.slingclipse.helper.SlingclipseHelper;
 import org.apache.sling.slingclipse.preferences.PreferencesMessages;
+import org.eclipse.core.internal.resources.Resource;
 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.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.jface.preference.IPreferenceStore;
 
@@ -62,8 +64,9 @@ public class SlingclipseListener impleme
 			private boolean visitInternal(IResourceDelta delta) {
 				IPreferenceStore store = SlingclipsePlugin.getDefault().getPreferenceStore();
 				
+				// since the listener is disabled, instruct it not to recurse for changes
 				if (!store.getBoolean(PreferencesMessages.REPOSITORY_AUTO_SYNC.getKey())){
-					return true;
+					return false;
 				}
  				
 				if (delta.getFlags() == IResourceDelta.NO_CHANGE
@@ -73,11 +76,16 @@ public class SlingclipseListener impleme
 				}
 				
 				IResource resource = delta.getResource();
- 				String path = resource.getLocation().toString();
 				
- 				if (SlingclipseHelper.isValidSlingProjectPath(path)) {
-					// TODO parent name clarify
-					String parentPath = resource.getParent().getFullPath().toString();
+				// don't process unhandled ( PROJECT, WORKSPACE ) resources but recurse if needed
+				if ( resource.getType() != IResource.FILE && resource.getType() != IResource.FOLDER){
+					return true;
+				}
+				
+ 				IPath path = resource.getLocation();
+ 				
+ 				if (SlingclipseHelper.isValidSlingProjectPath(path.toOSString())) {
+					IPath parentPath = path.removeLastSegments(1);
  
 					RepositoryInfo repositoryInfo = new RepositoryInfo(
 							store.getString(PreferencesMessages.USERNAME
@@ -89,8 +97,8 @@ public class SlingclipseListener impleme
 
 					Repository repository = SlingclipsePlugin.getDefault().getRepository();
 
-					FileInfo fileInfo = new FileInfo(path,SlingclipseHelper.getSlingProjectPath(parentPath),resource.getName());
-
+					FileInfo fileInfo = new FileInfo(path.toOSString(), SlingclipseHelper.getSlingProjectPath(parentPath.toOSString()),resource.getName());
+					
 					repository.setRepositoryInfo(repositoryInfo);
 					
 					if (delta.getKind() == IResourceDelta.REMOVED) {



Mime
View raw message