}
catch (FileNotFoundException e)
{
// System.out.println("Copia dal jar");
JarFileReader jr = new JarFileReader();
try
{
JarFile jarFile = jr.getJarFile();
jr.copyDirectoryToDirectory(jarFile, "projectSkeleton" + File.separator + "src", sourceDir);
}
catch (IOException exx)
{
exx.printStackTrace();
}
}
// System.out.println("2");
messageArea.setText("Creazione " + sourceDir + File.separator + "src e suo contenuto");
progressBar.setValue(idx++);
// Sposta il contenuto della directory packageName nella directory con il nome effettivo del package
File standardPackageDir = new File(sourceDirectory.getAbsolutePath() + File.separator + "packageName");
try
{
FileUtils.copyDirectory(standardPackageDir, new File(sourceDirectory.getAbsolutePath() + File.separator + basePackage));
FileUtils.cleanDirectory(standardPackageDir);
standardPackageDir.deleteOnExit();
}
catch (FileNotFoundException e)
{
}
// System.out.println("3");
messageArea.setText("Trasferito il contenuto della directory src");
progressBar.setValue(idx++);
// Creazione Directory documentation
File documentationDirectory = new File(sourceDir + File.separator + "documentation");
if (!documentationDirectory.exists())
{
documentationDirectory.mkdirs();
messageArea.setText("Creazione " + sourceDir + File.separator + "documentation");
}
progressBar.setValue(idx++);
/**
* Copia lo scheletro di html
*/
File htmlSkeletonDir = new File("." + File.separator + "projectSkeleton" + File.separator + "html");
try
{
FileUtils.copyDirectoryToDirectory(htmlSkeletonDir, new File(sourceDir));
}
catch (FileNotFoundException e)
{
// System.out.println("Copia dal jar");
JarFileReader jr = new JarFileReader();
try
{
JarFile jarFile = jr.getJarFile();
jr.copyDirectoryToDirectory(jarFile, "projectSkeleton" + File.separator + "html", sourceDir);
}
catch (IOException exx)
{
exx.printStackTrace();
}
}
// System.out.println("4");
messageArea.setText("Creazione contenuto html");
progressBar.setValue(idx++);
/**
* Copia lo scheletro di lib
*/
// File libSkeletonDir = new File("." + File.separator + "projectSkeleton" + File.separator + "lib");
// FileUtils.copyDirectoryToDirectory(libSkeletonDir, new File(sourceDir));
// messageArea.setText("Creazione contenuto lib");
//
// progressBar.setValue(idx++);
/**
* Copia lo scheletro di resources
*/
File resourcesSkeletonDir = new File("." + File.separator + "projectSkeleton" + File.separator + "resources");
try
{
FileUtils.copyDirectoryToDirectory(resourcesSkeletonDir, new File(sourceDir));
}
catch (FileNotFoundException e)
{
// System.out.println("Copia dal jar");
JarFileReader jr = new JarFileReader();
try
{
JarFile jarFile = jr.getJarFile();
jr.copyDirectoryToDirectory(jarFile, "projectSkeleton" + File.separator + "resources", sourceDir);
}
catch (IOException exx)
{
exx.printStackTrace();
}
}
// System.out.println("5");
messageArea.setText("Creazione contenuto resources");
progressBar.setValue(idx++);
/**
* Copia i file di Eclipse
*/
try
{
FileUtils.copyFileToDirectory(new File("." + File.separator + "projectSkeleton" + File.separator + ".classpath"), new File(sourceDir));
}
catch (FileNotFoundException e)
{
// System.out.println("Copia dal jar");
JarFileReader jr = new JarFileReader();
try
{
JarFile jarFile = jr.getJarFile();
jr.copyFileToDirectory(jarFile, "projectSkeleton" + File.separator + ".classpath", sourceDir);
}
catch (IOException exx)
{
exx.printStackTrace();
}
}
// System.out.println("6");
try
{
FileUtils.copyFileToDirectory(new File("." + File.separator + "projectSkeleton" + File.separator + ".packages"), new File(sourceDir));
}
catch (FileNotFoundException e)
{
// System.out.println("Copia dal jar");
JarFileReader jr = new JarFileReader();
try
{
JarFile jarFile = jr.getJarFile();
jr.copyFileToDirectory(jarFile, "projectSkeleton" + File.separator + ".packages", sourceDir);
}
catch (IOException exx)
{
exx.printStackTrace();
}