Author: dgolovin
Date: 2007-06-29 15:46:45 -0400 (Fri, 29 Jun 2007)
New Revision: 2225
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/internal/project/facet/AntCopyUtils.java
Log:
http://jira.jboss.com/jira/browse/EXIN-221
New Seam Project Wizard
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/internal/project/facet/AntCopyUtils.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/internal/project/facet/AntCopyUtils.java 2007-06-29
19:36:17 UTC (rev 2224)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/internal/project/facet/AntCopyUtils.java 2007-06-29
19:46:45 UTC (rev 2225)
@@ -21,38 +21,41 @@
import org.apache.tools.ant.types.resources.FileResource;
import org.apache.tools.ant.util.FileUtils;
import org.apache.tools.ant.util.ResourceUtils;
+import
org.jboss.tools.seam.core.internal.project.facet.SeamFacetInstallDelegete.FileSetFileFilter;
import org.jboss.tools.seam.core.SeamCorePlugin;
-
+/**
+ *
+ * @author eskimo
+ *
+ */
public class AntCopyUtils {
+
public static void main(String[] args) {
Project prj = new Project();
prj.setBaseDir(new File("C:\\java\\jboss-seam-1.2.1.GA\\seam-gen\\view"));
Resource folder = new FileResource(new
File("C:\\java\\jboss-seam-1.2.1.GA\\seam-gen\\view\\action.xhtml"));
Resource dest = new FileResource();
FilterSet set = new FilterSet();
- //set.readFiltersFromFile(filtersFile);
set.addFilter("methodName", "testValue");
-
- copyFilesAndFolders(new
File("C:\\java\\jboss-seam-1.2.1.GA\\seam-gen\\view"), new
File("C:\\temp\\WebContent"), new FilterSetCollection(set),true);
-
+ copyFilesAndFolders(new
File("C:\\java\\jboss-seam-1.2.1.GA\\seam-gen\\view"), new
File("C:\\temp\\WebContent"), new FilterSetCollection(set),true);
+ }
+ public static void copyFilesAndFolders(File sourceFolder, File destinationFolder,
FilterSetCollection set, boolean override) {
+ copyFilesAndFolders(sourceFolder, destinationFolder, null, set, override);
}
- public static interface AntCopyConfiguration {
- public Properties getProperties();
- public File getBaseDir();
- }
-
- public static void copyFilesAndFolders(File sourceFolder, File destinationFolder,
FilterSetCollection set, boolean override) {
+ public static void copyFilesAndFolders(File sourceFolder, File destinationFolder,
+ FileSetFileFilter fileSetFilter,
+ FilterSetCollection filterSetCollection, boolean override) {
if(!destinationFolder.exists()) destinationFolder.mkdirs();
- File[] files = sourceFolder.listFiles();
+ File[] files =
fileSetFilter==null?sourceFolder.listFiles():sourceFolder.listFiles(fileSetFilter);
for (File file : files) {
if(file.isDirectory()) {
- copyFilesAndFolders(file,new File(destinationFolder,file.getName()),set,override);
+ copyFilesAndFolders(file,new
File(destinationFolder,file.getName()),filterSetCollection,override);
} else {
try {
- FileUtils.getFileUtils().copyFile(file, new
File(destinationFolder,file.getName()),set,override);
+ FileUtils.getFileUtils().copyFile(file, new
File(destinationFolder,file.getName()),filterSetCollection,override);
} catch (IOException e) {
SeamCorePlugin.getPluginLog().logError(e);
}
@@ -60,4 +63,12 @@
}
}
+ public static void copyFile(File source, File dest, boolean override) {
+ try {
+ FileUtils.getFileUtils().copyFile(source, new File(dest,source.getName()),new
FilterSetCollection(),override);
+ } catch (IOException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
+ }
+
}