[Title] Make util method which tells whether project is in default location or not...
authorho.namkoong <ho.namkoong@samsung.com>
Tue, 9 Oct 2012 08:40:19 +0000 (17:40 +0900)
committerho.namkoong <ho.namkoong@samsung.com>
Tue, 9 Oct 2012 08:40:19 +0000 (17:40 +0900)
[Type]
[Module]
[Priority]
[Jira#]
[Redmine#] 6479
[Problem]
[Cause]
[Solution]
[TestCase]

Change-Id: Ifa59a81cfaba56155640e42e452e5c755b224025

org.tizen.common/src/org/tizen/common/util/ProjectUtil.java

index 31acf7d..96f8e66 100644 (file)
@@ -31,7 +31,9 @@ import org.eclipse.core.resources.ICommand;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IProjectDescription;
 import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Platform;
 import org.tizen.common.util.log.Logger;
 
 /**
@@ -196,4 +198,16 @@ public class ProjectUtil {
         
         return null;
     }
+    
+    /**
+     * Check whether target project is located in default location or not.
+     * @param descriptionLocation .cproject location of target project.
+     * @return true if it is located in default location. False if not.
+     */
+    public static boolean isDefaultProjectLocation(IPath descriptionLocation) {
+        if(descriptionLocation.segmentCount() < 2) {
+            return false;
+        }
+        return descriptionLocation.removeLastSegments(2).toFile().equals(Platform.getLocation().toFile());
+    }
 }