You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2014/05/16 13:47:43 UTC
svn commit: r1595166 -
/sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/ProjectUtil.java
Author: rombert
Date: Fri May 16 11:47:42 2014
New Revision: 1595166
URL: http://svn.apache.org/r1595166
Log:
SLING-3568 - Allow importing content from arbitrary locations
Add ProjectUtil.isInsideContentSyncRoot
Modified:
sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/ProjectUtil.java
Modified: sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/ProjectUtil.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/ProjectUtil.java?rev=1595166&r1=1595165&r2=1595166&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/ProjectUtil.java (original)
+++ sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/ProjectUtil.java Fri May 16 11:47:42 2014
@@ -167,6 +167,25 @@ public abstract class ProjectUtil {
return Path.fromOSString(filterLocation.getAbsolutePath());
}
+ /**
+ * Verifies if a resource is inside the content sync root for its defined project
+ *
+ * @param resource
+ * @return true if the resource is inside the content sync root
+ */
+ public static boolean isInsideContentSyncRoot(IResource resource) {
+
+ if (resource == null) {
+ return false;
+ }
+
+ IFolder syncRoot = getSyncDirectory(resource.getProject());
+ if (syncRoot == null) {
+ return false;
+ }
+
+ return syncRoot.getFullPath().isPrefixOf(resource.getFullPath());
+ }
private ProjectUtil() {