Author: rob.stryker(a)jboss.com
Date: 2008-02-22 00:03:23 -0500 (Fri, 22 Feb 2008)
New Revision: 6518
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveFileSet.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFileSetImpl.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XMLBinding.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbFileSet.java
Log:
JBIDE-943 flatten support
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveFileSet.java
===================================================================
---
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveFileSet.java 2008-02-22
05:02:58 UTC (rev 6517)
+++
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveFileSet.java 2008-02-22
05:03:23 UTC (rev 6518)
@@ -37,6 +37,7 @@
public static final String INCLUDES_ATTRIBUTE = ATTRIBUTE_PREFIX +
"includes";
public static final String EXCLUDES_ATTRIBUTE = ATTRIBUTE_PREFIX +
"excludes";
public static final String IN_WORKSPACE_ATTRIBUTE = ATTRIBUTE_PREFIX +
"inWorkspace";
+ public static final String FLATTENED_ATTRIBUTE = ATTRIBUTE_PREFIX +
"flattened";
public static final String SOURCE_PATH_ATTRIBUTE = ATTRIBUTE_PREFIX +
"sourcePath";
@@ -47,6 +48,11 @@
public boolean isInWorkspace();
/**
+ * @return Whether or not the fileset is flattened
+ */
+ public boolean isFlattened();
+
+ /**
* Returns the absolute file-system relative source path
* @return The path to the source folder ("basedir" in ant terminology) for
this fileset.
*/
@@ -109,6 +115,11 @@
public void setInWorkspace(boolean isInWorkspace);
/**
+ * Sets whether or not this fileset is flattened.
+ */
+ public void setFlattened(boolean flattened);
+
+ /**
* Get the relative path of the input file to the root archive
* @param inputFile
* @return
@@ -122,7 +133,16 @@
*/
public IPath getPathRelativeToParent(IPath inputFile);
+ /**
+ * To be used if and when a specific new file is known to match
+ * @param file
+ */
public void addMatchingFile(IPath file);
+
+ /**
+ * To be used if and when a specific new file is known to match
+ * @param file
+ */
public void removeMatchingFile(IPath file);
}
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFileSetImpl.java
===================================================================
---
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFileSetImpl.java 2008-02-22
05:02:58 UTC (rev 6517)
+++
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFileSetImpl.java 2008-02-22
05:03:23 UTC (rev 6518)
@@ -42,9 +42,8 @@
public class ArchiveFileSetImpl extends ArchiveNodeImpl implements
IArchiveFileSet {
- private XbFileSet filesetDelegate;
private DirectoryScannerExtension scanner;
- private ArrayList matchingPaths;
+ private ArrayList<IPath> matchingPaths;
private boolean rescanRequired = true;
public ArchiveFileSetImpl() {
@@ -53,7 +52,6 @@
public ArchiveFileSetImpl (XbFileSet delegate) {
super(delegate);
- this.filesetDelegate = delegate;
}
@@ -73,35 +71,35 @@
*/
public synchronized IPath[] findMatchingPaths () {
getScanner(); // ensure up to date
- return matchingPaths == null ? new IPath[0] : (IPath[]) matchingPaths.toArray(new
IPath[matchingPaths.size()]);
+ return matchingPaths == null ? new IPath[0] : matchingPaths.toArray(new
IPath[matchingPaths.size()]);
}
/*
* @see IArchiveFileSet#getExcludesPattern()
*/
public String getExcludesPattern() {
- return filesetDelegate.getExcludes();
+ return getFileSetDelegate().getExcludes();
}
/*
* @see IArchiveFileSet#isInWorkspace()
*/
public boolean isInWorkspace() {
- return filesetDelegate.isInWorkspace();
+ return getFileSetDelegate().isInWorkspace();
}
/*
* @see IArchiveFileSet#getIncludesPattern()
*/
public String getIncludesPattern() {
- return filesetDelegate.getIncludes();
+ return getFileSetDelegate().getIncludes();
}
/*
* @see IArchiveFileSet#getGlobalSourcePath()
*/
public IPath getGlobalSourcePath() {
- String path = filesetDelegate.getDir();
+ String path = getFileSetDelegate().getDir();
if (path == null || path.equals(".") || path.equals("")) {
return getProjectPath();
} else if( isInWorkspace()){
@@ -115,9 +113,14 @@
* @see IArchiveFileSet#getSourcePath()
*/
public IPath getSourcePath() {
- return filesetDelegate.getDir() == null ? null : new Path(filesetDelegate.getDir());
+ return getFileSetDelegate().getDir() == null ?
+ null : new Path(getFileSetDelegate().getDir());
}
+ public boolean isFlattened() {
+ return getFileSetDelegate().isFlattened();
+ }
+
/*
* @see IArchiveFileSet#matchesPath(IPath)
*/
@@ -147,7 +150,7 @@
getGlobalSourcePath(), getIncludesPattern(), getExcludesPattern(), true);
// cache the paths
- ArrayList paths = new ArrayList();
+ ArrayList<IPath> paths = new ArrayList<IPath>();
IPath sp = getGlobalSourcePath();
String matched[] = scanner.getIncludedFiles();
for (int i = 0; i < matched.length; i++) {
@@ -174,7 +177,7 @@
*/
public void setExcludesPattern(String excludes) {
attributeChanged(EXCLUDES_ATTRIBUTE, getExcludesPattern(), excludes);
- filesetDelegate.setExcludes(excludes);
+ getFileSetDelegate().setExcludes(excludes);
rescanRequired = true;
}
@@ -183,7 +186,7 @@
*/
public void setIncludesPattern(String includes) {
attributeChanged(INCLUDES_ATTRIBUTE, getIncludesPattern(), includes);
- filesetDelegate.setIncludes(includes);
+ getFileSetDelegate().setIncludes(includes);
rescanRequired = true;
}
@@ -192,25 +195,36 @@
*/
public void setInWorkspace(boolean isInWorkspace) {
attributeChanged(IN_WORKSPACE_ATTRIBUTE, new Boolean(isInWorkspace()), new
Boolean(isInWorkspace));
- filesetDelegate.setInWorkspace(isInWorkspace);
+ getFileSetDelegate().setInWorkspace(isInWorkspace);
rescanRequired = true;
}
/*
+ * (non-Javadoc)
+ * @see org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet#setFlattened(boolean)
+ */
+ public void setFlattened(boolean flat) {
+ attributeChanged(FLATTENED_ATTRIBUTE, new Boolean(isFlattened()), new Boolean(flat));
+ getFileSetDelegate().setFlattened(flat);
+ //TODO: rescanRequired = true;
+ }
+
+ /*
* @see IArchiveFileSet#setSourcePath(IPath, boolean)
*/
public void setSourcePath (IPath path) {
Assert.isNotNull(path);
IPath src = getSourcePath();
attributeChanged(SOURCE_PATH_ATTRIBUTE, src == null ? null : src.toString(), path ==
null ? null : path.toString());
- filesetDelegate.setDir(path.toString());
+ getFileSetDelegate().setDir(path.toString());
rescanRequired = true;
}
protected XbFileSet getFileSetDelegate () {
- return filesetDelegate;
+ return (XbFileSet)nodeDelegate;
}
+
/*
* filesets have no path of their own
* and should not be the parents of any other node
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XMLBinding.java
===================================================================
---
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XMLBinding.java 2008-02-22
05:02:58 UTC (rev 6517)
+++
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XMLBinding.java 2008-02-22
05:03:23 UTC (rev 6518)
@@ -37,7 +37,6 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.jboss.ide.eclipse.archives.core.ArchivesCore;
import org.jboss.ide.eclipse.archives.core.model.IArchive;
import org.jboss.ide.eclipse.archives.core.model.internal.ArchiveImpl;
@@ -132,7 +131,7 @@
OutputStreamWriter writer = null;
try {
writer = new OutputStreamWriter(new FileOutputStream(filePath.toFile()));
- XMLBinding.marshall(element, writer, new NullProgressMonitor());
+ XMLBinding.marshall(element, writer, monitor);
} catch( Exception e ) {
}
finally {
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbFileSet.java
===================================================================
---
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbFileSet.java 2008-02-22
05:02:58 UTC (rev 6517)
+++
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/xb/XbFileSet.java 2008-02-22
05:03:23 UTC (rev 6518)
@@ -24,7 +24,8 @@
public class XbFileSet extends XbPackageNodeWithProperties {
private String dir, includes, excludes;
- private boolean inWorkspace, flattened;
+ private boolean inWorkspace;
+ private boolean flattened = false;
public XbFileSet ()
{