Author: rob.stryker(a)jboss.com
Date: 2007-07-27 15:29:32 -0400 (Fri, 27 Jul 2007)
New Revision: 2707
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/ModelUtil.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/internal/ModelTruezipBridge.java
Log:
API changed to have more accurate name
allows node to be passed in to limit search for matching filesets.
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/ModelUtil.java
===================================================================
---
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/ModelUtil.java 2007-07-27
19:04:55 UTC (rev 2706)
+++
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/ModelUtil.java 2007-07-27
19:29:32 UTC (rev 2707)
@@ -116,23 +116,33 @@
return matches;
}
+
+ public static boolean otherFilesetMatchesPathAndOutputLocation(IArchiveFileSet fileset,
IPath path) {
+ return otherFilesetMatchesPathAndOutputLocation(fileset, path, null);
+ }
+
/**
* Do any filesets other than the parameter match this path?
* @param fileset
* @param path
+ * @param root a node to start with, or null if the entire model
* @return
*/
- public static boolean otherFilesetMatchesPath(IArchiveFileSet fileset, IPath path) {
- IArchiveFileSet[] filesets = ModelUtil.getMatchingFilesets(path);
+ public static boolean otherFilesetMatchesPathAndOutputLocation(IArchiveFileSet fileset,
IPath path, IArchiveNode root) {
+ IArchiveFileSet[] filesets = ModelUtil.getMatchingFilesets(root, path);
if( filesets.length == 0 || (filesets.length == 1 &&
Arrays.asList(filesets).contains(fileset))) {
return false;
} else {
// other filesets DO match... but are they at the same location in the archive?
+ boolean relativePathsMatch;
+ boolean destinationsMatch;
for( int i = 0; i < filesets.length; i++ ) {
if( fileset.equals(filesets[i])) continue;
- if(
fileset.getRootArchiveRelativePath(path).equals(filesets[i].getRootArchiveRelativePath(path)))
{
- // the two put the file in the same spot! It's a match!
+ relativePathsMatch =
fileset.getRootArchiveRelativePath(path).equals(filesets[i].getRootArchiveRelativePath(path));
+ destinationsMatch =
fileset.getRootArchive().getArchiveFilePath().equals(filesets[i].getRootArchive().getArchiveFilePath());
+ if( relativePathsMatch && destinationsMatch ) {
+ // the two put the file in the same spot, within the same archive! It's a
match!
return true;
}
}
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/internal/ModelTruezipBridge.java
===================================================================
---
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/internal/ModelTruezipBridge.java 2007-07-27
19:04:55 UTC (rev 2706)
+++
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/internal/ModelTruezipBridge.java 2007-07-27
19:29:32 UTC (rev 2707)
@@ -90,7 +90,7 @@
final ArrayList list = new ArrayList();
list.addAll(Arrays.asList(paths));
for( int i = 0; i < paths.length; i++ ) {
- if( !ModelUtil.otherFilesetMatchesPath(fileset, paths[i])) {
+ if( !ModelUtil.otherFilesetMatchesPathAndOutputLocation(fileset, paths[i])) {
// remove
deleteFiles(fileset, new IPath[] {paths[i]}, false);
} else {
Show replies by date