[jboss-cvs] jbosside/core/plugins/org.jboss.ide.eclipse.packages.core/src/main/org/jboss/ide/eclipse/packages/core/project/build ...
Marshall Culpepper
mculpepper at jboss.com
Wed Feb 28 18:22:47 EST 2007
User: mculpepper
Date: 07/02/28 18:22:47
Modified: core/plugins/org.jboss.ide.eclipse.packages.core/src/main/org/jboss/ide/eclipse/packages/core/project/build
TruezipUtil.java
Log:
getPackageFile() should work for any package (top-level or not), added an overloaded umount() for truezip File objects
Revision Changes Path
1.2 +150 -133 jbosside/core/plugins/org.jboss.ide.eclipse.packages.core/src/main/org/jboss/ide/eclipse/packages/core/project/build/TruezipUtil.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: TruezipUtil.java
===================================================================
RCS file: /cvsroot/jboss/jbosside/core/plugins/org.jboss.ide.eclipse.packages.core/src/main/org/jboss/ide/eclipse/packages/core/project/build/TruezipUtil.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- TruezipUtil.java 26 Feb 2007 19:17:44 -0000 1.1
+++ TruezipUtil.java 28 Feb 2007 23:22:47 -0000 1.2
@@ -10,9 +10,9 @@
import org.jboss.ide.eclipse.core.util.ProjectUtil;
import org.jboss.ide.eclipse.packages.core.Trace;
import org.jboss.ide.eclipse.packages.core.model.IPackage;
-import org.jboss.ide.eclipse.packages.core.model.IPackageFileSet;
import org.jboss.ide.eclipse.packages.core.model.IPackageFolder;
import org.jboss.ide.eclipse.packages.core.model.IPackageNode;
+import org.jboss.ide.eclipse.packages.core.model.PackagesCore;
import org.jboss.ide.eclipse.packages.core.model.internal.PackagesModel;
import de.schlichtherle.io.ArchiveDetector;
@@ -24,15 +24,27 @@
public static File getPackageFile (IPackage pkg)
{
- return new File(pkg.getPackageFile().getRawLocation().toFile());
+ if (pkg.isTopLevel())
+ {
+ return new File(pkg.getPackageFilePath().toFile());
+ } else {
+ IPath relativePath = pkg.getPackageRelativePath();
+ IPackage topPackage = PackagesCore.getTopLevelPackage(pkg);
+
+ return new File(topPackage.getPackageFilePath().append(relativePath).toFile());
+ }
}
public static void umount (IPackage pkg)
{
File pkgFile = getPackageFile(pkg);
+ umount (pkgFile);
+ }
+ public static void umount (File file)
+ {
try {
- File.umount(pkgFile);
+ File.umount(file);
} catch (ArchiveException e) {
Trace.trace(TruezipUtil.class, e);
}
@@ -66,31 +78,36 @@
ArrayList files = new ArrayList();
for (int i = 0; i < roots.length; i++)
{
+ if (subPath == null)
+ {
+ files.add(new File(roots[i], ArchiveDetector.NULL));
+ } else {
files.add(new File(roots[i], subPath.toString(), ArchiveDetector.NULL));
}
+ }
return (File[]) files.toArray(new File[files.size()]);
}
- public static File[] createFiles (IPackageFileSet fileset, IPath subPath)
+ public static File[] createFiles (IPackageNode node, IPath subPath)
{
- File[] roots = createFilesetRoots(fileset);
+ File[] roots = createNodeRoots(node);
return createFiles (roots, subPath);
}
- public static File[] createFiles (IPackageFileSet fileset, IPath subPath, Hashtable pkgsAndPaths)
+ public static File[] createFiles (IPath subPath, Hashtable pkgsAndPaths)
{
- File[] roots = createFilesetRoots(fileset, pkgsAndPaths);
+ File[] roots = createFileRoots(pkgsAndPaths);
return createFiles (roots, subPath);
}
- public static File[] createFilesetRoots (IPackageFileSet fileset)
+ public static File[] createNodeRoots (IPackageNode node)
{
- Hashtable pkgsAndPaths = PackagesModel.instance().getTopLevelPackagesAndPathways(fileset);
- return createFilesetRoots (fileset, pkgsAndPaths);
+ Hashtable pkgsAndPaths = PackagesModel.instance().getTopLevelPackagesAndPathways(node);
+ return createFileRoots (pkgsAndPaths);
}
- public static File[] createFilesetRoots (IPackageFileSet fileset, Hashtable pkgsAndPaths)
+ public static File[] createFileRoots (Hashtable pkgsAndPaths)
{
ArrayList roots = new ArrayList();
More information about the jboss-cvs-commits
mailing list