Author: akazakov
Date: 2009-11-09 17:35:15 -0500 (Mon, 09 Nov 2009)
New Revision: 18521
Modified:
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/FileUtil.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5179
Modified:
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/FileUtil.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/FileUtil.java 2009-11-09
22:31:47 UTC (rev 18520)
+++
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/FileUtil.java 2009-11-09
22:35:15 UTC (rev 18521)
@@ -43,6 +43,7 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.jboss.tools.common.CommonPlugin;
public final class FileUtil {
@@ -203,6 +204,22 @@
return content;
}
+ public static void copyContent(IFile from, IFile to, boolean force, boolean
keepHistory, IProgressMonitor monitor) throws CoreException {
+ InputStream is = null;
+ try {
+ is = from.getContents();
+ to.setContents(is, force, keepHistory, monitor);
+ } finally {
+ if(is!=null) {
+ try {
+ is.close();
+ } catch (IOException e) {
+ CommonPlugin.getPluginLog().logError(e);
+ }
+ }
+ }
+ }
+
public static boolean writeFile(File f, String value) {
return writeFileWithEncodingCheck(f, value, null);
}