|
|
@ -40,8 +40,6 @@ import java.io.OutputStreamWriter; |
|
|
|
import java.io.StringWriter; |
|
|
|
import java.io.StringWriter; |
|
|
|
import java.net.MalformedURLException; |
|
|
|
import java.net.MalformedURLException; |
|
|
|
import java.net.URL; |
|
|
|
import java.net.URL; |
|
|
|
import java.util.LinkedList; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import java.util.Properties; |
|
|
|
import java.util.Properties; |
|
|
|
import java.util.logging.Level; |
|
|
|
import java.util.logging.Level; |
|
|
|
import java.util.logging.Logger; |
|
|
|
import java.util.logging.Logger; |
|
|
@ -72,6 +70,7 @@ public class ProjectExtensionManager { |
|
|
|
private String[] extensionDependencies; |
|
|
|
private String[] extensionDependencies; |
|
|
|
private String antTaskLibrary; |
|
|
|
private String antTaskLibrary; |
|
|
|
private URL zipFile; |
|
|
|
private URL zipFile; |
|
|
|
|
|
|
|
private static final String resourcesFolder = "resources"; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Allows extending ant based projects |
|
|
|
* Allows extending ant based projects |
|
|
@ -428,17 +427,23 @@ public class ProjectExtensionManager { |
|
|
|
ZipInputStream str = new ZipInputStream(in); |
|
|
|
ZipInputStream str = new ZipInputStream(in); |
|
|
|
ZipEntry entry; |
|
|
|
ZipEntry entry; |
|
|
|
while ((entry = str.getNextEntry()) != null) { |
|
|
|
while ((entry = str.getNextEntry()) != null) { |
|
|
|
|
|
|
|
String fileName = resourcesFolder + "/" + extensionName + "/" + entry.getName(); |
|
|
|
if (entry.isDirectory()) { |
|
|
|
if (entry.isDirectory()) { |
|
|
|
|
|
|
|
//XXX: deleting old (beta) files here
|
|
|
|
FileObject fo = projectRoot.getFileObject(entry.getName()); |
|
|
|
FileObject fo = projectRoot.getFileObject(entry.getName()); |
|
|
|
if (fo == null) { |
|
|
|
if (fo != null && entry.getSize() != -1 && entry.getSize() == fo.getSize()) { |
|
|
|
FileUtil.createFolder(projectRoot, entry.getName()); |
|
|
|
Logger.getLogger(this.getClass().getName()).log(Level.INFO, "Deleting old folder " + fo.getNameExt()); |
|
|
|
|
|
|
|
fo.delete(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
FileUtil.createFolder(projectRoot, fileName); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
//XXX: deleting old (beta) files here
|
|
|
|
FileObject fo = projectRoot.getFileObject(entry.getName()); |
|
|
|
FileObject fo = projectRoot.getFileObject(entry.getName()); |
|
|
|
if (fo != null && !fo.equals(projectRoot)) { |
|
|
|
if (fo != null && !fo.equals(projectRoot)) { |
|
|
|
|
|
|
|
Logger.getLogger(this.getClass().getName()).log(Level.INFO, "Deleting old file " + fo.getNameExt()); |
|
|
|
fo.delete(); |
|
|
|
fo.delete(); |
|
|
|
} |
|
|
|
} |
|
|
|
fo = FileUtil.createData(projectRoot, entry.getName()); |
|
|
|
fo = FileUtil.createData(projectRoot, fileName); |
|
|
|
writeFile(str, fo); |
|
|
|
writeFile(str, fo); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -456,17 +461,32 @@ public class ProjectExtensionManager { |
|
|
|
ZipInputStream str = new ZipInputStream(in); |
|
|
|
ZipInputStream str = new ZipInputStream(in); |
|
|
|
ZipEntry entry; |
|
|
|
ZipEntry entry; |
|
|
|
while ((entry = str.getNextEntry()) != null) { |
|
|
|
while ((entry = str.getNextEntry()) != null) { |
|
|
|
FileObject obj = projectRoot.getFileObject(entry.getName()); |
|
|
|
//XXX: deleting old (beta) files here
|
|
|
|
|
|
|
|
FileObject old = projectRoot.getFileObject(entry.getName()); |
|
|
|
|
|
|
|
if (old != null && !old.equals(projectRoot)) { |
|
|
|
|
|
|
|
Logger.getLogger(this.getClass().getName()).log(Level.INFO, "Deleting old file " + old.getNameExt()); |
|
|
|
|
|
|
|
if (entry.getSize() != -1 && entry.getSize() == old.getSize()) { |
|
|
|
|
|
|
|
old.delete(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
String fileName = resourcesFolder + "/" + extensionName + "/" + entry.getName(); |
|
|
|
|
|
|
|
FileObject obj = projectRoot.getFileObject(fileName); |
|
|
|
if (obj != null && !obj.equals(projectRoot)) { |
|
|
|
if (obj != null && !obj.equals(projectRoot)) { |
|
|
|
Logger.getLogger(this.getClass().getName()).log(Level.INFO, "Deleting file " + obj.getNameExt()); |
|
|
|
Logger.getLogger(this.getClass().getName()).log(Level.INFO, "Deleting file " + obj.getNameExt()); |
|
|
|
if (entry.getSize() != -1 && entry.getSize() == obj.getSize()) { |
|
|
|
if (entry.getSize() != -1 && entry.getSize() == obj.getSize()) { |
|
|
|
obj.delete(); |
|
|
|
obj.delete(); |
|
|
|
|
|
|
|
} else{ |
|
|
|
|
|
|
|
Logger.getLogger(this.getClass().getName()).log(Level.INFO, "Keeping file " + obj.getNameExt()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} finally { |
|
|
|
} finally { |
|
|
|
in.close(); |
|
|
|
in.close(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
FileObject folder = projectRoot.getFileObject(resourcesFolder + "/" + extensionName); |
|
|
|
|
|
|
|
if (folder != null && folder.getChildren().length == 0) { |
|
|
|
|
|
|
|
folder.delete(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void writeFile(ZipInputStream str, FileObject fo) throws IOException { |
|
|
|
private void writeFile(ZipInputStream str, FileObject fo) throws IOException { |
|
|
|