Author: rob.stryker(a)jboss.com
Date: 2008-07-07 20:15:46 -0400 (Mon, 07 Jul 2008)
New Revision: 9082
Added:
trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/projects/JBIDE1406/
trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/projects/JBIDE1406/.classpath
trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/projects/JBIDE1406/.packages
trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/projects/JBIDE1406/.project
trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/projects/JBIDE1406/bin/
trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/projects/JBIDE1406/output/
trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/projects/JBIDE1406/src/
trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/projects/JBIDE1406/src/in.properties
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/StringSubstitutionTest.java
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/projects/JBIDE1406Test.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/archives/J2EEArchiveType.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/archives/WarArchiveType.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/FilesetViewProvider.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/META-INF/MANIFEST.MF
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceVFS.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/types/WorkspaceJARArchiveType.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ant/AntVariables.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/DirectoryScannerFactory.java
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/IArchiveNode.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchivesVFS.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IVariableManager.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/ArchiveImpl.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveNodeImpl.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/xpl/StringSubstitutionEngineClone.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesLabelProvider.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/FilesetWizard.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/FilesetInfoWizardPage.java
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/ArchivesTestSuite.java
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/ModelTest.java
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/ModelUtilTest.java
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/projects/JBIDE2099Test.java
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/projects/JBIDE2311Test.java
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/projects/JBIDE2315Test.java
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/projects/JBIDE2439Test.java
Log:
JBIDE-1406 core with unit test
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/archives/J2EEArchiveType.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/archives/J2EEArchiveType.java 2008-07-07
15:46:34 UTC (rev 9081)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/archives/J2EEArchiveType.java 2008-07-08
00:15:46 UTC (rev 9082)
@@ -142,7 +142,7 @@
sourceContainer = project;
}
- fs.setSourcePath(sourceContainer.getFullPath());
+ fs.setRawSourcePath(sourceContainer.getFullPath().toString());
fs.setInWorkspace(true);
fs.setIncludesPattern( includePattern == null ? "**/*" : includePattern );
parent.addChild(fs);
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/archives/WarArchiveType.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/archives/WarArchiveType.java 2008-07-07
15:46:34 UTC (rev 9081)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/archives/WarArchiveType.java 2008-07-08
00:15:46 UTC (rev 9082)
@@ -101,7 +101,7 @@
try {
IPath projectPath = project.getLocation();
DirectoryScanner scanner =
- DirectoryScannerFactory.createDirectoryScanner(projectPath,
"**/WEB-INF/web.xml", null, true);
+ DirectoryScannerFactory.createDirectoryScanner(projectPath.toString(),
"**/WEB-INF/web.xml", null, true);
String[] files = scanner.getIncludedFiles();
// just take the first
if( files.length > 0 ) {
@@ -134,7 +134,7 @@
try {
IPath projectPath = project.getLocation();
DirectoryScanner scanner =
- DirectoryScannerFactory.createDirectoryScanner(projectPath, "**/web.xml",
null, true);
+ DirectoryScannerFactory.createDirectoryScanner(projectPath.toString(),
"**/web.xml", null, true);
String[] files = scanner.getIncludedFiles();
// just take the first
if( files.length > 0 ) {
@@ -156,7 +156,7 @@
IPath projectPath = project.getLocation();
DirectoryScanner scanner =
- DirectoryScannerFactory.createDirectoryScanner(projectPath,
"**/WEB-INF/web.xml", null, true);
+ DirectoryScannerFactory.createDirectoryScanner(projectPath.toString(),
"**/WEB-INF/web.xml", null, true);
String[] files = scanner.getIncludedFiles();
if(files != null && files.length > 0) {
@@ -168,7 +168,7 @@
//having failed to find 'lib' directory, let us make source of the project
itself
sourcePath = project.getName();
DirectoryScanner scanner2 =
- DirectoryScannerFactory.createDirectoryScanner(projectPath, "**/*.jar",
null, true);
+ DirectoryScannerFactory.createDirectoryScanner(projectPath.toString(),
"**/*.jar", null, true);
String[] files2 = scanner2.getIncludedFiles();
IPath p;
ArrayList list = new ArrayList();
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/FilesetViewProvider.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/FilesetViewProvider.java 2008-07-07
15:46:34 UTC (rev 9081)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/FilesetViewProvider.java 2008-07-08
00:15:46 UTC (rev 9082)
@@ -595,7 +595,7 @@
try {
if( dir != null ) {
DirectoryScanner scanner =
- DirectoryScannerFactory.createDirectoryScanner(new Path(dir), includes, excludes,
true);
+ DirectoryScannerFactory.createDirectoryScanner(dir, includes, excludes, true);
if( scanner != null ) {
String[] files = scanner.getIncludedFiles();
paths = new IPath[files.length];
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/META-INF/MANIFEST.MF 2008-07-07
15:46:34 UTC (rev 9081)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/META-INF/MANIFEST.MF 2008-07-08
00:15:46 UTC (rev 9082)
@@ -31,5 +31,9 @@
org.jboss.ide.eclipse.archives.core.model,
org.jboss.ide.eclipse.archives.core.model.internal;x-friends:="org.jboss.ide.eclipse.archives.test",
org.jboss.ide.eclipse.archives.core.model.internal.xb;x-friends:="org.jboss.ide.eclipse.archives.test",
+ org.jboss.ide.eclipse.archives.core.model.other.internal,
+ org.jboss.ide.eclipse.archives.core.model.types,
+ org.jboss.ide.eclipse.archives.core.project,
org.jboss.ide.eclipse.archives.core.util;x-friends:="org.jboss.ide.eclipse.archives.test",
-
org.jboss.ide.eclipse.archives.core.util.internal;x-friends:="org.jboss.ide.eclipse.archives.test"
+
org.jboss.ide.eclipse.archives.core.util.internal;x-friends:="org.jboss.ide.eclipse.archives.test",
+ org.jboss.ide.eclipse.archives.core.xpl
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceVFS.java
===================================================================
---
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceVFS.java 2008-07-07
15:46:34 UTC (rev 9081)
+++
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceVFS.java 2008-07-08
00:15:46 UTC (rev 9082)
@@ -1,21 +1,79 @@
package org.jboss.ide.eclipse.archives.core.model.other.internal;
import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
-import org.eclipse.core.variables.VariablesPlugin;
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.jboss.ide.eclipse.archives.core.ArchivesCorePlugin;
import org.jboss.ide.eclipse.archives.core.model.IArchivesVFS;
+import org.jboss.ide.eclipse.archives.core.model.IVariableManager;
+import org.jboss.ide.eclipse.archives.core.xpl.StringSubstitutionEngineClone;
public class WorkspaceVFS implements IArchivesVFS {
+ protected WorkspaceVariableManager manager;
+ protected StringSubstitutionEngineClone engine;
+ public WorkspaceVFS() {
+ manager = new WorkspaceVariableManager();
+ engine = new StringSubstitutionEngineClone();
+ }
+
+ public WorkspaceVariableManager getManager() {
+ return manager;
+ }
+
+ public class WorkspaceVariableManager implements IVariableManager {
+ private static final String PREFIX =
"org.jboss.ide.eclipse.archives.core.model.other.internal.WorkspaceVariableManager.";
+ public boolean containsVariable(String variable) {
+ IEclipsePreferences prefs = new DefaultScope().getNode(ArchivesCorePlugin.PLUGIN_ID);
+ return prefs.get(PREFIX + variable, null) != null;
+ }
+ public String getVariableValue(String variable) {
+ IEclipsePreferences prefs = new DefaultScope().getNode(ArchivesCorePlugin.PLUGIN_ID);
+ return prefs.get(PREFIX + variable, null);
+ }
+
+
+ public void setValue(String name, IPath value) throws CoreException {
+ try {
+ IEclipsePreferences prefs = new
DefaultScope().getNode(ArchivesCorePlugin.PLUGIN_ID);
+ if( value != null )
+ prefs.put(PREFIX + name, value.toString());
+ else
+ prefs.remove(PREFIX + name);
+ prefs.flush();
+ } catch (org.osgi.service.prefs.BackingStoreException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
public String performStringSubstitution(String expression,
boolean reportUndefinedVariables) throws CoreException {
- return
VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(expression,
reportUndefinedVariables);
+ return performStringSubstitution(expression, null, reportUndefinedVariables);
}
+ public String performStringSubstitution(String expression,
+ String projectName, boolean reportUndefinedVariables)
+ throws CoreException {
+ // set this project name
+ if( projectName != null ) {
+ manager.setValue("current.project", new Path(projectName));
+ }
+
+ String ret = engine.performStringSubstitution(expression, reportUndefinedVariables,
manager);
+
+ if( projectName != null ) {
+ manager.setValue("current.project", null);
+ }
+ return ret;
+ }
+
public IPath[] getWorkspaceChildren(IPath path) {
IResource res = ResourcesPlugin.getWorkspace().getRoot().findMember(path);
if( res != null || !(res instanceof IContainer)) {
@@ -51,4 +109,12 @@
results[i] = workspacePathToAbsolutePath(paths[i]);
return results;
}
+
+ public String findProject(IPath absolutePath) {
+ IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
+ for( int i = 0; i < projects.length; i++ )
+ if( projects[i].getLocation().equals(absolutePath))
+ return projects[i].getName();
+ return null;
+ }
}
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/types/WorkspaceJARArchiveType.java
===================================================================
---
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/types/WorkspaceJARArchiveType.java 2008-07-07
15:46:34 UTC (rev 9081)
+++
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/types/WorkspaceJARArchiveType.java 2008-07-08
00:15:46 UTC (rev 9082)
@@ -60,7 +60,7 @@
IArchiveFileSet classes = new ArchiveFileSetImpl();
classes.setIncludesPattern("**/*");
- classes.setSourcePath(outputContainer.getFullPath());
+ classes.setRawSourcePath(outputContainer.getFullPath().toString());
classes.setInWorkspace(true);
try {
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ant/AntVariables.java
===================================================================
---
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ant/AntVariables.java 2008-07-07
15:46:34 UTC (rev 9081)
+++
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ant/AntVariables.java 2008-07-08
00:15:46 UTC (rev 9082)
@@ -16,6 +16,12 @@
boolean reportUndefinedVariables) throws CoreException {
return new StringSubstitutionEngineClone().performStringSubstitution(expression,
reportUndefinedVariables, this);
}
+ public String performStringSubstitution(String expression,
+ String projectName, boolean reportUndefinedVariables)
+ throws CoreException {
+ // TODO Auto-generated method stub
+ return null;
+ }
public boolean containsVariable(String variable) {
return false;
@@ -36,5 +42,13 @@
// TODO Auto-generated method stub
return null;
}
+ public String getVariableValue(String variable) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+ public String findProject(IPath absolutePath) {
+ // TODO Auto-generated method stub
+ return null;
+ }
}
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/DirectoryScannerFactory.java
===================================================================
---
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/DirectoryScannerFactory.java 2008-07-07
15:46:34 UTC (rev 9081)
+++
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/DirectoryScannerFactory.java 2008-07-08
00:15:46 UTC (rev 9082)
@@ -25,6 +25,7 @@
import java.util.ArrayList;
import java.util.HashMap;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.jboss.ide.eclipse.archives.core.ArchivesCore;
@@ -36,30 +37,32 @@
*/
public class DirectoryScannerFactory {
private static class ScannableFileSet {
- public IPath rawPath;
+ public String rawPath;
public IPath rootArchiveRelativePath;
public String includes;
public String excludes;
public boolean inWorkspace;
+ public String projectName;
};
public static DirectoryScannerExtension createDirectoryScanner(IArchiveFileSet fs,
boolean scan) {
- return createDirectoryScanner(fs.getSourcePath(), fs.getRootArchiveRelativePath(),
fs.getIncludesPattern(), fs.getExcludesPattern(), fs.isInWorkspace(), scan);
+ return createDirectoryScanner(fs.getRawSourcePath(), fs.getRootArchiveRelativePath(),
fs.getIncludesPattern(), fs.getExcludesPattern(), fs.getProjectName(), fs.isInWorkspace(),
scan);
}
// THIS SHOULD NOT BE USED ;) just here for now
// eradicate all uses!
- public static DirectoryScannerExtension createDirectoryScanner (IPath rawPath, String
includes, String excludes, boolean scan) {
- return createDirectoryScanner(rawPath, null, includes, excludes, false, scan);
+ public static DirectoryScannerExtension createDirectoryScanner (String rawPath, String
includes, String excludes, boolean scan) {
+ return createDirectoryScanner(rawPath, null, includes, excludes, null, false, scan);
}
- public static DirectoryScannerExtension createDirectoryScanner (IPath rawPath, IPath
rootArchiveRelativePath, String includes, String excludes, boolean inWorkspace, boolean
scan) {
+ public static DirectoryScannerExtension createDirectoryScanner (String rawPath, IPath
rootArchiveRelativePath, String includes, String excludes, String projectName, boolean
inWorkspace, boolean scan) {
ScannableFileSet fs = new ScannableFileSet();
fs.rawPath = rawPath;
fs.rootArchiveRelativePath = rootArchiveRelativePath;
fs.includes = includes;
fs.excludes = excludes;
fs.inWorkspace = inWorkspace;
+ fs.projectName = projectName;
DirectoryScannerExtension scanner = new DirectoryScannerExtension(fs);
if (scan) {
scanner.scan();
@@ -98,16 +101,27 @@
* setting in superclass. Ant will not understand
* variables!
*/
- public void setBasedir2(IPath path) {
- if( workspaceRelative ) {
- IPath p = ArchivesCore.getInstance().getVFS()
- .workspacePathToAbsolutePath(path);
- setBasedir(new FileWrapper(p.toFile(), path));
- } else {
- setBasedir(new FileWrapper(path.toFile(), path));
+ public void setBasedir2(String path) {
+ String translatedPath = replaceVariables(path);
+ if( translatedPath != null ) {
+ IPath translatedPath2 = new Path(translatedPath);
+ if( workspaceRelative ) {
+ IPath p = ArchivesCore.getInstance().getVFS()
+ .workspacePathToAbsolutePath(translatedPath2);
+ setBasedir(new FileWrapper(p.toFile(), translatedPath2));
+ } else {
+ setBasedir(new FileWrapper(new File(translatedPath), translatedPath2));
+ }
}
}
-
+ public String replaceVariables(String rawPath) {
+ try {
+ return ArchivesCore.getInstance().getVFS().
+ performStringSubstitution(rawPath, fs.projectName, true);
+ } catch( CoreException ce ) {
+ }
+ return null;
+ }
protected String getName(File file) {
return workspaceRelative ? ((FileWrapper)file).getOutputName() :
super.getName(file);
}
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-07-07
15:46:34 UTC (rev 9081)
+++
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveFileSet.java 2008-07-08
00:15:46 UTC (rev 9082)
@@ -60,10 +60,18 @@
public IPath getGlobalSourcePath();
/**
+ * @return the source path from the delegate with no translation at all
+ */
+ public String getRawSourcePath();
+
+ /**
+ * Return a source path that is file-system or workspace
+ * relative but has all of its variables translated already.
+ *
* @return the source path from the delegate (file-system or workspace-relative)
*/
public IPath getSourcePath();
-
+
/**
* Force the scanner to check for matched files again
*/
@@ -112,7 +120,7 @@
* Sets the "root" or "source" of this fileset (file-system or
workspace relative)
* @param path The absolute path that is the source of this fileset
*/
- public void setSourcePath(IPath path);
+ public void setRawSourcePath (String raw);
/**
* Set the includes pattern for this fileset. This pattern uses the same syntax as
Ant's include pattern.
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveNode.java
===================================================================
---
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveNode.java 2008-07-07
15:46:34 UTC (rev 9081)
+++
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveNode.java 2008-07-08
00:15:46 UTC (rev 9082)
@@ -121,6 +121,11 @@
public IPath getProjectPath();
/**
+ * @return the name of the project this node is defined in
+ */
+ public String getProjectName();
+
+ /**
* Recursively visit the package node tree below this node with the passed-in package
node visitor.
* @param visitor A package node visitor
* @return Whether or not the entire sub-tree was visited
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchivesVFS.java
===================================================================
---
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchivesVFS.java 2008-07-07
15:46:34 UTC (rev 9081)
+++
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchivesVFS.java 2008-07-08
00:15:46 UTC (rev 9082)
@@ -45,9 +45,8 @@
* @return
*/
public IPath workspacePathToAbsolutePath(IPath path);
-
public IPath[] workspacePathToAbsolutePath(IPath[] paths);
-
+ public String findProject(IPath absolutePath);
public String performStringSubstitution(String expression, boolean
reportUndefinedVariables) throws CoreException;
-
+ public String performStringSubstitution(String expression, String projectName, boolean
reportUndefinedVariables) throws CoreException;
}
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IVariableManager.java
===================================================================
---
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IVariableManager.java 2008-07-07
15:46:34 UTC (rev 9081)
+++
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IVariableManager.java 2008-07-08
00:15:46 UTC (rev 9082)
@@ -27,5 +27,5 @@
*/
public interface IVariableManager {
public boolean containsVariable(String variable);
- public String getVariableValue(String variable, String arg);
+ public String getVariableValue(String variable);
}
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-07-07
15:46:34 UTC (rev 9081)
+++
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFileSetImpl.java 2008-07-08
00:15:46 UTC (rev 9082)
@@ -25,6 +25,7 @@
import java.util.HashMap;
import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
@@ -94,11 +95,25 @@
}
/*
+ * (non-Javadoc)
+ * @see org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet#getRawSourcePath()
+ */
+ public String getRawSourcePath() {
+ return getFileSetDelegate().getDir();
+ }
+
+ /*
* @see IArchiveFileSet#getSourcePath()
*/
public IPath getSourcePath() {
- return getFileSetDelegate().getDir() == null ?
- null : new Path(getFileSetDelegate().getDir());
+ try {
+ String out = ArchivesCore.getInstance().getVFS().
+ performStringSubstitution(getRawSourcePath(),
+ getProjectName(), true);
+ return new Path(out);
+ } catch( CoreException ce ) {
+ }
+ return null;
}
/*
@@ -216,11 +231,13 @@
/*
* @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());
- getFileSetDelegate().setDir(path.toString());
+ public void setRawSourcePath (String raw) {
+ Assert.isNotNull(raw);
+ String src = getRawSourcePath();
+ attributeChanged(SOURCE_PATH_ATTRIBUTE,
+ src == null ? null : src.toString(),
+ raw == null ? null : raw);
+ getFileSetDelegate().setDir(raw);
rescanRequired = true;
}
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveImpl.java
===================================================================
---
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveImpl.java 2008-07-07
15:46:34 UTC (rev 9081)
+++
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveImpl.java 2008-07-08
00:15:46 UTC (rev 9082)
@@ -23,6 +23,7 @@
import java.util.ArrayList;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.jboss.ide.eclipse.archives.core.ArchivesCore;
@@ -76,10 +77,16 @@
if( packageDelegate.getToDir().equals("."))
return getProjectPath() == null ? Path.EMPTY : getProjectPath();
- if (isDestinationInWorkspace()) {
- return ArchivesCore.getInstance().getVFS().workspacePathToAbsolutePath(new
Path(packageDelegate.getToDir()));
- } else
- return new Path(packageDelegate.getToDir());
+ try {
+ String replaced = ArchivesCore.getInstance().getVFS().
+ performStringSubstitution(packageDelegate.getToDir(), getProjectName(), true);
+ if (isDestinationInWorkspace()) {
+ return ArchivesCore.getInstance().getVFS().workspacePathToAbsolutePath(new
Path(replaced));
+ } else {
+ return new Path(replaced);
+ }
+ } catch( CoreException ce ) {}
+ return null;
}
public IPath getDestinationPath() {
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveNodeImpl.java
===================================================================
---
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveNodeImpl.java 2008-07-07
15:46:34 UTC (rev 9081)
+++
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveNodeImpl.java 2008-07-08
00:15:46 UTC (rev 9082)
@@ -28,6 +28,7 @@
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IPath;
+import org.jboss.ide.eclipse.archives.core.ArchivesCore;
import org.jboss.ide.eclipse.archives.core.model.ArchivesModelException;
import org.jboss.ide.eclipse.archives.core.model.IArchive;
import org.jboss.ide.eclipse.archives.core.model.IArchiveModelRootNode;
@@ -177,6 +178,15 @@
/*
* (non-Javadoc)
+ * @see org.jboss.ide.eclipse.archives.core.model.IArchiveNode#getProjectName()
+ */
+ public String getProjectName() {
+ IPath path = getProjectPath();
+ return ArchivesCore.getInstance().getVFS().findProject(path);
+ }
+
+ /*
+ * (non-Javadoc)
* @see
org.jboss.ide.eclipse.archives.core.model.IArchiveNode#getProperty(java.lang.String)
*/
public String getProperty(String property) {
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/xpl/StringSubstitutionEngineClone.java
===================================================================
---
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/xpl/StringSubstitutionEngineClone.java 2008-07-07
15:46:34 UTC (rev 9081)
+++
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/xpl/StringSubstitutionEngineClone.java 2008-07-08
00:15:46 UTC (rev 9082)
@@ -30,7 +30,7 @@
// delimiters
private static final String VARIABLE_START = "${"; //$NON-NLS-1$
private static final char VARIABLE_END = '}';
- private static final char VARIABLE_ARG = ':';
+// private static final char VARIABLE_ARG = ':';
// parsing states
private static final int SCAN_FOR_START = 0;
private static final int SCAN_FOR_END = 1;
@@ -236,25 +236,26 @@
*/
private String resolve(VariableReference var, boolean reportUndefinedVariables,
IVariableManager manager) throws CoreException {
String text = var.getText();
- int pos = text.indexOf(VARIABLE_ARG);
String name = null;
- String arg = null;
- if (pos > 0) {
- name = text.substring(0, pos);
- pos++;
- if (pos < text.length()) {
- arg = text.substring(pos);
- }
- } else {
- name = text;
- }
+// int pos = text.indexOf(VARIABLE_ARG);
+// String arg = null;
+// if (pos > 0) {
+// name = text.substring(0, pos);
+// pos++;
+// if (pos < text.length()) {
+// arg = text.substring(pos);
+// }
+// } else {
+// name = text;
+// }
+ name = text;
if( !manager.containsVariable(name)) {
if( reportUndefinedVariables )
throw new CoreException(new Status(IStatus.ERROR, ArchivesCore.PLUGIN_ID,
"Variable " + name + " undefined"));
return getOriginalVarText(var);
}
- String ret = manager.getVariableValue(name, arg);
+ String ret = manager.getVariableValue(name);
if(ret == null)
return getOriginalVarText(var);
return ret;
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesLabelProvider.java
===================================================================
---
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesLabelProvider.java 2008-07-07
15:46:34 UTC (rev 9081)
+++
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesLabelProvider.java 2008-07-08
00:15:46 UTC (rev 9082)
@@ -116,7 +116,7 @@
if (showFullPath) {
text += fileset.getGlobalSourcePath().toString();
} else if( inWorkspace ){
- text += fileset.getSourcePath().toString();
+ text += fileset.getRawSourcePath();
} else {
text += fileset.getGlobalSourcePath().lastSegment();
}
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/FilesetWizard.java
===================================================================
---
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/FilesetWizard.java 2008-07-07
15:46:34 UTC (rev 9081)
+++
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/FilesetWizard.java 2008-07-08
00:15:46 UTC (rev 9082)
@@ -34,39 +34,39 @@
if (createFileset)
this.fileset = ArchiveNodeFactory.createFileset();
-
- fillFilesetFromPage(fileset);
- try {
- getContainer().run(true, false, new IRunnableWithProgress () {
- public void run(IProgressMonitor monitor) throws InvocationTargetException,
InterruptedException {
- if (createFileset)
- parentNode.addChild(fileset);
- try {
- ArchivesModel.instance().save(fileset.getProjectPath(), monitor);
- } catch( ArchivesModelException ame ) {
- IStatus status = new Status(IStatus.ERROR, PackagesUIPlugin.PLUGIN_ID, "Error
Completing Wizard", ame);
- PackagesUIPlugin.getDefault().getLog().log(status);
- }
- }
- });
- } catch (InvocationTargetException e) {
- } catch (InterruptedException e) {
- } catch(Exception e) {e.printStackTrace();}
return true;
+// fillFilesetFromPage(fileset);
+// try {
+// getContainer().run(true, false, new IRunnableWithProgress () {
+// public void run(IProgressMonitor monitor) throws InvocationTargetException,
InterruptedException {
+// if (createFileset)
+// parentNode.addChild(fileset);
+// try {
+// ArchivesModel.instance().save(fileset.getProjectPath(), monitor);
+// } catch( ArchivesModelException ame ) {
+// IStatus status = new Status(IStatus.ERROR, PackagesUIPlugin.PLUGIN_ID,
"Error Completing Wizard", ame);
+// PackagesUIPlugin.getDefault().getLog().log(status);
+// }
+// }
+// });
+// } catch (InvocationTargetException e) {
+// } catch (InterruptedException e) {
+// } catch(Exception e) {e.printStackTrace();}
+// return true;
+// }
+//
+// private void fillFilesetFromPage (IArchiveFileSet fileset) {
+// fileset.setExcludesPattern(page1.getExcludes());
+// fileset.setIncludesPattern(page1.getIncludes());
+// fileset.setFlattened(page1.getFlatten());
+// if( page1.isRootDirWorkspaceRelative()) {
+// fileset.setSourcePath(new Path(page1.getWorkspaceRelativeRootDir()));
+// fileset.setInWorkspace(true);
+// } else {
+// fileset.setSourcePath(new Path(page1.getAbsoluteRootDir()));
+// fileset.setInWorkspace(false);
+// }
}
-
- private void fillFilesetFromPage (IArchiveFileSet fileset) {
- fileset.setExcludesPattern(page1.getExcludes());
- fileset.setIncludesPattern(page1.getIncludes());
- fileset.setFlattened(page1.getFlatten());
- if( page1.isRootDirWorkspaceRelative()) {
- fileset.setSourcePath(new Path(page1.getWorkspaceRelativeRootDir()));
- fileset.setInWorkspace(true);
- } else {
- fileset.setSourcePath(new Path(page1.getAbsoluteRootDir()));
- fileset.setInWorkspace(false);
- }
- }
public void addPages() {
page1 = new FilesetInfoWizardPage(getShell(), fileset, parentNode);
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/FilesetInfoWizardPage.java
===================================================================
---
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/FilesetInfoWizardPage.java 2008-07-07
15:46:34 UTC (rev 9081)
+++
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/FilesetInfoWizardPage.java 2008-07-08
00:15:46 UTC (rev 9082)
@@ -2,12 +2,11 @@
import java.util.ArrayList;
-import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
@@ -21,14 +20,10 @@
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.ContainerSelectionDialog;
-import org.eclipse.ui.ide.IDE;
import org.jboss.ide.eclipse.archives.core.ArchivesCore;
import org.jboss.ide.eclipse.archives.core.model.DirectoryScannerFactory;
import org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet;
@@ -42,29 +37,28 @@
public class FilesetInfoWizardPage extends WizardPage {
- private IArchiveFileSet fileset;
private IArchiveNode parentNode;
- private Text includesText;
- private Text excludesText;
- private ArchiveNodeDestinationComposite destinationComposite;
-
- private String includes, excludes, workspaceRelativeRootDir;
+ private IArchiveFileSet fileset;
+ private String includes, excludes, rawPath;
+ private String projectName;
+ private boolean flattened;
+ private boolean workspaceRelative;
/**
* This variable must at all times be global. ALWAYS
*/
- private IPath rootDir;
- private boolean rootDirIsWorkspaceRelative;
private FilesetPreviewComposite previewComposite;
private Composite mainComposite;
private Text rootDirText;
- private Label rootProjectLabel, flattenedLabel;
+ private Label flattenedLabel;
private Button rootDirWorkspaceBrowseButton;
private Button rootDirFilesystemBrowseButton;
private Button flattenedYes;
private Button flattenedNo;
- private boolean flattened;
+ private Text includesText;
+ private Text excludesText;
+ private ArchiveNodeDestinationComposite destinationComposite;
public FilesetInfoWizardPage (Shell parent, IArchiveFileSet fileset, IArchiveNode
parentNode) {
super(ArchivesUIMessages.FilesetInfoWizardPage_new_title,
ArchivesUIMessages.FilesetInfoWizardPage_new_title, null);
@@ -158,20 +152,6 @@
destinationKey.setLayoutData(createFormData(0,10,null,0,null,5, 0, max));
destinationComposite.setLayoutData(createFormData(0,5,null,0,destinationKey,5, 100,
-5));
-
- // root project row
- Label rootProjectKey = new Label(infoGroup, SWT.NONE);
- Composite rootProjectVal = new Composite(infoGroup, SWT.NONE);
- rootProjectVal.setLayout(new FormLayout());
- Label projectImageLabel = new Label(rootProjectVal, SWT.NONE);
- rootProjectLabel = new Label(rootProjectVal, SWT.NONE);
-
- projectImageLabel.setLayoutData(createFormData(0,0,null,0,0,0, null,0));
- rootProjectLabel.setLayoutData(createFormData(0,0,null,0,projectImageLabel, 10,
100,-5));
- rootProjectKey.setLayoutData(createFormData(destinationComposite,5,null,0,null,5,0,max));
- rootProjectVal.setLayoutData(createFormData(destinationComposite,5, null, 0,
destinationKey, 5, 100, -5));
-
-
// root dir
Label rootDirectoryLabel = new Label(infoGroup, SWT.NONE);
Composite rootDirValue = new Composite(infoGroup, SWT.NONE);
@@ -185,8 +165,8 @@
rootDirFilesystemBrowseButton.setLayoutData(createFormData(rootDirText,5,null,0,null,0,100,-5));
rootDirWorkspaceBrowseButton.setLayoutData(createFormData(rootDirText,5,null,0,null,0,rootDirFilesystemBrowseButton,
-5));
- rootDirectoryLabel.setLayoutData(createFormData(rootProjectVal,10,null,0,null,5,0,max));
- rootDirValue.setLayoutData(createFormData(rootProjectVal,5,null,0,rootDirectoryLabel,5,100,-5));
+ rootDirectoryLabel.setLayoutData(createFormData(destinationComposite,10,null,0,null,5,0,max));
+ rootDirValue.setLayoutData(createFormData(destinationComposite,5,null,0,rootDirectoryLabel,5,100,-5));
flattenedLabel = new Label(infoGroup, SWT.NONE);
flattenedYes = new Button(infoGroup, SWT.RADIO);
@@ -222,9 +202,6 @@
// customize widgets
destinationKey.setText(ArchivesUIMessages.FilesetInfoWizardPage_destination_label);
- rootProjectKey.setText(ArchivesUIMessages.FilesetInfoWizardPage_rootProject_label);
- projectImageLabel.setImage(
- PlatformUI.getWorkbench().getSharedImages().getImage(IDE.SharedImages.IMG_OBJ_PROJECT));
rootDirectoryLabel.setText(ArchivesUIMessages.FilesetInfoWizardPage_rootDirectory_label);
rootDirWorkspaceBrowseButton.setText(ArchivesUIMessages.FilesetInfoWizardPage_rootDirWorkspaceBrowseButton_label);
rootDirFilesystemBrowseButton.setText(ArchivesUIMessages.FilesetInfoWizardPage_rootDirFilesystemBrowseButton_label);
@@ -260,13 +237,13 @@
rootDirWorkspaceBrowseButton.addSelectionListener(new SelectionAdapter () {
public void widgetSelected(SelectionEvent e) {
- browseWorkspaceForRootDir();
+ //browseWorkspaceForRootDir();
}
});
rootDirFilesystemBrowseButton.addSelectionListener(new SelectionAdapter () {
public void widgetSelected(SelectionEvent e) {
- browseFilesystemForRootDir();
+ //browseFilesystemForRootDir();
}
});
@@ -292,31 +269,34 @@
return excludes;
}
- public boolean getFlatten() {
+ public boolean isFlattened() {
return flattened;
}
- public String getAbsoluteRootDir () {
- return rootDir.toOSString();
+ public boolean isRootDirWorkspaceRelative () {
+ return workspaceRelative;
}
- public String getWorkspaceRelativeRootDir() {
- return workspaceRelativeRootDir;
+ public String getRawPath() {
+ return rawPath;
}
-
- public boolean isRootDirWorkspaceRelative () {
- return rootDirIsWorkspaceRelative;
+
+ public String replaceVariables() {
+ try {
+ return ArchivesCore.getInstance().getVFS().
+ performStringSubstitution(rawPath,
+ projectName, true);
+ } catch( CoreException ce ) {
+ }
+ return null;
}
private void fillDefaults () {
- String projectName = "";
IProject[] project = ResourcesPlugin.getWorkspace().getRoot().getProjects();
for( int i = 0; i < project.length; i++ )
if( project[i].getLocation().equals(parentNode.getProjectPath()))
projectName = project[i].getName();
-
- rootProjectLabel.setText(projectName);
-
+
if (fileset != null) {
if (fileset.getIncludesPattern() != null) {
includes = fileset.getIncludesPattern();
@@ -327,22 +307,21 @@
excludesText.setText(excludes);
}
- if (fileset.getGlobalSourcePath() != null) {
- rootDir = fileset.getGlobalSourcePath();
- workspaceRelativeRootDir = fileset.getSourcePath().toString();
- rootDirIsWorkspaceRelative = fileset.isInWorkspace();
- rootDirText.setText(fileset.getSourcePath().toString());
+ if (fileset.getRawSourcePath() != null) {
+ rawPath = fileset.getRawSourcePath();
+ rootDirText.setText(rawPath);
}
+ workspaceRelative = fileset.isInWorkspace();
flattened = fileset.isFlattened();
flattenedYes.setSelection(flattened);
flattenedNo.setSelection(!flattened);
} else {
- rootDirIsWorkspaceRelative = true;
- rootDir = parentNode.getProjectPath();
- workspaceRelativeRootDir = projectName;
+ rawPath = "${current_project}";
+ workspaceRelative = true;
flattened = false;
+ rootDirText.setText(rawPath);
flattenedYes.setSelection(flattened);
flattenedNo.setSelection(!flattened);
}
@@ -350,9 +329,8 @@
}
private void changePreview() {
- IPath path = rootDirIsWorkspaceRelative ? new Path(workspaceRelativeRootDir) :
rootDir;
DirectoryScannerExtension ds = DirectoryScannerFactory.createDirectoryScanner(
- path, null, includes, excludes, rootDirIsWorkspaceRelative, true);
+ replaceVariables(), null, includes, excludes, parentNode.getProjectName(),
workspaceRelative, true);
String[] fsRelative = ds.getIncludedFiles();
IPath filesetRelative;
ArrayList<IPath> list = new ArrayList<IPath>();
@@ -367,7 +345,7 @@
previewComposite.setInput(list.toArray());
}
-
+ /*
private void browseWorkspaceForRootDir () {
IContainer workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(),
workspaceRoot, true,
@@ -413,5 +391,6 @@
changePreview();
}
}
+ */
}
Added:
trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/projects/JBIDE1406/.classpath
===================================================================
---
trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/projects/JBIDE1406/.classpath
(rev 0)
+++
trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/projects/JBIDE1406/.classpath 2008-07-08
00:15:46 UTC (rev 9082)
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added:
trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/projects/JBIDE1406/.packages
===================================================================
---
trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/projects/JBIDE1406/.packages
(rev 0)
+++
trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/projects/JBIDE1406/.packages 2008-07-08
00:15:46 UTC (rev 9082)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<packages>
+ <package name="JBIDE1406.jar" type="jar"
todir="${current.project}/output" exploded="true"
inWorkspace="true">
+ <fileset dir="${current.project}" includes="**"
excludes="**/*.jar" inWorkspace="true" flatten="false">
+ <properties></properties>
+ </fileset>
+ <properties>
+ <property
name="org.jboss.ide.eclipse.as.core.packages.ModuleIDPropertyKey"
value="1214949466221"></property>
+ </properties>
+ </package>
+ <properties></properties>
+</packages>
\ No newline at end of file
Added:
trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/projects/JBIDE1406/.project
===================================================================
---
trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/projects/JBIDE1406/.project
(rev 0)
+++
trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/projects/JBIDE1406/.project 2008-07-08
00:15:46 UTC (rev 9082)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>JBIDE1406</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.jboss.ide.eclipse.archives.core.archivesBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.jboss.ide.eclipse.archives.core.archivesNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added:
trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/projects/JBIDE1406/src/in.properties
===================================================================
---
trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/projects/JBIDE1406/src/in.properties
(rev 0)
+++
trunk/core/tests/org.jboss.ide.eclipse.archives.test/inputs/projects/JBIDE1406/src/in.properties 2008-07-08
00:15:46 UTC (rev 9082)
@@ -0,0 +1 @@
+this=test
\ No newline at end of file
Modified:
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/ArchivesTestSuite.java
===================================================================
---
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/ArchivesTestSuite.java 2008-07-07
15:46:34 UTC (rev 9081)
+++
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/ArchivesTestSuite.java 2008-07-08
00:15:46 UTC (rev 9082)
@@ -9,6 +9,7 @@
import org.jboss.ide.eclipse.archives.test.model.ModelUtilTest;
import org.jboss.ide.eclipse.archives.test.model.XBMarshallTest;
import org.jboss.ide.eclipse.archives.test.model.XBUnmarshallTest;
+import org.jboss.ide.eclipse.archives.test.projects.JBIDE1406Test;
import org.jboss.ide.eclipse.archives.test.projects.JBIDE2099Test;
import org.jboss.ide.eclipse.archives.test.projects.JBIDE2296Test;
import org.jboss.ide.eclipse.archives.test.projects.JBIDE2311Test;
@@ -28,6 +29,7 @@
suite.addTestSuite(ModelTruezipBridgeTest.class);
// jiras
+ suite.addTestSuite(JBIDE1406Test.class);
suite.addTestSuite(JBIDE2099Test.class);
suite.addTestSuite(JBIDE2296Test.class);
suite.addTestSuite(JBIDE2311Test.class);
Modified:
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/ModelTest.java
===================================================================
---
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/ModelTest.java 2008-07-07
15:46:34 UTC (rev 9081)
+++
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/ModelTest.java 2008-07-08
00:15:46 UTC (rev 9082)
@@ -47,7 +47,7 @@
protected IArchiveFileSet createFileSet(String includes, String path) {
IArchiveFileSet fs = ArchiveNodeFactory.createFileset();
fs.setIncludesPattern(includes);
- fs.setSourcePath(new Path(path));
+ fs.setRawSourcePath( path );
return fs;
}
Modified:
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/ModelUtilTest.java
===================================================================
---
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/ModelUtilTest.java 2008-07-07
15:46:34 UTC (rev 9081)
+++
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/ModelUtilTest.java 2008-07-08
00:15:46 UTC (rev 9082)
@@ -73,14 +73,14 @@
IArchiveFileSet outerFileset = ArchiveNodeFactory.createFileset();
outerFileset.setInWorkspace(false);
- outerFileset.setSourcePath(fileTrees.append("misc"));
+ outerFileset.setRawSourcePath(fileTrees.append("misc").toString());
outerFileset.setExcludesPattern("**/*.gif,**/*.png");
outerFileset.setIncludesPattern("**/*");
topFolder.addChild(outerFileset);
IArchiveFileSet imageFileset = ArchiveNodeFactory.createFileset();
imageFileset.setInWorkspace(false);
- imageFileset.setSourcePath(fileTrees.append("misc"));
+ imageFileset.setRawSourcePath(fileTrees.append("misc").toString());
imageFileset.setIncludesPattern("**/*.gif,**/*.png,**/*.xml");
images.addChild(imageFileset);
@@ -140,7 +140,7 @@
IArchiveFileSet otherFS = ArchiveNodeFactory.createFileset();
otherFS.setIncludesPattern(xmlFS[0].getIncludesPattern());
otherFS.setInWorkspace(xmlFS[0].isInWorkspace());
- otherFS.setSourcePath(xmlFS[0].getSourcePath());
+ otherFS.setRawSourcePath(xmlFS[0].getRawSourcePath());
xmlFS[0].getParent().addChild(otherFS);
assertTrue(testMatches(xmlFS[0], xml, rootArchive));
Added:
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/StringSubstitutionTest.java
===================================================================
---
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/StringSubstitutionTest.java
(rev 0)
+++
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/StringSubstitutionTest.java 2008-07-08
00:15:46 UTC (rev 9082)
@@ -0,0 +1,57 @@
+package org.jboss.ide.eclipse.archives.test.model;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Path;
+import org.jboss.ide.eclipse.archives.core.ArchivesCore;
+import org.jboss.ide.eclipse.archives.core.model.other.internal.WorkspaceVFS;
+
+public class StringSubstitutionTest extends TestCase {
+
+ private static final String ONE = "/this/is/a/test";
+ private static final String TWO = "${nonexistant}/this/is/a/test";
+
+ public void testNoVariables() {
+ WorkspaceVFS vfs = (WorkspaceVFS)ArchivesCore.getInstance().getVFS();
+ try {
+ String out1 = vfs.performStringSubstitution(ONE, true);
+ assertEquals(ONE, out1);
+ } catch( CoreException ce ) {
+ fail();
+ }
+ }
+
+ public void testVariableNotSet() {
+ WorkspaceVFS vfs = (WorkspaceVFS)ArchivesCore.getInstance().getVFS();
+ try {
+ vfs.performStringSubstitution(TWO, true);
+ } catch( CoreException ce ) {
+ return;
+ }
+ fail();
+ }
+
+ public void testVariableNotSet2() {
+ WorkspaceVFS vfs = (WorkspaceVFS)ArchivesCore.getInstance().getVFS();
+ try {
+ String out2 = vfs.performStringSubstitution(TWO, false);
+ assertEquals(TWO, out2);
+ } catch( CoreException ce ) {
+ fail();
+ }
+ }
+
+ public void testSetVariable() {
+ try {
+ ResourcesPlugin.getWorkspace().getPathVariableManager().setValue("test_variable",
new Path("/here"));
+ WorkspaceVFS vfs = (WorkspaceVFS)ArchivesCore.getInstance().getVFS();
+ String out = vfs.performStringSubstitution("${test_variable}", true);
+ assertEquals("/here", out);
+ ResourcesPlugin.getWorkspace().getPathVariableManager().setValue("test_variable",
null);
+ } catch( CoreException ce ) {
+ fail();
+ }
+ }
+}
Added:
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/projects/JBIDE1406Test.java
===================================================================
---
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/projects/JBIDE1406Test.java
(rev 0)
+++
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/projects/JBIDE1406Test.java 2008-07-08
00:15:46 UTC (rev 9082)
@@ -0,0 +1,47 @@
+package org.jboss.ide.eclipse.archives.test.projects;
+
+import junit.framework.AssertionFailedError;
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.jboss.ide.eclipse.archives.core.build.ArchiveBuildDelegate;
+import org.jboss.ide.eclipse.archives.test.ArchivesTest;
+import org.jboss.tools.common.test.util.TestProjectProvider;
+
+public class JBIDE1406Test extends TestCase {
+ private TestProjectProvider provider;
+ private IProject project;
+ private IPath outputDir;
+ private IPath propsFile;
+ protected void setUp() throws Exception {
+ provider = new TestProjectProvider(ArchivesTest.PLUGIN_ID,
+ "inputs" + Path.SEPARATOR + "projects" + Path.SEPARATOR +
"JBIDE1406",
+ null, true);
+ project = provider.getProject();
+ project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
+ outputDir =
project.getLocation().append("output").append("JBIDE1406.jar");
+ propsFile = outputDir.append("src").append("in.properties");
+ }
+
+ protected void tearDown() throws Exception {
+ provider.dispose();
+ }
+
+ public void testJBIDE1406() {
+ ArchiveBuildDelegate delegate = new ArchiveBuildDelegate();
+ try {
+ delegate.fullProjectBuild(project.getLocation());
+ assertTrue(outputDir.toFile().isDirectory());
+ assertTrue(propsFile.toFile().exists());
+ assertTrue(propsFile.toFile().isFile());
+ } catch( AssertionFailedError afe) {
+ throw afe;
+ } catch( RuntimeException re ) {
+ fail(re.getMessage());
+ }
+ }
+}
Modified:
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/projects/JBIDE2099Test.java
===================================================================
---
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/projects/JBIDE2099Test.java 2008-07-07
15:46:34 UTC (rev 9081)
+++
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/projects/JBIDE2099Test.java 2008-07-08
00:15:46 UTC (rev 9082)
@@ -1,5 +1,6 @@
package org.jboss.ide.eclipse.archives.test.projects;
+import junit.framework.AssertionFailedError;
import junit.framework.TestCase;
import org.eclipse.core.resources.IProject;
@@ -34,8 +35,10 @@
try {
delegate.fullProjectBuild(project.getLocation());
assertTrue(outputWar.toFile().isDirectory());
+ } catch( AssertionFailedError afe) {
+ throw afe;
} catch( RuntimeException re ) {
- fail();
+ fail(re.getMessage());
}
}
}
Modified:
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/projects/JBIDE2311Test.java
===================================================================
---
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/projects/JBIDE2311Test.java 2008-07-07
15:46:34 UTC (rev 9081)
+++
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/projects/JBIDE2311Test.java 2008-07-08
00:15:46 UTC (rev 9082)
@@ -1,5 +1,6 @@
package org.jboss.ide.eclipse.archives.test.projects;
+import junit.framework.AssertionFailedError;
import junit.framework.TestCase;
import org.eclipse.core.resources.IProject;
@@ -30,8 +31,10 @@
ArchiveBuildDelegate delegate = new ArchiveBuildDelegate();
try {
delegate.fullProjectBuild(project.getLocation());
+ } catch( AssertionFailedError afe ) {
+ throw afe;
} catch( RuntimeException re ) {
- fail();
+ fail(re.getMessage());
}
}
}
Modified:
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/projects/JBIDE2315Test.java
===================================================================
---
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/projects/JBIDE2315Test.java 2008-07-07
15:46:34 UTC (rev 9081)
+++
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/projects/JBIDE2315Test.java 2008-07-08
00:15:46 UTC (rev 9082)
@@ -1,5 +1,6 @@
package org.jboss.ide.eclipse.archives.test.projects;
+import junit.framework.AssertionFailedError;
import junit.framework.TestCase;
import org.eclipse.core.resources.IProject;
@@ -30,6 +31,8 @@
ArchiveBuildDelegate delegate = new ArchiveBuildDelegate();
try {
delegate.fullProjectBuild(project.getLocation());
+ } catch( AssertionFailedError afe ) {
+ throw afe;
} catch( RuntimeException re ) {
fail(re.getMessage());
}
Modified:
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/projects/JBIDE2439Test.java
===================================================================
---
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/projects/JBIDE2439Test.java 2008-07-07
15:46:34 UTC (rev 9081)
+++
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/projects/JBIDE2439Test.java 2008-07-08
00:15:46 UTC (rev 9082)
@@ -2,6 +2,7 @@
import java.util.ArrayList;
+import junit.framework.AssertionFailedError;
import junit.framework.TestCase;
import org.eclipse.core.resources.IFile;
@@ -55,7 +56,7 @@
delegate.fullProjectBuild(aProject.getLocation());
aProject.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
IResource outs = aProject.getFolder("outputs");
- final ArrayList list = new ArrayList();
+ final ArrayList<IResource> list = new ArrayList<IResource>();
outs.accept(new IResourceVisitor() {
public boolean visit(IResource resource) throws CoreException {
@@ -66,6 +67,8 @@
}
});
assertEquals(5, list.size());
+ } catch( AssertionFailedError afe ) {
+ throw afe;
} catch( RuntimeException re ) {
fail(re.getMessage());
} catch( CoreException ce ) {