From: jihoon song Date: Mon, 5 Sep 2011 09:49:16 +0000 (+0900) Subject: [Title] added file utility X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e5f01aa4ad33be323c1657d156353722ea0dda9f;p=sdk%2Fide%2Fcommon-eplugin.git [Title] added file utility [Type] Enhancement [Module] common-plugins [Priority] Minor [CQ#] -- [Redmine#] -- [Problem] [Cause] [Solution] [TestCase] Change-Id: I2433ca409d9ed06976c6a730b5b0f8230e95dd04 --- diff --git a/com.samsung.slp.common/src/com/samsung/slp/common/util/FileUtil.java b/com.samsung.slp.common/src/com/samsung/slp/common/util/FileUtil.java index 51314e6..1a83a17 100644 --- a/com.samsung.slp.common/src/com/samsung/slp/common/util/FileUtil.java +++ b/com.samsung.slp.common/src/com/samsung/slp/common/util/FileUtil.java @@ -23,6 +23,13 @@ import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; +import java.net.URI; + +import org.eclipse.core.filesystem.EFS; +import org.eclipse.core.filesystem.IFileSystem; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; + /** * @author Changhyun Lee {@literal } (S-Core) @@ -60,7 +67,7 @@ public class FileUtil { /** * return file extension from given full file name * - * @author jihoon80.song@samsung.com, S-Core Inc. + * @author Jihoon Song {@literal } (S-Core) */ public static String getFileExtension(String fullName) { if (fullName == null) { @@ -75,7 +82,7 @@ public class FileUtil { /** * return file name without file extension from given full file name * - * @author jihoon80.song@samsung.com, S-Core Inc. + * @author Jihoon Song {@literal } (S-Core) */ public static String getFileNameWithoutExtension(String fullName) { if (fullName == null) { @@ -90,7 +97,7 @@ public class FileUtil { /** * delete file and its children. * - * @author jihoon80.song@samsung.com, S-Core Inc. + * @author Jihoon Song {@literal } (S-Core) */ public static boolean recursiveDelete(File file) { boolean result = true; @@ -113,4 +120,18 @@ public class FileUtil { return result; } + /** + * copy file or directory using Eclipse File System + * + * @param source The source URI of the copy. + * @param destination The destination URI of the copy. + * @param options bit-wise or of option flag constants ({@link EFS#OVERWRITE} or {@link EFS#SHALLOW}). + * @param monitor a progress monitor, or null if progress reporting and cancellation are not desired + * + * @author Jihoon Song {@literal } (S-Core) + */ + public static void copyUsingEFS(URI source, URI destination, int options, IProgressMonitor monitor) throws CoreException { + IFileSystem fileSystem = EFS.getLocalFileSystem(); + fileSystem.getStore(source).copy(fileSystem.getStore(destination), options, monitor); + } }