package org.tizen.common.project.util;
-import java.io.File;
import java.net.URI;
import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.osgi.util.NLS;
* @param location
* @return
*/
- public static boolean isExistProject(URI location) {
+ public static boolean isExistProject(String name, URI location) {
Assert.notNull( location );
- return new File( location ).exists();
+ // check whether project already exists
+ final IProject handle = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
+ if ( handle.exists() ) {
+ return true;
+ }
+
+ // for non-default workspace
+ if ( Path.fromOSString(location.toString()).toFile().exists() ) {
+ return true;
+ }
+
+ return false;
}
/**
return NLS.bind( Messages.ValidationUtil_InvalidSegment, invalidChar );
}
- if ( isExistProject( projectLocation ) ) {
+ if ( isExistProject( projectName, projectLocation ) ) {
return Messages.ValidationUtil_AlreadyExistProject;
}