[jbosstools-commits] JBoss Tools SVN: r9158 - in trunk/core/plugins: org.jboss.ide.eclipse.archives.core/schema and 14 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Wed Jul 16 20:10:42 EDT 2008


Author: rob.stryker at jboss.com
Date: 2008-07-16 20:10:42 -0400 (Wed, 16 Jul 2008)
New Revision: 9158

Added:
   trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/composites/ArchiveFilesetDestinationComposite.java
Removed:
   trunk/core/plugins/org.jboss.ide.eclipse.archives.core/schema/variableProvider.exsd
   trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/IVariableProvider.java
   trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceVariableManager.java
   trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/dialogs/ArchivesVariableDialog.java
   trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/dialogs/SelectVariableDialog.java
   trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/preferences/VariablesPreferencePage.java
   trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/VariablesContentProvider.java
   trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/VariablesLabelProvider.java
   trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/garbage/ArchiveDestinationComposite.java
   trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/garbage/ArchiveFilesetDestinationComposite.java
   trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/garbage/ArchiveNodeDestinationComposite.java
Modified:
   trunk/core/plugins/org.jboss.ide.eclipse.archives.core/plugin.xml
   trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceExtensionManager.java
   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/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/internal/ArchiveImpl.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/META-INF/MANIFEST.MF
   trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/plugin.xml
   trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/composites/ArchiveSourceDestinationComposite.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
Log:
JBIDE-1406 more changes for max

Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/plugin.xml
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/plugin.xml	2008-07-16 21:30:02 UTC (rev 9157)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/plugin.xml	2008-07-17 00:10:42 UTC (rev 9158)
@@ -3,7 +3,6 @@
 <plugin>
    <extension-point id="archiveTypes" name="JBoss Tools Package Type" schema="schema/archiveTypes.exsd"/>
    <extension-point id="actionTypes" name="JBoss Tools Build Action Type" schema="schema/actionTypes.exsd"/>
-   <extension-point id="variableProviders" name="Variable Provider" schema="schema/variableProvider.exsd"/>
    <extension
          id="archivesNature"
          name="JBossIDE Packages Nature"
@@ -53,14 +52,13 @@
             label="Ant Task">
       </actionType>
    </extension>
-   
-   
    <extension
-         point="org.jboss.ide.eclipse.archives.core.variableProviders">
-      <provider class="org.jboss.ide.eclipse.archives.core.model.other.internal.WorkspaceVariableManager$DefaultVariableProvider"/>
-      <provider class="org.jboss.ide.eclipse.archives.core.model.other.internal.WorkspaceVariableManager$LinkedResourceVariableProvider"/>
-      <provider class="org.jboss.ide.eclipse.archives.core.model.other.internal.WorkspaceVariableManager$ClasspathVariableProvider"/>
-      <provider class="org.jboss.ide.eclipse.archives.core.model.other.internal.WorkspaceVariableManager$ValueVariableProvider"/>
-   </extension> 
-
+         point="org.eclipse.core.variables.dynamicVariables">
+      <variable
+            description="The project an archives node is declared in."
+            name="archives_current_project"
+            resolver="org.jboss.ide.eclipse.archives.core.model.other.internal.WorkspaceVFS"
+            supportsArgument="false">
+      </variable>
+   </extension>
 </plugin>

Deleted: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/schema/variableProvider.exsd
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/schema/variableProvider.exsd	2008-07-16 21:30:02 UTC (rev 9157)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/schema/variableProvider.exsd	2008-07-17 00:10:42 UTC (rev 9158)
@@ -1,102 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.jboss.ide.eclipse.archives.core" xmlns="http://www.w3.org/2001/XMLSchema">
-<annotation>
-      <appinfo>
-         <meta.schema plugin="org.jboss.ide.eclipse.archives.core" id="packageTypes" name="JBoss Tools Package Type"/>
-      </appinfo>
-      <documentation>
-         [Enter description of this extension point.]
-      </documentation>
-   </annotation>
-
-   <element name="extension">
-      <annotation>
-         <appinfo>
-            <meta.element />
-         </appinfo>
-      </annotation>
-      <complexType>
-         <sequence>
-            <element ref="provider" minOccurs="1" maxOccurs="unbounded"/>
-         </sequence>
-         <attribute name="point" type="string" use="required">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-         </attribute>
-         <attribute name="id" type="string">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-         </attribute>
-         <attribute name="name" type="string">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-               <appinfo>
-                  <meta.attribute translatable="true"/>
-               </appinfo>
-            </annotation>
-         </attribute>
-      </complexType>
-   </element>
-
-   <element name="provider">
-      <complexType>
-         <attribute name="class" type="string" use="required">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-               <appinfo>
-                  <meta.attribute kind="java" basedOn=":org.jboss.ide.eclipse.archives.core.model.IVariableProvider"/>
-               </appinfo>
-            </annotation>
-         </attribute>
-      </complexType>
-   </element>
-
-   <annotation>
-      <appinfo>
-         <meta.section type="since"/>
-      </appinfo>
-      <documentation>
-         [Enter the first release in which this extension point appears.]
-      </documentation>
-   </annotation>
-
-   <annotation>
-      <appinfo>
-         <meta.section type="examples"/>
-      </appinfo>
-      <documentation>
-         [Enter extension point usage example here.]
-      </documentation>
-   </annotation>
-
-   <annotation>
-      <appinfo>
-         <meta.section type="apiInfo"/>
-      </appinfo>
-      <documentation>
-         [Enter API information here.]
-      </documentation>
-   </annotation>
-
-   <annotation>
-      <appinfo>
-         <meta.section type="implementation"/>
-      </appinfo>
-      <documentation>
-         [Enter information about supplied implementation of this extension point.]
-      </documentation>
-   </annotation>
-
-
-</schema>

Deleted: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/IVariableProvider.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/IVariableProvider.java	2008-07-16 21:30:02 UTC (rev 9157)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/IVariableProvider.java	2008-07-17 00:10:42 UTC (rev 9158)
@@ -1,11 +0,0 @@
-package org.jboss.ide.eclipse.archives.core.model;
-
-public interface IVariableProvider extends IVariableManager {
-	public String getId();
-	public String getName();
-	public boolean getEnabled();
-	public void setEnabled(boolean val);
-	public int getWeight();
-	public void setWeight(int weight);
-	public int getDefaultWeight();
-}

Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceExtensionManager.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceExtensionManager.java	2008-07-16 21:30:02 UTC (rev 9157)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceExtensionManager.java	2008-07-17 00:10:42 UTC (rev 9158)
@@ -36,7 +36,6 @@
 import org.jboss.ide.eclipse.archives.core.model.IActionType;
 import org.jboss.ide.eclipse.archives.core.model.IArchiveType;
 import org.jboss.ide.eclipse.archives.core.model.IExtensionManager;
-import org.jboss.ide.eclipse.archives.core.model.IVariableProvider;
 
 /**
  * This class will be responsible for loading extension points in the core.
@@ -125,39 +124,4 @@
 			}
 		}
 	}
-	
-	
-	
-	private static Hashtable<String, IVariableProvider> variableProviders;
-	public IVariableProvider getVariableProvider(String id) {
-		if (variableProviders == null)
-			loadVariableProviders();
-		return variableProviders.get(id);
-	}
-	public IVariableProvider[] getVariableProviders() {
-		if( variableProviders == null )
-			loadVariableProviders();
-		Collection<IVariableProvider> c = variableProviders.values();
-		return c.toArray(new IVariableProvider[c.size()]);
-	}
-
-	private void loadVariableProviders() {
-		variableProviders = new Hashtable<String, IVariableProvider>();
-		IExtension[] extensions = findExtension(VARIABLE_PROVIDER_EXTENSION_ID);
-		for (int i = 0; i < extensions.length; i++) {
-			IConfigurationElement elements[] = extensions[i].getConfigurationElements();
-			for (int j = 0; j < elements.length; j++) {
-				try {
-					Object executable = elements[j].createExecutableExtension("class");
-					IVariableProvider type = (IVariableProvider)executable;
-					variableProviders.put(type.getId(), type);
-				} catch (InvalidRegistryObjectException e) {
-					ArchivesCore.getInstance().getLogger().log(IStatus.WARNING, e.getMessage(), e);
-				} catch( CoreException e ) {
-					ArchivesCore.getInstance().getLogger().log(IStatus.WARNING, e.getMessage(), e);
-				}
-			}
-		}
-	}
-	
 }

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-16 21:30:02 UTC (rev 9157)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceVFS.java	2008-07-17 00:10:42 UTC (rev 9158)
@@ -7,46 +7,21 @@
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.Path;
+import org.eclipse.core.variables.IDynamicVariable;
+import org.eclipse.core.variables.IDynamicVariableResolver;
+import org.eclipse.core.variables.VariablesPlugin;
+import org.jboss.ide.eclipse.archives.core.ArchivesCore;
 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 class WorkspaceVFS implements IArchivesVFS, IDynamicVariableResolver {
 	public WorkspaceVFS() {
-		manager = new WorkspaceVariableManager();
-		engine = new StringSubstitutionEngineClone();
 	}
-	
-	public WorkspaceVariableManager getVariableManager() {
-		return manager;
-	}
-	
+		
 	public String performStringSubstitution(String expression,
 			boolean reportUndefinedVariables) throws CoreException {
 		return performStringSubstitution(expression, null, reportUndefinedVariables);
 	}
 
-	public String performStringSubstitution(String expression,
-			String projectName, boolean reportUndefinedVariables)
-			throws CoreException {
-		// set this project name
-		if( expression == null )
-			return null;
-		
-		if( projectName != null ) {
-			manager.setValue(IVariableManager.CURRENT_PROJECT, projectName);
-		}
-		
-		String ret = engine.performStringSubstitution(expression, reportUndefinedVariables, manager);
-
-		if( projectName != null ) {
-			manager.setValue(IVariableManager.CURRENT_PROJECT, null);
-		}
-		return ret;
-	}
-
 	public IPath[] getWorkspaceChildren(IPath path) {
 		IResource res = ResourcesPlugin.getWorkspace().getRoot().findMember(path);
 		if( res != null || !(res instanceof IContainer)) {
@@ -90,4 +65,33 @@
 				return projects[i].getName();
 		return null;
 	}
+
+	
+	private String currentProject;
+	public synchronized String performStringSubstitution(String expression,
+			String projectName, boolean reportUndefinedVariables)
+			throws CoreException {
+		// set this project name
+		if( expression == null )
+			return null;
+		
+		currentProject = projectName;
+		try {
+			return VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(expression);
+		} finally {
+			currentProject = null;
+		}
+	}
+	
+	// Since the extension point re-instantiates this, we must delegate to the official instance
+	public String resolveValue(IDynamicVariable variable, String argument)
+			throws CoreException {
+		if( this == ArchivesCore.getInstance().getVFS()) {
+			if( variable.getName().equals("archives_current_project"))
+				return currentProject;
+		} else {
+			return ((WorkspaceVFS)ArchivesCore.getInstance().getVFS()).resolveValue(variable, argument);
+		}
+		return null;
+	}
 }

Deleted: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceVariableManager.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceVariableManager.java	2008-07-16 21:30:02 UTC (rev 9157)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceVariableManager.java	2008-07-17 00:10:42 UTC (rev 9158)
@@ -1,286 +0,0 @@
-package org.jboss.ide.eclipse.archives.core.model.other.internal;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.preferences.DefaultScope;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.eclipse.core.variables.IStringVariable;
-import org.eclipse.core.variables.IValueVariable;
-import org.eclipse.core.variables.VariablesPlugin;
-import org.eclipse.jdt.core.JavaCore;
-import org.jboss.ide.eclipse.archives.core.ArchivesCore;
-import org.jboss.ide.eclipse.archives.core.ArchivesCorePlugin;
-import org.jboss.ide.eclipse.archives.core.model.IArchivesLogger;
-import org.jboss.ide.eclipse.archives.core.model.IExtensionManager;
-import org.jboss.ide.eclipse.archives.core.model.IVariableManager;
-import org.jboss.ide.eclipse.archives.core.model.IVariableProvider;
-import org.osgi.service.prefs.BackingStoreException;
-
-public class WorkspaceVariableManager implements IVariableManager {
-	public static final String DEFAULT_PROVIDER = "org.jboss.ide.eclipse.archives.core.defaultVariableProvider";
-	protected IVariableProvider[] delegates;
-	public WorkspaceVariableManager() {
-	}
-	
-	public IVariableProvider[] getDelegates() {
-		sort();
-		IVariableProvider[] copy = new IVariableProvider[delegates.length];
-		for( int i = 0; i < delegates.length; i++ ) 
-			copy[i] = delegates[i];
-		return copy;
-	}
-	
-	public void sort() {
-		if( delegates == null ) {
-			IExtensionManager mgr = ArchivesCore.getInstance().getExtensionManager();
-			delegates = ((WorkspaceExtensionManager)mgr).getVariableProviders();
-		}
-		List<IVariableProvider> l = Arrays.asList(delegates);
-		Comparator<IVariableProvider> x = new Comparator<IVariableProvider>() {
-			public int compare(IVariableProvider o1, IVariableProvider o2) {
-				// different enablements
-				if( o1.getEnabled() != o2.getEnabled())
-					return o1.getEnabled() ? 1 : -1;
-				// now weights
-				if( o1.getWeight() != o2.getWeight() ) 
-					return o1.getWeight() > o2.getWeight() ? 1 : -1;
-				return 0;
-			} 
-		};
-		Collections.sort(l, x);
-		delegates = (IVariableProvider[]) l.toArray(new IVariableProvider[l.size()]);
-	}
-	
-	public String[] getVariableNames() {
-		sort();
-		ArrayList<String> list = new ArrayList<String>();
-		String[] names;
-		for(int i = 0; i < delegates.length; i++ ) {
-			if( delegates[i].getEnabled()) {
-				names = delegates[i].getVariableNames();
-				for( int j = 0; j < names.length; j++ ) {
-					if( !list.contains(names[j]))
-						list.add(names[j]);
-				}
-			}
-		}
-
-		return (String[]) list.toArray(new String[list.size()]);
-	}
-	
-	public boolean containsVariable(String variable) {
-		sort();
-		for(int i = 0; i < delegates.length; i++ ) 
-			if( delegates[i].getEnabled() && delegates[i].containsVariable(variable))
-				return true;
-		return false;
-	}
-
-	public String getVariableValue(String variable) {
-		sort();
-		for(int i = 0; i < delegates.length; i++ ) 
-			if( delegates[i].getEnabled() && delegates[i].containsVariable(variable))
-				return delegates[i].getVariableValue(variable);
-		return null;
-	}
-	
-	
-	public IVariableProvider getVariableLocation(String variable) {
-		sort();
-		for(int i = 0; i < delegates.length; i++ ) 
-			if( delegates[i].getEnabled() && delegates[i].containsVariable(variable))
-				return delegates[i];
-		return null;
-	}
-		
-	public static abstract class AbstractVariableProvider implements IVariableProvider {
-		protected String id;
-		protected String name;
-		protected boolean enabled;
-		protected int weight;
-		protected int defaultWeight;
-		
-		public AbstractVariableProvider(String id, String name, int defaultWeight) {
-			this.id = id;
-			this.name = name;
-			this.defaultWeight = defaultWeight;
-		}
-		
-		public String getId() {
-			return id;
-		}
-
-		public String getName() {
-			return name;
-		}
-		
-		public boolean getEnabled() {
-			IEclipsePreferences prefs = new DefaultScope().getNode(ArchivesCorePlugin.PLUGIN_ID);
-			return prefs.getBoolean(getPreferencePrefix() + "enabled", true);
-		}
-		
-		public int getWeight() {
-			IEclipsePreferences prefs = new DefaultScope().getNode(ArchivesCorePlugin.PLUGIN_ID);
-			return prefs.getInt(getPreferencePrefix() + "weight", defaultWeight);
-		}
-
-		public void setEnabled(boolean b) {
-			try {
-				IEclipsePreferences prefs = new DefaultScope().getNode(ArchivesCorePlugin.PLUGIN_ID);
-				prefs.putBoolean(getPreferencePrefix() + "enabled", b);
-				prefs.flush();
-				enabled = b;
-			} catch (BackingStoreException e) { 
-				ArchivesCore.getInstance().getLogger().log(IArchivesLogger.MSG_ERR, e.getMessage(), e);
-			}
-		}
-		
-		public void setWeight(int i) {
-			try {
-				IEclipsePreferences prefs = new DefaultScope().getNode(ArchivesCorePlugin.PLUGIN_ID);
-				prefs.putInt(getPreferencePrefix() + "weight", i);
-				prefs.flush();
-				weight = i;
-			} catch (BackingStoreException e) { 
-				ArchivesCore.getInstance().getLogger().log(IArchivesLogger.MSG_ERR, e.getMessage(), e);
-			}
-		}
-		
-		public int getDefaultWeight() {
-			return defaultWeight;
-		}
-		
-		public abstract String getPreferencePrefix();
-	}
-	
-	
-	public static class DefaultVariableProvider extends AbstractVariableProvider {
-		public static final String VALUE_PREFIX = "org.jboss.ide.eclipse.archives.core.model.other.internal.VariableManager.values.";
-		public static final String PREFERENCE_PREFIX = "org.jboss.ide.eclipse.archives.core.model.other.internal.VariableManager.prefs.";
-		public static final String ID = "org.jboss.ide.eclipse.archives.core.defaultVariableProvider";
-		public DefaultVariableProvider() {
-			super(ID, "Archives Variables", 0);
-		}
-		public String getPreferencePrefix() {
-			return PREFERENCE_PREFIX;
-		}
-		public boolean containsVariable(String variable) {
-			IEclipsePreferences prefs = new DefaultScope().getNode(ArchivesCorePlugin.PLUGIN_ID);
-			return prefs.get(VALUE_PREFIX + variable, null) != null;
-		}
-
-		public String[] getVariableNames() {
-			int prefixLength = VALUE_PREFIX.length();
-			ArrayList<String> list = new ArrayList<String>();
-			try {
-				IEclipsePreferences prefs = new DefaultScope().getNode(ArchivesCorePlugin.PLUGIN_ID);
-				String[] keys = prefs.keys();
-				for( int i = 0; i < keys.length; i++ )
-					if( keys[i].startsWith(VALUE_PREFIX) && !list.contains(keys[i].substring(prefixLength))) {
-						list.add(keys[i].substring(prefixLength));
-					}
-			} catch( BackingStoreException bse) {}
-			return (String[]) list.toArray(new String[list.size()]);
-		}
-
-		public String getVariableValue(String variable) {
-			IEclipsePreferences prefs = new DefaultScope().getNode(ArchivesCorePlugin.PLUGIN_ID);
-			return prefs.get(VALUE_PREFIX + variable, null);
-		}
-	}
-	
-	public static class LinkedResourceVariableProvider extends AbstractVariableProvider {
-		public static final String PREFERENCE_PREFIX = "org.jboss.ide.eclipse.archives.core.model.other.internal.LinkedResourceVariableManager.prefs.";
-		public static final String ID = "org.jboss.ide.eclipse.archives.core.resourceVariableProvider";
-		public LinkedResourceVariableProvider() {
-			super(ID, "Linked Resources Path Variables", 1);
-		}
-		public String getPreferencePrefix() {
-			return PREFERENCE_PREFIX;
-		}
-		public boolean containsVariable(String variable) {
-			return ResourcesPlugin.getWorkspace().getPathVariableManager().getValue(variable) != null;
-		}
-
-		public String[] getVariableNames() {
-			return ResourcesPlugin.getWorkspace().getPathVariableManager().getPathVariableNames();
-		}
-
-		public String getVariableValue(String variable) {
-			return ResourcesPlugin.getWorkspace().getPathVariableManager().getValue(variable).toString();
-		}
-	}
-	
-	public static class ClasspathVariableProvider extends AbstractVariableProvider {
-		public static final String PREFERENCE_PREFIX = "org.jboss.ide.eclipse.archives.core.model.other.internal.JDTVariableProvider.prefs.";
-		public static final String ID = "org.jboss.ide.eclipse.archives.core.classpathVariableProvider";
-		public ClasspathVariableProvider() {
-			super(ID, "Classpath Variables", 2);
-		}
-		public String getPreferencePrefix() {
-			return PREFERENCE_PREFIX;
-		}
-
-		public boolean containsVariable(String variable) {
-			return Arrays.asList(JavaCore.getClasspathVariableNames()).contains(variable);
-		}
-
-		public String[] getVariableNames() {
-			return JavaCore.getClasspathVariableNames();
-		}
-
-		public String getVariableValue(String variable) {
-			return JavaCore.getClasspathVariable(variable).toString();
-		}
-	}
-	
-
-	public static class ValueVariableProvider extends AbstractVariableProvider {
-		public static final String PREFERENCE_PREFIX = "org.jboss.ide.eclipse.archives.core.model.other.internal.ValueVariableProvider.prefs.";
-		public static final String ID = "org.jboss.ide.eclipse.archives.core.stringReplacementValueVariables";
-		public ValueVariableProvider() {
-			super(ID, "String Replacement Variables", 3);
-		}
-		public String getPreferencePrefix() {
-			return PREFERENCE_PREFIX;
-		}
-
-		public boolean containsVariable(String variable) {
-			return VariablesPlugin.getDefault().getStringVariableManager().getValueVariable(variable) != null;
-		}
-
-		public String[] getVariableNames() {
-			ArrayList<String> list = new ArrayList<String>();
-			IStringVariable[] keys2 = VariablesPlugin.getDefault().getStringVariableManager().getValueVariables();
-			for( int i = 0; i < keys2.length; i++ )
-				list.add(keys2[i].getName());
-			return (String[]) list.toArray(new String[list.size()]);
-		}
-
-		public String getVariableValue(String variable) {
-			IValueVariable v = VariablesPlugin.getDefault().getStringVariableManager().getValueVariable(variable);
-			if( v != null )
-				return v.getValue();
-			return null;
-		}
-	}
-	
-	public void setValue(String name, String value) {
-		try {
-			IEclipsePreferences prefs = new DefaultScope().getNode(ArchivesCorePlugin.PLUGIN_ID);
-			if( value != null )
-				prefs.put(DefaultVariableProvider.VALUE_PREFIX + name, value.toString());
-			else 
-				prefs.remove(DefaultVariableProvider.VALUE_PREFIX + name);
-			prefs.flush();
-		} catch (BackingStoreException e) { 
-			ArchivesCore.getInstance().getLogger().log(IArchivesLogger.MSG_ERR, e.getMessage(), e);
-		}
-	}
-}
\ No newline at end of file

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-16 21:30:02 UTC (rev 9157)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/DirectoryScannerFactory.java	2008-07-17 00:10:42 UTC (rev 9158)
@@ -97,7 +97,7 @@
 		}
 		
 		public void setBasedir2(String path) {
-			String translatedPath = replaceVariables(path);
+			String translatedPath = refine(path);
 			if( translatedPath != null ) {
 				IPath translatedPath2 = new Path(translatedPath);
 				if( workspaceRelative ) {
@@ -109,10 +109,17 @@
 				}
 			}
 		}
-		public String replaceVariables(String rawPath) {
+		public String refine(String rawPath) {
 			try {
-				return ArchivesCore.getInstance().getVFS().
+				String refined = ArchivesCore.getInstance().getVFS().
 					performStringSubstitution(rawPath, fs.projectName, true);
+				if( workspaceRelative ) {
+					IPath p = new Path(refined);
+					if( !p.isAbsolute() )
+						p = new Path(fs.projectName).append(p).makeAbsolute();
+					return p.toString();
+				}
+				return refined;
 			} catch( CoreException ce ) {
 			}
 			return null;

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-16 21:30:02 UTC (rev 9157)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveImpl.java	2008-07-17 00:10:42 UTC (rev 9158)
@@ -85,7 +85,8 @@
 			} else {
 				return new Path(replaced);
 			}
-		} catch( CoreException ce ) {}
+		} catch( CoreException ce ) {
+		}
 		return null;
 	}
 

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-16 21:30:02 UTC (rev 9157)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/xpl/StringSubstitutionEngineClone.java	2008-07-17 00:10:42 UTC (rev 9158)
@@ -11,6 +11,7 @@
 package org.jboss.ide.eclipse.archives.core.xpl;
 
 import java.util.ArrayList;
+import java.util.EmptyStackException;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
@@ -28,9 +29,8 @@
 public class StringSubstitutionEngineClone {
 	
 	// 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 String VARIABLE_START = "${"; 
+	private static final char VARIABLE_END = '}';
 	// parsing states
 	private static final int SCAN_FOR_START = 0;
 	private static final int SCAN_FOR_END = 1;
@@ -40,102 +40,32 @@
 	 */
 	private StringBuffer fResult;
 	
-	/**
-	 * Whether substitutions were performed
-	 */
-	private boolean fSubs;
-	
-	/**
-	 * Stack of variables to resolve
-	 */
-	private Stack fStack;
-	
 	class VariableReference {
-		
-		// the text inside the variable reference
 		private StringBuffer fText;
-		
 		public VariableReference() {
 			fText = new StringBuffer();
 		}
-		
 		public void append(String text) {
 			fText.append(text);
 		}
-		
 		public String getText() {
 			return fText.toString();
 		}
-	
 	}
 	
-	/**
-	 * Performs recursive string substitution and returns the resulting string.
-	 * 
-	 * @param expression expression to resolve
-	 * @param reportUndefinedVariables whether to report undefined variables as an error
-	 * @return the resulting string with all variables recursively
-	 *  substituted
-	 * @exception CoreException if unable to resolve a referenced variable or if a cycle exists
-	 *  in referenced variables
-	 */
 	public String performStringSubstitution(String expression, boolean reportUndefinedVariables, IVariableManager manager ) throws CoreException {
 		substitute(expression, reportUndefinedVariables,manager );
-		List resolvedVariableSets = new ArrayList();
-		while (fSubs) {
-			HashSet resolved = substitute(fResult.toString(), reportUndefinedVariables,manager);			
-			
-			for(int i=resolvedVariableSets.size()-1; i>=0; i--) {
-				
-				HashSet prevSet = (HashSet)resolvedVariableSets.get(i);
-
-				if (prevSet.equals(resolved)) {
-					HashSet conflictingSet = new HashSet();
-					for (; i<resolvedVariableSets.size(); i++)
-						conflictingSet.addAll((HashSet)resolvedVariableSets.get(i));
-					
-					StringBuffer problemVariableList = new StringBuffer();
-					for (Iterator it=conflictingSet.iterator(); it.hasNext(); ) {
-						problemVariableList.append(it.next().toString());
-						problemVariableList.append(", "); //$NON-NLS-1$
-					}
-					problemVariableList.setLength(problemVariableList.length()-2); //truncate the last ", "
-					Status status = new Status(IStatus.ERROR, 
-							ArchivesCore.PLUGIN_ID, 
-							"Cycle found in variable replacement",
-							null);
-					throw new CoreException(status); 
-				}				
-			}		
-			
-			resolvedVariableSets.add(resolved);			
-		}
 		return fResult.toString();
 	}
 	
-	/**
-	 * Performs recursive string validation to ensure that all of the variables
-	 * contained in the expression exist
-	 * @param expression expression to validate
-	 * @exception CoreException if a referenced variable does not exist or if a cycle exists
-	 *  in referenced variables
-	 */
 	public void validateStringVariables(String expression, IVariableManager manager ) throws CoreException {
 		performStringSubstitution(expression, true, manager );
 	}
 	
-	/**
-	 * Makes a substitution pass of the given expression returns a Set of the variables that were resolved in this
-	 *  pass
-	 *  
-	 * @param expression source expression
-	 * @param reportUndefinedVariables whether to report undefined variables as an error
-	 * @exception CoreException if unable to resolve a variable
-	 */
 	private HashSet substitute(String expression, boolean reportUndefinedVariables, IVariableManager manager) throws CoreException {
+		Stack fStack;
 		fResult = new StringBuffer(expression.length());
 		fStack = new Stack();
-		fSubs = false;
 		
 		HashSet resolvedVariables = new HashSet();
 
@@ -237,17 +167,6 @@
 	private String resolve(VariableReference var, boolean reportUndefinedVariables, IVariableManager manager) throws CoreException {
 		String text = var.getText();
 		String name = null;
-//		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 )

Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/META-INF/MANIFEST.MF	2008-07-16 21:30:02 UTC (rev 9157)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/META-INF/MANIFEST.MF	2008-07-17 00:10:42 UTC (rev 9158)
@@ -11,11 +11,11 @@
  org.eclipse.core.resources,
  org.jboss.ide.eclipse.archives.core,
  org.eclipse.jdt.ui;bundle-version="3.4.0",
- org.eclipse.debug.ui;bundle-version="3.4.0"
+ org.eclipse.debug.ui;bundle-version="3.4.0",
+ org.eclipse.core.variables;bundle-version="3.2.100"
 Eclipse-LazyStart: true
 Export-Package: org.jboss.ide.eclipse.archives.ui,
  org.jboss.ide.eclipse.archives.ui.actions,
- org.jboss.ide.eclipse.archives.ui.dialogs,
  org.jboss.ide.eclipse.archives.ui.preferences,
  org.jboss.ide.eclipse.archives.ui.providers,
  org.jboss.ide.eclipse.archives.ui.util.composites,

Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/plugin.xml
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/plugin.xml	2008-07-16 21:30:02 UTC (rev 9157)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/plugin.xml	2008-07-17 00:10:42 UTC (rev 9158)
@@ -56,11 +56,6 @@
             class="org.jboss.ide.eclipse.archives.ui.preferences.MainPreferencePage"
             id="org.jboss.ide.eclipse.archives.ui.archivesPreferencePage"
             name="Packaging Archives"/>
-      <page
-            category="org.jboss.ide.eclipse.archives.ui.archivesPreferencePage"
-            class="org.jboss.ide.eclipse.archives.ui.preferences.VariablesPreferencePage"
-            id="org.jboss.ide.eclipse.archives.ui.variablesPreferencePage"
-            name="Archives Variables"/>
    </extension>
    
    

Deleted: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/dialogs/ArchivesVariableDialog.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/dialogs/ArchivesVariableDialog.java	2008-07-16 21:30:02 UTC (rev 9157)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/dialogs/ArchivesVariableDialog.java	2008-07-17 00:10:42 UTC (rev 9158)
@@ -1,187 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * I had to copy this class from debug.ui because
- * there were no getters or setters provided in the
- * FieldSummary class. 
- * 
- * Assholes. 
- */
-package org.jboss.ide.eclipse.archives.ui.dialogs;
-
-import java.io.File;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-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.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.jboss.ide.eclipse.archives.core.ArchivesCore;
-import org.jboss.ide.eclipse.archives.core.model.IVariableProvider;
-import org.jboss.ide.eclipse.archives.core.model.other.internal.WorkspaceVFS;
-import org.jboss.ide.eclipse.archives.core.model.other.internal.WorkspaceVariableManager;
-import org.jboss.ide.eclipse.archives.core.model.other.internal.WorkspaceVariableManager.DefaultVariableProvider;
-
-public class ArchivesVariableDialog extends Dialog {
-	private String title;
-	protected Composite panel;
-	private String name;
-	private String value;
-	private boolean canChangeName = true;
-	public ArchivesVariableDialog(Shell shell) {
-		super(shell);
-		this.title = "Archives Variable";
-		setShellStyle(getShellStyle() | SWT.RESIZE);
-		this.name = "";
-		this.value = "";
-	}
-
-	public ArchivesVariableDialog(Shell shell, String name, String value) {
-		this(shell);
-		this.name = name;
-		this.value = value;
-		canChangeName = false;
-	}
-	protected void configureShell(Shell shell) {
-		super.configureShell(shell);
-		if (title != null) {
-			shell.setText(title);
-		}
-	}
-
-	protected Control createButtonBar(Composite parent) {
-		Control bar = super.createButtonBar(parent);
-		validateFields();
-		return bar;
-	}
-	
-	protected Control createDialogArea(Composite parent) {
-		Composite container = (Composite)super.createDialogArea(parent);
-		container.setLayout(new GridLayout(2, false));
-		container.setLayoutData(new GridData(GridData.FILL_BOTH));
-		
-		panel = new Composite(container, SWT.NONE);
-		GridLayout layout = new GridLayout(2, false);
-		panel.setLayout(layout);
-		panel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-		
-		createNameField("Name", name);
-		createValueField("Value", value);
-		Dialog.applyDialogFont(container);
-		return container;
-	}
-
-	protected void createNameField(String labelText, String initialValue) { 
-		Label label = new Label(panel, SWT.NONE);
-		label.setText(labelText);
-		label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
-		
-		final Text text = new Text(panel, SWT.SINGLE | SWT.BORDER);
-		text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
-		// make sure rows are the same height on both panels.
-		label.setSize(label.getSize().x, text.getSize().y); 
-		
-		if (initialValue != null) {
-			text.setText(initialValue);
-		}
-		
-		text.addModifyListener(new ModifyListener() {
-			public void modifyText(ModifyEvent e) {
-				name = text.getText();
-				validateFields();
-			}
-		});
-		if( !canChangeName )
-			text.setEnabled(false);
-	}
-	
-	protected void createValueField(String labelText, String initialValue) {
-		Label label = new Label(panel, SWT.NONE);
-		label.setText(labelText);
-		label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
-		
-		Composite comp = new Composite(panel, SWT.NONE);
-		GridLayout layout = new GridLayout();
-		layout.marginHeight=0;
-		layout.marginWidth=0;
-		comp.setLayout(layout);
-		comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-		
-		final Text text = new Text(comp, SWT.SINGLE | SWT.BORDER);
-		GridData data = new GridData(GridData.FILL_HORIZONTAL);
-		data.widthHint = 200;
-		text.setLayoutData(data);
-
-		// make sure rows are the same height on both panels.
-		label.setSize(label.getSize().x, text.getSize().y); 
-		
-		if (initialValue != null) {
-			text.setText(initialValue);
-		}
-
-		text.addModifyListener(new ModifyListener() {
-			public void modifyText(ModifyEvent e) {
-				value=text.getText();
-				validateFields();
-			}
-		});
-
-		Button button = createButton(comp, IDialogConstants.IGNORE_ID, "Browse", false); 
-		button.addSelectionListener(new SelectionAdapter() {
-			public void widgetSelected(SelectionEvent e) {
-				DirectoryDialog dialog = new DirectoryDialog(getShell());
-				String currentWorkingDir = text.getText();
-				if (!currentWorkingDir.trim().equals("")) {
-					File path = new File(currentWorkingDir);
-					if (path.exists()) {
-						dialog.setFilterPath(currentWorkingDir);
-					}			
-				}
-				
-				String selectedDirectory = dialog.open();
-				if (selectedDirectory != null) {
-					text.setText(selectedDirectory);
-				}		
-			}
-		});
-	}
-	
-	public void validateFields() {
-		boolean valid = true;
-		if( "".equals(name)) valid = false;
-		if( "".equals(value)) valid = false;
-		WorkspaceVariableManager mgr = ((WorkspaceVFS)ArchivesCore.getInstance().getVFS()).getVariableManager();
-		IVariableProvider loc = mgr.getVariableLocation(name);
-		// already declared
-		if( loc != null && DefaultVariableProvider.ID.equals(loc.getId()) && canChangeName)
-			valid = false;
-		getButton(IDialogConstants.OK_ID).setEnabled(valid);
-	}
-	public String getName() {
-		return name;
-	}
-
-	public String getValue() {
-		return value;
-	}
-}

Deleted: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/dialogs/SelectVariableDialog.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/dialogs/SelectVariableDialog.java	2008-07-16 21:30:02 UTC (rev 9157)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/dialogs/SelectVariableDialog.java	2008-07-17 00:10:42 UTC (rev 9158)
@@ -1,91 +0,0 @@
-package org.jboss.ide.eclipse.archives.ui.dialogs;
-
-import java.util.Comparator;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-import org.jboss.ide.eclipse.archives.core.model.IVariableProvider;
-import org.jboss.ide.eclipse.archives.ui.preferences.VariablesPreferencePage.Wrapped;
-import org.jboss.ide.eclipse.archives.ui.providers.VariablesContentProvider;
-import org.jboss.ide.eclipse.archives.ui.providers.VariablesLabelProvider;
-
-public class SelectVariableDialog extends Dialog {
-	private TreeViewer viewer;
-	private Comparator<IVariableProvider> comparator;
-	private VariablesContentProvider cProvider;
-	private VariablesLabelProvider lProvider;
-	private Object selected;
-	public SelectVariableDialog(Shell parentShell) {
-		super(parentShell);
-	}
-
-	protected void configureShell(Shell shell) {
-		super.configureShell(shell);
-		shell.setText("Title");
-	}
-	protected Control createButtonBar(Composite parent) {
-		Control bar = super.createButtonBar(parent);
-		validateFields();
-		return bar;
-	}
-	protected Control createDialogArea(Composite parent) {
-		Composite master = new Composite(parent, SWT.NONE);
-		master.setLayout(new FormLayout());
-		viewer = new TreeViewer(master, SWT.SINGLE | SWT.BORDER);
-		comparator = new Comparator<IVariableProvider>() {
-			public int compare(IVariableProvider o1, IVariableProvider o2) {
-				if( o1.getEnabled() != o2.getEnabled())
-					return o1.getEnabled() ? -1 : 1;
-
-				// now weights
-				if( o1.getWeight() != o2.getWeight() ) 
-					return o1.getWeight() > o2.getWeight() ? 1 : -1;
-				return 0;
-			} 
-		};
-		cProvider = new VariablesContentProvider(comparator);
-		lProvider = new VariablesLabelProvider(null);
-		viewer.setContentProvider(cProvider);
-		viewer.setLabelProvider(lProvider);
-		viewer.setInput("");
-		FormData viewerData = new FormData();
-		viewerData.left = new FormAttachment(0,0);
-		viewerData.right = new FormAttachment(0,250);
-		viewerData.top = new FormAttachment(0,0);
-		viewerData.bottom = new FormAttachment(0,400);
-		viewer.getTree().setLayoutData(viewerData);
-		viewer.addSelectionChangedListener(new ISelectionChangedListener(){
-			public void selectionChanged(SelectionChangedEvent event) {
-				selectionChanged2();
-				validateFields();
-			}});
-		return viewer.getTree();
-	}
-	
-	protected void selectionChanged2() {
-		IStructuredSelection sel = (IStructuredSelection)viewer.getSelection();
-		selected = sel.getFirstElement();
-	}
-	public void validateFields() {
-		boolean valid = false;
-		if( selected != null && selected instanceof Wrapped && ((Wrapped)selected).getName() != null)
-			valid = true;
-		getButton(IDialogConstants.OK_ID).setEnabled(valid);
-	}
-	public String getSelectedVarName() {
-		if( selected != null && selected instanceof Wrapped && ((Wrapped)selected).getName() != null)
-			return ((Wrapped)selected).getName();
-		return null;
-	}
-}

Deleted: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/preferences/VariablesPreferencePage.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/preferences/VariablesPreferencePage.java	2008-07-16 21:30:02 UTC (rev 9157)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/preferences/VariablesPreferencePage.java	2008-07-17 00:10:42 UTC (rev 9158)
@@ -1,340 +0,0 @@
-package org.jboss.ide.eclipse.archives.ui.preferences;
-
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.List;
-
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.ui.dialogs.PropertyPage;
-import org.jboss.ide.eclipse.archives.core.ArchivesCore;
-import org.jboss.ide.eclipse.archives.core.model.IPreferenceManager;
-import org.jboss.ide.eclipse.archives.core.model.IVariableProvider;
-import org.jboss.ide.eclipse.archives.core.model.other.internal.WorkspaceVFS;
-import org.jboss.ide.eclipse.archives.core.model.other.internal.WorkspaceVariableManager;
-import org.jboss.ide.eclipse.archives.core.model.other.internal.WorkspaceVariableManager.DefaultVariableProvider;
-import org.jboss.ide.eclipse.archives.ui.ArchivesSharedImages;
-import org.jboss.ide.eclipse.archives.ui.ArchivesUIMessages;
-import org.jboss.ide.eclipse.archives.ui.dialogs.ArchivesVariableDialog;
-import org.jboss.ide.eclipse.archives.ui.providers.VariablesContentProvider;
-import org.jboss.ide.eclipse.archives.ui.providers.VariablesLabelProvider;
-import org.jboss.ide.eclipse.archives.ui.providers.VariablesLabelProvider.IVariableEnablementChecker;
-
-public class VariablesPreferencePage extends PropertyPage implements
-		IWorkbenchPreferencePage {
-	
-	private Group variablesGroup;
-	private TreeViewer variablesViewer;
-	private Button add,edit,remove,moveUp,moveDown,enable,disable;
-	private HashMap<IVariableProvider, Integer> newWeights;
-	private HashMap<IVariableProvider, Boolean> newEnablement;
-	private Comparator<IVariableProvider> pageComparator;
-	private VariablesContentProvider cProvider;
-	private VariablesLabelProvider lProvider;
-	public VariablesPreferencePage() {
-		super();
-		setTitle(ArchivesUIMessages.ArchivesVariables);
-		setImageDescriptor(ArchivesSharedImages.getImageDescriptor(ArchivesSharedImages.IMG_PACKAGE));
-		newWeights = new HashMap<IVariableProvider, Integer>();
-		newEnablement = new HashMap<IVariableProvider, Boolean>();
-		pageComparator = createComparator();
-	}
-
-	protected Comparator<IVariableProvider> createComparator() {
-		Comparator<IVariableProvider> x = new Comparator<IVariableProvider>() {
-			public int compare(IVariableProvider o1, IVariableProvider o2) {
-				if( nowEnabled(o1) != nowEnabled(o2))
-					return nowEnabled(o1) ? -1 : 1;
-
-				// now weights
-				if( nowWeight(o1) != nowWeight(o2) ) 
-					return nowWeight(o1) > nowWeight(o2) ? 1 : -1;
-				return 0;
-			}
-		};
-		return x;
-	}
-	
-	protected Control createContents(Composite parent) {
-		Composite main = new Composite(parent, SWT.NONE);
-		main.setLayout(new GridLayout(1, false));
-		
-		createVariablesGroup(main);
-		return main;
-	}
-	
-	public IPreferenceManager getPrefManager() {
-		return ArchivesCore.getInstance().getPreferenceManager();
-	}
-	
-	protected void createVariablesGroup(Composite main) {
-		variablesGroup = new Group(main, SWT.NONE);
-		variablesGroup.setText(ArchivesUIMessages.VariablesGroup);
-		variablesGroup.setLayout(new FormLayout());
-		variablesGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
-		
-		variablesViewer = new TreeViewer(variablesGroup);
-		FormData fd = new FormData();
-		fd.left = new FormAttachment(0,5);
-		fd.top = new FormAttachment(0,5);
-		fd.right = new FormAttachment(0,300);
-		fd.bottom = new FormAttachment(80,0);
-		variablesViewer.getTree().setLayoutData(fd);
-		cProvider = new VariablesContentProvider(pageComparator);
-		lProvider = new VariablesLabelProvider(new IVariableEnablementChecker() {
-			public boolean isEnabled(IVariableProvider element) {
-				return nowEnabled((IVariableProvider)element);
-			}
-		});
-		variablesViewer.setContentProvider(cProvider);
-		variablesViewer.setLabelProvider(lProvider);
-		variablesViewer.setInput("");
-		
-		variablesViewer.addSelectionChangedListener(new ISelectionChangedListener() {
-			public void selectionChanged(SelectionChangedEvent event) {
-				viewerSelectionChanged();
-			} 
-		});
-		
-		// buttons
-		add = new Button(variablesGroup, SWT.NONE);
-		edit = new Button(variablesGroup, SWT.NONE);
-		remove = new Button(variablesGroup, SWT.NONE);
-		moveUp = new Button(variablesGroup, SWT.NONE);
-		moveDown = new Button(variablesGroup, SWT.NONE);
-		enable = new Button(variablesGroup, SWT.NONE);
-		disable = new Button(variablesGroup, SWT.NONE);
-		add.setLayoutData(createButtonLayoutData(null));
-		edit.setLayoutData(createButtonLayoutData(add));
-		remove.setLayoutData(createButtonLayoutData(edit));
-		moveUp.setLayoutData(createButtonLayoutData(remove));
-		moveDown.setLayoutData(createButtonLayoutData(moveUp));
-		enable.setLayoutData(createButtonLayoutData(moveDown));
-		disable.setLayoutData(createButtonLayoutData(enable));
-		add.setText(ArchivesUIMessages.Add);
-		edit.setText(ArchivesUIMessages.Edit);
-		remove.setText(ArchivesUIMessages.Remove);
-		moveUp.setText(ArchivesUIMessages.MoveUp);
-		moveDown.setText(ArchivesUIMessages.MoveDown);
-		enable.setText(ArchivesUIMessages.Enable);
-		disable.setText(ArchivesUIMessages.Disable);
-		
-		add.addSelectionListener(new SelectionListener() {
-			public void widgetDefaultSelected(SelectionEvent e) {
-			}
-			public void widgetSelected(SelectionEvent e) {
-				addPressed();
-			} });
-		edit.addSelectionListener(new SelectionListener() {
-			public void widgetDefaultSelected(SelectionEvent e) {
-			}
-			public void widgetSelected(SelectionEvent e) {
-				editPressed();
-			} });
-		remove.addSelectionListener(new SelectionListener() {
-			public void widgetDefaultSelected(SelectionEvent e) {
-			}
-			public void widgetSelected(SelectionEvent e) {
-				removePressed();
-			} });
-
-		moveUp.addSelectionListener(new SelectionListener() {
-			public void widgetDefaultSelected(SelectionEvent e) {
-			}
-			public void widgetSelected(SelectionEvent e) {
-				Object sel = getSelection();
-				List<IVariableProvider> sorted = cProvider.getSortedDelegates();
-				int current = sorted.indexOf(sel);
-				if( current > 0 ) {
-					newWeights.put(sorted.get(current-1), new Integer(current));
-					newWeights.put(sorted.get(current), new Integer(current-1));
-				}
-				refreshAll();
-			} });
-
-		moveDown.addSelectionListener(new SelectionListener() {
-			public void widgetDefaultSelected(SelectionEvent e) {
-			}
-			public void widgetSelected(SelectionEvent e) {
-				Object sel = getSelection();
-				List<IVariableProvider> sorted = cProvider.getSortedDelegates();
-				int current = sorted.indexOf(sel);
-				if( current < sorted.size()-1 ) {
-					newWeights.put(sorted.get(current+1), new Integer(current));
-					newWeights.put(sorted.get(current), new Integer(current+1));
-				}
-				refreshAll();
-			} });
-
-		
-		enable.addSelectionListener(new SelectionListener() {
-			public void widgetDefaultSelected(SelectionEvent e) {
-			}
-			public void widgetSelected(SelectionEvent e) {
-				Object sel = getSelection();
-				if( sel instanceof IVariableProvider )
-					newEnablement.put((IVariableProvider)sel, new Boolean(true));
-				refreshAll();
-			} });
-		disable.addSelectionListener(new SelectionListener() {
-			public void widgetDefaultSelected(SelectionEvent e) {
-			}
-			public void widgetSelected(SelectionEvent e) {
-				Object sel = getSelection();
-				if( sel instanceof IVariableProvider )
-					newEnablement.put((IVariableProvider)sel, new Boolean(false));
-				refreshAll();
-			} });
-		
-	}
-	protected void addPressed() {
-		ArchivesVariableDialog dialog= new ArchivesVariableDialog(getShell()); 
-		if (dialog.open() == Window.OK) {
-			String name= dialog.getName();
-			String value = dialog.getValue();
-			WorkspaceVariableManager mgr = ((WorkspaceVFS)ArchivesCore.getInstance().getVFS()).getVariableManager();
-			mgr.setValue(name, value);
-		}
-		refreshAll();
-	}
-	protected void editPressed() {
-		Object sel = getSelection();
-		if( sel instanceof Wrapped && ((Wrapped)sel).getProvider().getId().equals(DefaultVariableProvider.ID)) {
-			String name = ((Wrapped)sel).getName();
-			String value = ((WorkspaceVFS)ArchivesCore.getInstance().getVFS()).getVariableManager().getVariableValue(name);
-			ArchivesVariableDialog dialog= new ArchivesVariableDialog(getShell(), name, value); 
-			if (dialog.open() == Window.OK) {
-				name= dialog.getName();
-				value = dialog.getValue();
-				WorkspaceVariableManager mgr = ((WorkspaceVFS)ArchivesCore.getInstance().getVFS()).getVariableManager();
-				mgr.setValue(name, value);
-			}
-		}
-		refreshAll();
-	}
-	protected void removePressed() {
-		Object sel = getSelection();
-		if( sel instanceof Wrapped && ((Wrapped)sel).getProvider().getId().equals(DefaultVariableProvider.ID)) {
-			String name = ((Wrapped)sel).getName();
-			((WorkspaceVFS)ArchivesCore.getInstance().getVFS()).getVariableManager().setValue(name, null);
-		}
-			
-		refreshAll();
-	}
-
-	protected void refreshAll() {
-		variablesViewer.refresh();
-		viewerSelectionChanged();
-	}
-	
-	protected FormData createButtonLayoutData(Control top) {
-		FormData fd = new FormData();
-		if( top != null )
-			fd.top = new FormAttachment(top, 5);
-		else 
-			fd.top = new FormAttachment(0,5);
-		fd.left = new FormAttachment(variablesViewer.getTree(), 5);
-		fd.right = new FormAttachment(100,-5);
-		return fd;
-	}
-
-	public static class Wrapped {
-		protected IVariableProvider p;
-		protected String name;
-		public Wrapped(IVariableProvider p, String name) {
-			this.p = p;
-			this.name = name;
-		}
-		public IVariableProvider getProvider() { return p; }
-		public String getName() { return name; }
-		public String toString() {
-			return name + ": " + p.getVariableValue(name);
-		}
-	}
-
-	protected boolean nowEnabled(IVariableProvider o) {
-		boolean enabled = o.getEnabled();
-		if( newEnablement.get(o) != null)
-			enabled = newEnablement.get(o).booleanValue();
-		return enabled;
-	}
-	protected int nowWeight(IVariableProvider o) {
-		int weight = o.getWeight();
-		if( newWeights.get(o) != null )
-			weight = newWeights.get(o).intValue();
-		return weight;
-	}
-	
-	protected Object getSelection() {
-		IStructuredSelection sel = (IStructuredSelection)variablesViewer.getSelection();
-		return sel.getFirstElement();
-	}
-	
-	protected void viewerSelectionChanged() {
-		Object selected = getSelection();
-		List<IVariableProvider> dels = cProvider.getSortedDelegates();
-		boolean variableProvider = selected != null && selected instanceof IVariableProvider;
-		boolean defaultProvider = selected != null && 
-			(variableProvider ? (IVariableProvider)selected : ((Wrapped)selected).getProvider())
-				.getId().equals(WorkspaceVariableManager.DEFAULT_PROVIDER);
-		boolean removable = !variableProvider && defaultProvider;
-		boolean notLast = dels.indexOf(selected) != dels.size()-1;
-		boolean notFirst = dels.indexOf(selected) != 0;
-		boolean canMoveDown = variableProvider && notLast 
-			&& nowEnabled(dels.get(dels.indexOf(selected)+1)) == nowEnabled((IVariableProvider)selected);
-		boolean canMoveUp = variableProvider && notFirst 
-			&& nowEnabled(dels.get(dels.indexOf(selected)-1)) == nowEnabled((IVariableProvider)selected);
-		
-		add.setEnabled(defaultProvider || selected == null);
-		edit.setEnabled(removable);
-		remove.setEnabled(removable);
-		moveUp.setEnabled(variableProvider && canMoveUp);
-		moveDown.setEnabled(variableProvider && canMoveDown);
-		enable.setEnabled(variableProvider && !nowEnabled((IVariableProvider)selected));
-		disable.setEnabled(variableProvider && nowEnabled((IVariableProvider)selected));
-	}
-	
-	public void init(IWorkbench workbench) {
-	}
-
-	public void performDefaults() {
-		List<IVariableProvider> dels = cProvider.getSortedDelegates();
-		IVariableProvider provider;
-		for( int i = 0; i < dels.size(); i++ ) {
-			provider = dels.get(i);
-			newEnablement.put(provider, new Boolean(true));
-			newWeights.put(provider, new Integer(provider.getDefaultWeight()));
-		}
-		refreshAll();
-	}
-
-	public boolean performOk() {
-		List<IVariableProvider> dels = cProvider.getSortedDelegates();
-		IVariableProvider provider;
-		for( int i = 0; i < dels.size(); i++ ) {
-			provider = dels.get(i);
-			if( newEnablement.get(provider) != null )
-				provider.setEnabled(newEnablement.get(provider).booleanValue());
-			if( newWeights.get(provider) != null )
-				provider.setWeight(newWeights.get(provider).intValue());
-		}
-		return true;
-	}
-}

Deleted: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/VariablesContentProvider.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/VariablesContentProvider.java	2008-07-16 21:30:02 UTC (rev 9157)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/VariablesContentProvider.java	2008-07-17 00:10:42 UTC (rev 9158)
@@ -1,61 +0,0 @@
-package org.jboss.ide.eclipse.archives.ui.providers;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.jboss.ide.eclipse.archives.core.ArchivesCore;
-import org.jboss.ide.eclipse.archives.core.model.IVariableProvider;
-import org.jboss.ide.eclipse.archives.core.model.other.internal.WorkspaceVFS;
-import org.jboss.ide.eclipse.archives.core.model.other.internal.WorkspaceVariableManager;
-import org.jboss.ide.eclipse.archives.ui.preferences.VariablesPreferencePage.Wrapped;
-
-public class VariablesContentProvider implements ITreeContentProvider {
-	private Comparator<IVariableProvider> comparator;
-	public VariablesContentProvider(Comparator<IVariableProvider> c) {
-		this.comparator = c;
-	}
-	public Object[] getChildren(Object parentElement) {
-		if( parentElement instanceof IVariableProvider ) {
-			String[] props = ((IVariableProvider)parentElement).getVariableNames();
-			Wrapped[] items = new Wrapped[props.length];
-			for( int i = 0; i < props.length; i++ ) 
-				items[i] = new Wrapped((IVariableProvider)parentElement, props[i]);
-			return items;
-		}
-		return null;
-	}
-
-	public Object getParent(Object element) {
-		return null;
-	}
-
-	public boolean hasChildren(Object element) {
-		return element instanceof IVariableProvider && ((IVariableProvider)element).getVariableNames().length > 0;
-	}
-
-	public Object[] getElements(Object inputElement) {
-		List<IVariableProvider> elements = getSortedDelegates();
-		return (IVariableProvider[]) elements
-				.toArray(new IVariableProvider[elements.size()]);
-	}
-
-	public void dispose() {
-	}
-
-	public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
-	}
-	public List<IVariableProvider> getSortedDelegates() {
-		WorkspaceVFS vfs = (WorkspaceVFS)ArchivesCore.getInstance().getVFS();
-		WorkspaceVariableManager mgr = vfs.getVariableManager();
-		IVariableProvider[] delegates = mgr.getDelegates();
-		
-		// sort with changed data
-		List<IVariableProvider> l = Arrays.asList(delegates);
-		Collections.sort(l, this.comparator);
-		return l;
-	}
-}

Deleted: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/VariablesLabelProvider.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/VariablesLabelProvider.java	2008-07-16 21:30:02 UTC (rev 9157)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/VariablesLabelProvider.java	2008-07-17 00:10:42 UTC (rev 9158)
@@ -1,69 +0,0 @@
-package org.jboss.ide.eclipse.archives.ui.providers;
-
-import java.util.HashMap;
-import java.util.Iterator;
-
-import org.eclipse.jdt.internal.ui.JavaPlugin;
-import org.eclipse.jdt.internal.ui.JavaPluginImages;
-import org.eclipse.jface.viewers.BaseLabelProvider;
-import org.eclipse.jface.viewers.DecorationOverlayIcon;
-import org.eclipse.jface.viewers.IDecoration;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
-import org.jboss.ide.eclipse.archives.core.model.IVariableProvider;
-import org.jboss.ide.eclipse.archives.ui.preferences.VariablesPreferencePage.Wrapped;
-
-public class VariablesLabelProvider extends BaseLabelProvider implements ILabelProvider {
-	private HashMap<Image, Image> disabledImages;
-	private IVariableEnablementChecker checker;
-	
-	public interface IVariableEnablementChecker {
-		public boolean isEnabled(IVariableProvider element);
-	}
-	
-	public VariablesLabelProvider(IVariableEnablementChecker checker) {
-		disabledImages = new HashMap<Image, Image>();
-	}
-	public Image getImage(Object element) {
-		if( element instanceof IVariableProvider ) {
-			String id = ((IVariableProvider)element).getId();
-			
-			boolean enabled = checker != null ? checker.isEnabled((IVariableProvider)element) : ((IVariableProvider)element).getEnabled();
-			if(id.equals("org.jboss.ide.eclipse.archives.core.resourceVariableProvider"))
-				return getImage2(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER), enabled);
-			if( id.equals("org.jboss.ide.eclipse.archives.core.classpathVariableProvider"))
-				return getImage2(JavaPlugin.getDefault().getImageRegistry().get(JavaPluginImages.IMG_OBJS_EXTJAR), enabled);
-			if( id.equals("org.jboss.ide.eclipse.archives.core.stringReplacementValueVariables"))
-				return getImage2(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_TOOL_PASTE), enabled);
-		}
-		if( element instanceof Wrapped ) {
-			return getImage(((Wrapped)element).getProvider());
-		}
-		return null;
-	}
-	protected Image getImage2(Image original, boolean enabled) {
-		if( enabled ) 
-			return original;
-		if( disabledImages.get(original) == null ) {
-			Image i2 = new DecorationOverlayIcon(original, JavaPluginImages.DESC_OVR_DEPRECATED, IDecoration.TOP_LEFT).createImage();
-			disabledImages.put(original, i2);
-		}
-		return disabledImages.get(original);
-	}
-	public String getText(Object element) {
-		if( element instanceof IVariableProvider ) {
-			return ((IVariableProvider)element).getName();
-		}
-		if( element instanceof Wrapped )
-			return ((Wrapped)element).toString();
-		return "";
-	}
-    public void dispose() {
-    	super.dispose();
-    	Iterator<Image> i = disabledImages.values().iterator();
-    	while(i.hasNext()) 
-    		i.next().dispose();
-    }
-}

Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/composites/ArchiveFilesetDestinationComposite.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/composites/ArchiveFilesetDestinationComposite.java	                        (rev 0)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/composites/ArchiveFilesetDestinationComposite.java	2008-07-17 00:10:42 UTC (rev 9158)
@@ -0,0 +1,165 @@
+package org.jboss.ide.eclipse.archives.ui.util.composites;
+
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.ISelectionStatusValidator;
+import org.eclipse.ui.ide.IDE;
+import org.jboss.ide.eclipse.archives.core.ArchivesCorePlugin;
+import org.jboss.ide.eclipse.archives.core.model.IArchive;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveFolder;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
+import org.jboss.ide.eclipse.archives.ui.ArchivesSharedImages;
+import org.jboss.ide.eclipse.archives.ui.ArchivesUIMessages;
+
+public class ArchiveFilesetDestinationComposite extends Composite {
+
+	protected Composite parent;
+	protected Label destinationImage;
+	protected Text destinationText;
+	protected Object nodeDestination;
+	
+	public ArchiveFilesetDestinationComposite(Composite parent, int style, Object destination) {
+		super(parent, style);
+		this.parent = parent;
+		this.nodeDestination = destination;
+		
+		createComposite();
+	}
+	
+	protected void createComposite() {
+		setLayout(new FormLayout());
+		
+		// create widgets
+		destinationImage = new Label(this, SWT.NONE);
+		destinationText = new Text(this, SWT.BORDER);
+		Composite browseComposite = new Composite(this, SWT.NONE);
+		
+		// set up their layout positioning
+		destinationImage.setLayoutData(createFormData(0,5,null, 0, 0, 0, null, 0));
+		destinationText.setLayoutData(createFormData(0, 5, null, 0, destinationImage, 5, destinationImage, 205));
+	
+		
+		// set text, add listeners, etc
+		destinationText.setEditable(false);
+
+		browseComposite.setLayout(new FillLayout());
+		browseComposite.setLayoutData(createFormData(0,0,null,0,destinationText,5,100,-5)); 
+		fillBrowseComposite(browseComposite);
+		
+		// call other functions required for startup
+		updateDestinationViewer();
+	}
+	
+	private FormData createFormData(Object topStart, int topOffset, Object bottomStart, int bottomOffset, 
+									Object leftStart, int leftOffset, Object rightStart, int rightOffset) {
+		FormData data = new FormData();
+
+		if( topStart != null ) {
+			data.top = topStart instanceof Control ? new FormAttachment((Control)topStart, topOffset) : 
+				new FormAttachment(((Integer)topStart).intValue(), topOffset);
+		}
+
+		if( bottomStart != null ) {
+			data.bottom = bottomStart instanceof Control ? new FormAttachment((Control)bottomStart, bottomOffset) : 
+				new FormAttachment(((Integer)bottomStart).intValue(), bottomOffset);
+		}
+		
+		if( leftStart != null ) {
+			data.left = leftStart instanceof Control ? new FormAttachment((Control)leftStart, leftOffset) : 
+				new FormAttachment(((Integer)leftStart).intValue(), leftOffset);
+		}
+		
+		if( rightStart != null ) {
+			data.right = rightStart instanceof Control ? new FormAttachment((Control)rightStart, rightOffset) : 
+				new FormAttachment(((Integer)rightStart).intValue(), rightOffset);
+		}
+		
+		return data;
+	}
+
+	public void setPackageNodeDestination (Object destination) {
+		nodeDestination = destination;
+		updateDestinationViewer();
+		//fireDestinationChanged();
+	}
+	
+	protected void updateDestinationViewer () {
+		if (nodeDestination == null) return;
+		destinationText.setText("");
+		
+		if (nodeDestination instanceof IArchive) {
+			IArchive pkg = (IArchive) nodeDestination;
+			String txt = pkg.isTopLevel() ? pkg.getName() : pkg.getRootArchiveRelativePath().toOSString();
+			String imgKey = pkg.isExploded() ? ArchivesSharedImages.IMG_PACKAGE_EXPLODED : ArchivesSharedImages.IMG_PACKAGE;
+
+			destinationText.setText(txt);
+			destinationImage.setImage(ArchivesSharedImages.getImage(imgKey));
+		} else if (nodeDestination instanceof IArchiveFolder) {
+			IArchiveFolder folder = (IArchiveFolder) nodeDestination;
+			destinationText.setText(folder.getRootArchiveRelativePath().toString());
+			destinationImage.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER));
+		} else if (nodeDestination instanceof IProject) {
+			IProject project = (IProject) nodeDestination;
+			destinationText.setText(project.getName());
+			destinationImage.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(IDE.SharedImages.IMG_OBJ_PROJECT));
+		} else if (nodeDestination instanceof IFolder) {
+			IFolder folder = (IFolder) nodeDestination;
+			destinationText.setText("/" + folder.getProject().getName() + "/" + folder.getProjectRelativePath().toString());
+			destinationImage.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER));
+		}
+	}
+	
+	public Object getPackageNodeDestination () {
+		return nodeDestination;
+	}
+
+	protected void fillBrowseComposite(Composite parent) {
+		Composite browseComposite = new Composite(parent, SWT.NONE);
+		browseComposite.setLayout(new GridLayout(2, false));
+		
+		Button filesystemBrowseButton = new Button(browseComposite, SWT.PUSH);
+		filesystemBrowseButton.setText(ArchivesUIMessages.PackageDestinationComposite_workspaceBrowseButton_label);
+		filesystemBrowseButton.addSelectionListener(new SelectionAdapter () {
+			public void widgetSelected(SelectionEvent e) {
+				openDestinationDialog();
+			}
+		});
+	}
+	
+	protected void openDestinationDialog() {
+		ArchiveNodeDestinationDialog dialog = new ArchiveNodeDestinationDialog(getShell(), false, true);
+		dialog.setValidator(new ISelectionStatusValidator() {
+			public IStatus validate(Object[] selection) {
+				if( selection != null && selection.length == 1 ) {
+					if( selection[0] instanceof IArchiveNode && !(selection[0] instanceof IArchiveFileSet) )
+						return Status.OK_STATUS;
+				}
+				return new Status(IStatus.ERROR, ArchivesCorePlugin.PLUGIN_ID, "Selection not valid");
+			}
+		});
+		if (nodeDestination != null)
+			dialog.setInitialSelection(nodeDestination);
+		
+		if (dialog.open() == Dialog.OK) 
+			setPackageNodeDestination(dialog.getResult()[0]);
+	}
+}

Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/composites/ArchiveSourceDestinationComposite.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/composites/ArchiveSourceDestinationComposite.java	2008-07-16 21:30:02 UTC (rev 9157)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/composites/ArchiveSourceDestinationComposite.java	2008-07-17 00:10:42 UTC (rev 9158)
@@ -9,6 +9,8 @@
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.core.runtime.Status;
+import org.eclipse.core.variables.IStringVariable;
+import org.eclipse.debug.ui.StringVariableSelectionDialog;
 import org.eclipse.jface.dialogs.Dialog;
 import org.eclipse.jface.window.Window;
 import org.eclipse.swt.SWT;
@@ -36,7 +38,6 @@
 import org.jboss.ide.eclipse.archives.core.model.INamedContainerArchiveNode;
 import org.jboss.ide.eclipse.archives.ui.ArchivesSharedImages;
 import org.jboss.ide.eclipse.archives.ui.PackagesUIPlugin;
-import org.jboss.ide.eclipse.archives.ui.dialogs.SelectVariableDialog;
 
 public class ArchiveSourceDestinationComposite extends Composite {
 	private Text text;
@@ -140,14 +141,14 @@
 	protected void wsRadioButtonPressed() {radioPressed(wsRadioButton);}
 	
 	protected void variablesPressed() {
-		SelectVariableDialog d = new SelectVariableDialog(Display.getDefault().getActiveShell());
-		if( d.open() == Window.OK) {
-			String val = d.getSelectedVarName();
-			if( val != null ) {
-				path = path + "${" + val + "}";
+		StringVariableSelectionDialog d = new StringVariableSelectionDialog(Display.getDefault().getActiveShell());
+		if(d.open() == Window.OK) {
+			Object o = d.getFirstResult();
+			if( o != null && o instanceof IStringVariable) {
 				destinationNode = null;
+				path = path + "${" + ((IStringVariable)o).getName() + "}";
+				validateAndUpdateWidgets();;
 			}
-			validateAndUpdateWidgets();
 		}
 	}
 	
@@ -161,7 +162,11 @@
 				workspaceRelative = true;
 			} else if( result instanceof IContainer ) {
 				destinationNode = null;
-				path = ((IContainer)result).getFullPath().toString();
+				IPath tmpPath = ((IContainer)result).getFullPath();
+				if( tmpPath.segment(0).equals(projectName))
+					path = tmpPath.removeFirstSegments(1).makeRelative().toString();
+				else
+					path = ((IContainer)result).getFullPath().makeAbsolute().toString();
 				workspaceRelative = true;
 			}
 			validateAndUpdateWidgets();
@@ -260,7 +265,10 @@
 			String postSub = ArchivesCore.getInstance().getVFS().
 								performStringSubstitution(path, projectName, true);
 			if( workspaceRelative ) { 
-				IPath p = ArchivesCore.getInstance().getVFS().workspacePathToAbsolutePath(new Path(postSub));
+				IPath p2 = new Path(postSub);
+				if( !p2.isAbsolute())
+					p2 = new Path(projectName).append(p2).makeAbsolute();
+				IPath p = ArchivesCore.getInstance().getVFS().workspacePathToAbsolutePath(p2);
 				if( p != null ) return p.toString();
 				String ERROR ="Unable to convert workspace path into global path: " + postSub; 
 				Status s = new Status(IStatus.WARNING, PackagesUIPlugin.PLUGIN_ID, ERROR);

Deleted: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/garbage/ArchiveDestinationComposite.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/garbage/ArchiveDestinationComposite.java	2008-07-16 21:30:02 UTC (rev 9157)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/garbage/ArchiveDestinationComposite.java	2008-07-17 00:10:42 UTC (rev 9158)
@@ -1,82 +0,0 @@
-package org.jboss.ide.eclipse.archives.ui.util.garbage;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.DirectoryDialog;
-import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
-import org.jboss.ide.eclipse.archives.ui.ArchivesSharedImages;
-import org.jboss.ide.eclipse.archives.ui.ArchivesUIMessages;
-import org.jboss.ide.eclipse.archives.ui.util.composites.ArchiveNodeDestinationDialog;
-
-public class ArchiveDestinationComposite extends ArchiveNodeDestinationComposite {
-
-	protected boolean inWorkspace;
-	protected Button filesystemBrowseButton, workspaceBrowseButton;
-	
-	public ArchiveDestinationComposite (Composite parent, int style, Object destination) {
-		super(parent, style, destination);
-	}
-	
-	protected void fillBrowseComposite(Composite parent) {
-		Composite browseComposite = new Composite(parent, SWT.NONE);
-		browseComposite.setLayout(new GridLayout(2, false));
-		
-		workspaceBrowseButton = new Button(browseComposite, SWT.PUSH);
-		workspaceBrowseButton.setText(ArchivesUIMessages.PackageDestinationComposite_workspaceBrowseButton_label);
-		workspaceBrowseButton.addSelectionListener(new SelectionAdapter () {
-			public void widgetSelected(SelectionEvent e) {
-				openDestinationDialog();
-			}
-		});
-		
-		filesystemBrowseButton = new Button(browseComposite, SWT.PUSH);
-		filesystemBrowseButton.setText(ArchivesUIMessages.PackageDestinationComposite_filesystemBrowseButton_label);
-		filesystemBrowseButton.addSelectionListener(new SelectionAdapter () {
-			public void widgetSelected(SelectionEvent e) {
-				browseFilesystem();
-			}
-		});
-	}
-	
-	protected void openDestinationDialog() {
-		ArchiveNodeDestinationDialog dialog = new ArchiveNodeDestinationDialog(getShell(), true, true);
-		if (nodeDestination != null)
-			dialog.setInitialSelection(nodeDestination);
-		
-		if (dialog.open() == Dialog.OK) 
-			setPackageNodeDestination(dialog.getResult()[0]);
-	}
-	
-	protected void browseFilesystem () {
-		DirectoryDialog dialog = new DirectoryDialog(getShell());
-		String currentPath = destinationText.getText();
-		if (currentPath != null && currentPath.length() > 0 && !inWorkspace) {
-			dialog.setFilterPath(destinationText.getText());
-		}
-		
-		String path = dialog.open();
-		if (path != null) 
-			setPackageNodeDestination(new Path(path));
-	}
-	
-	protected void updateDestinationViewer() {
-		super.updateDestinationViewer();
-
-		if (nodeDestination instanceof IPath) {
-			inWorkspace = false;
-			IPath path = (IPath) nodeDestination;
-			destinationText.setText(path.toString());
-			destinationImage.setImage(ArchivesSharedImages.getImage(ArchivesSharedImages.IMG_EXTERNAL_FILE));
-		} else if (nodeDestination instanceof IContainer || nodeDestination instanceof IArchiveNode) {
-			inWorkspace = true;
-		}
-	}
-}

Deleted: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/garbage/ArchiveFilesetDestinationComposite.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/garbage/ArchiveFilesetDestinationComposite.java	2008-07-16 21:30:02 UTC (rev 9157)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/garbage/ArchiveFilesetDestinationComposite.java	2008-07-17 00:10:42 UTC (rev 9158)
@@ -1,56 +0,0 @@
-package org.jboss.ide.eclipse.archives.ui.util.garbage;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.dialogs.ISelectionStatusValidator;
-import org.jboss.ide.eclipse.archives.core.ArchivesCorePlugin;
-import org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet;
-import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
-import org.jboss.ide.eclipse.archives.ui.ArchivesUIMessages;
-import org.jboss.ide.eclipse.archives.ui.util.composites.ArchiveNodeDestinationDialog;
-
-public class ArchiveFilesetDestinationComposite extends ArchiveNodeDestinationComposite {
-	protected Button filesystemBrowseButton;
-	public ArchiveFilesetDestinationComposite(Composite parent, int style,
-			Object destination) {
-		super(parent, style, destination);
-	}
-
-	protected void fillBrowseComposite(Composite parent) {
-		Composite browseComposite = new Composite(parent, SWT.NONE);
-		browseComposite.setLayout(new GridLayout(2, false));
-		
-		filesystemBrowseButton = new Button(browseComposite, SWT.PUSH);
-		filesystemBrowseButton.setText(ArchivesUIMessages.PackageDestinationComposite_workspaceBrowseButton_label);
-		filesystemBrowseButton.addSelectionListener(new SelectionAdapter () {
-			public void widgetSelected(SelectionEvent e) {
-				openDestinationDialog();
-			}
-		});
-	}
-	
-	protected void openDestinationDialog() {
-		ArchiveNodeDestinationDialog dialog = new ArchiveNodeDestinationDialog(getShell(), false, true);
-		dialog.setValidator(new ISelectionStatusValidator() {
-			public IStatus validate(Object[] selection) {
-				if( selection != null && selection.length == 1 ) {
-					if( selection[0] instanceof IArchiveNode && !(selection[0] instanceof IArchiveFileSet) )
-						return Status.OK_STATUS;
-				}
-				return new Status(IStatus.ERROR, ArchivesCorePlugin.PLUGIN_ID, "Selection not valid");
-			}
-		});
-		if (nodeDestination != null)
-			dialog.setInitialSelection(nodeDestination);
-		
-		if (dialog.open() == Dialog.OK) 
-			setPackageNodeDestination(dialog.getResult()[0]);
-	}
-}

Deleted: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/garbage/ArchiveNodeDestinationComposite.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/garbage/ArchiveNodeDestinationComposite.java	2008-07-16 21:30:02 UTC (rev 9157)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/garbage/ArchiveNodeDestinationComposite.java	2008-07-17 00:10:42 UTC (rev 9158)
@@ -1,151 +0,0 @@
-package org.jboss.ide.eclipse.archives.ui.util.garbage;
-
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.ide.IDE;
-import org.jboss.ide.eclipse.archives.core.model.IArchive;
-import org.jboss.ide.eclipse.archives.core.model.IArchiveFolder;
-import org.jboss.ide.eclipse.archives.ui.ArchivesSharedImages;
-
-public abstract class ArchiveNodeDestinationComposite extends Composite {
-
-	protected Composite parent;
-	protected Label destinationImage;
-	protected Text destinationText;
-	protected Object nodeDestination;
-	//protected ArrayList<DestinationChangeListener> listeners;
-	
-	public ArchiveNodeDestinationComposite(Composite parent, int style, Object destination) {
-		super(parent, style);
-		this.parent = parent;
-		this.nodeDestination = destination;
-		//this.listeners = new ArrayList<DestinationChangeListener>();
-		
-		createComposite();
-	}
-	
-	protected void createComposite() {
-		setLayout(new FormLayout());
-		
-		// create widgets
-		destinationImage = new Label(this, SWT.NONE);
-		destinationText = new Text(this, SWT.BORDER);
-		Composite browseComposite = new Composite(this, SWT.NONE);
-		
-		// set up their layout positioning
-		destinationImage.setLayoutData(createFormData(0,5,null, 0, 0, 0, null, 0));
-		destinationText.setLayoutData(createFormData(0, 5, null, 0, destinationImage, 5, destinationImage, 205));
-	
-		
-		// set text, add listeners, etc
-		destinationText.setEditable(false);
-
-		browseComposite.setLayout(new FillLayout());
-		browseComposite.setLayoutData(createFormData(0,0,null,0,destinationText,5,100,-5)); 
-		fillBrowseComposite(browseComposite);
-		
-		// call other functions required for startup
-		updateDestinationViewer();
-	}
-	
-	protected abstract void fillBrowseComposite(Composite browseComposite);
-	
-	private FormData createFormData(Object topStart, int topOffset, Object bottomStart, int bottomOffset, 
-									Object leftStart, int leftOffset, Object rightStart, int rightOffset) {
-		FormData data = new FormData();
-
-		if( topStart != null ) {
-			data.top = topStart instanceof Control ? new FormAttachment((Control)topStart, topOffset) : 
-				new FormAttachment(((Integer)topStart).intValue(), topOffset);
-		}
-
-		if( bottomStart != null ) {
-			data.bottom = bottomStart instanceof Control ? new FormAttachment((Control)bottomStart, bottomOffset) : 
-				new FormAttachment(((Integer)bottomStart).intValue(), bottomOffset);
-		}
-		
-		if( leftStart != null ) {
-			data.left = leftStart instanceof Control ? new FormAttachment((Control)leftStart, leftOffset) : 
-				new FormAttachment(((Integer)leftStart).intValue(), leftOffset);
-		}
-		
-		if( rightStart != null ) {
-			data.right = rightStart instanceof Control ? new FormAttachment((Control)rightStart, rightOffset) : 
-				new FormAttachment(((Integer)rightStart).intValue(), rightOffset);
-		}
-		
-		return data;
-	}
-
-	public void setPackageNodeDestination (Object destination) {
-		nodeDestination = destination;
-		updateDestinationViewer();
-		//fireDestinationChanged();
-	}
-	
-	protected void updateDestinationViewer () {
-		if (nodeDestination == null) return;
-		destinationText.setText("");
-		
-		if (nodeDestination instanceof IArchive) {
-			IArchive pkg = (IArchive) nodeDestination;
-			String txt = pkg.isTopLevel() ? pkg.getName() : pkg.getRootArchiveRelativePath().toOSString();
-			String imgKey = pkg.isExploded() ? ArchivesSharedImages.IMG_PACKAGE_EXPLODED : ArchivesSharedImages.IMG_PACKAGE;
-
-			destinationText.setText(txt);
-			destinationImage.setImage(ArchivesSharedImages.getImage(imgKey));
-		} else if (nodeDestination instanceof IArchiveFolder) {
-			IArchiveFolder folder = (IArchiveFolder) nodeDestination;
-			destinationText.setText(folder.getRootArchiveRelativePath().toString());
-			destinationImage.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER));
-		} else if (nodeDestination instanceof IProject) {
-			IProject project = (IProject) nodeDestination;
-			destinationText.setText(project.getName());
-			destinationImage.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(IDE.SharedImages.IMG_OBJ_PROJECT));
-		} else if (nodeDestination instanceof IFolder) {
-			IFolder folder = (IFolder) nodeDestination;
-			destinationText.setText("/" + folder.getProject().getName() + "/" + folder.getProjectRelativePath().toString());
-			destinationImage.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER));
-		}
-	}
-	
-	
-	/**
-	 * The current destination
-	 * @return
-	 */
-	
-	public Object getPackageNodeDestination () {
-		return nodeDestination;
-	}
-	
-	
-	/*
-	 * Destination change listeners
-	 */
-//	
-//	public void addDestinationChangeListener (DestinationChangeListener listener) {
-//		listeners.add(listener);
-//	}
-//	
-//	public void removeDestinationChangeListener (DestinationChangeListener listener) {
-//		listeners.remove(listener);
-//	}
-//	
-//	private void fireDestinationChanged () {
-//		for (Iterator<DestinationChangeListener> iter = listeners.iterator(); iter.hasNext(); ) {
-//			((DestinationChangeListener) iter.next()).destinationChanged(nodeDestination);
-//		}
-//	}
-}

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-16 21:30:02 UTC (rev 9157)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/FilesetWizard.java	2008-07-17 00:10:42 UTC (rev 9158)
@@ -1,9 +1,19 @@
 package org.jboss.ide.eclipse.archives.ui.wizards;
 
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.operation.IRunnableWithProgress;
 import org.eclipse.jface.wizard.Wizard;
 import org.jboss.ide.eclipse.archives.core.model.ArchiveNodeFactory;
+import org.jboss.ide.eclipse.archives.core.model.ArchivesModel;
+import org.jboss.ide.eclipse.archives.core.model.ArchivesModelException;
 import org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet;
 import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
+import org.jboss.ide.eclipse.archives.ui.PackagesUIPlugin;
 import org.jboss.ide.eclipse.archives.ui.wizards.pages.FilesetInfoWizardPage;
 
 public class FilesetWizard extends Wizard {
@@ -24,39 +34,33 @@
 		
 		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.isFlattened());
+		fileset.setRawSourcePath(page1.getRawPath());
+		fileset.setInWorkspace(page1.isRootDirWorkspaceRelative());
+	}
 
 	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-16 21:30:02 UTC (rev 9157)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/FilesetInfoWizardPage.java	2008-07-17 00:10:42 UTC (rev 9158)
@@ -18,6 +18,7 @@
 import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Group;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Shell;
@@ -26,14 +27,12 @@
 import org.jboss.ide.eclipse.archives.core.model.DirectoryScannerFactory;
 import org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet;
 import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
-import org.jboss.ide.eclipse.archives.core.model.IVariableManager;
 import org.jboss.ide.eclipse.archives.core.model.DirectoryScannerFactory.DirectoryScannerExtension;
 import org.jboss.ide.eclipse.archives.ui.ArchivesSharedImages;
 import org.jboss.ide.eclipse.archives.ui.ArchivesUIMessages;
+import org.jboss.ide.eclipse.archives.ui.util.composites.ArchiveFilesetDestinationComposite;
 import org.jboss.ide.eclipse.archives.ui.util.composites.ArchiveSourceDestinationComposite;
 import org.jboss.ide.eclipse.archives.ui.util.composites.FilesetPreviewComposite;
-import org.jboss.ide.eclipse.archives.ui.util.garbage.ArchiveFilesetDestinationComposite;
-import org.jboss.ide.eclipse.archives.ui.util.garbage.ArchiveNodeDestinationComposite;
 
 public class FilesetInfoWizardPage extends WizardPage {
 
@@ -55,7 +54,7 @@
 	private Button flattenedNo;
 	private Text includesText;
 	private Text excludesText;
-	private ArchiveNodeDestinationComposite destinationComposite;
+	private ArchiveFilesetDestinationComposite destinationComposite;
 
 	public FilesetInfoWizardPage (Shell parent, IArchiveFileSet fileset, IArchiveNode parentNode) {
 		super(ArchivesUIMessages.FilesetInfoWizardPage_new_title, ArchivesUIMessages.FilesetInfoWizardPage_new_title, null);
@@ -224,6 +223,12 @@
 		};
 		flattenedYes.addSelectionListener(flattenAdapter);
 		flattenedNo.addSelectionListener(flattenAdapter);
+		
+		srcDestComposite.addChangeListener(new ArchiveSourceDestinationComposite.ChangeListener() {
+			public void compositeChanged() {
+				changePreview();
+			} 
+		});
 	}
 	
 	public IArchiveNode getRootNode () {
@@ -280,29 +285,61 @@
 			}
 
 		} else {
-			String rawPath = "${" + IVariableManager.CURRENT_PROJECT + "}";
+			String rawPath = "";
 			srcDestComposite.init(rawPath, true);
 			flattened = false;
 			flattenedYes.setSelection(flattened);
 			flattenedNo.setSelection(!flattened);
+			includes = "**";
+			includesText.setText(includes);
 		}
 
 	}
 	
+	private ChangePreviewRunnable changePreviewRunnable;
 	private void changePreview() {
-		DirectoryScannerExtension ds = DirectoryScannerFactory.createDirectoryScanner( 
-				replaceVariables(), null, includes, excludes, parentNode.getProjectName(), srcDestComposite.isWorkspaceRelative(), true);
-		String[] fsRelative = ds.getIncludedFiles();
-		IPath filesetRelative;
-		ArrayList<IPath> list = new ArrayList<IPath>();
-		for( int i = 0; i < fsRelative.length; i++ ) {
-			if( flattened )
-				filesetRelative = new Path(new Path(fsRelative[i]).lastSegment());
-			else
-				filesetRelative = new Path(fsRelative[i]);
-			if( !list.contains(filesetRelative))
-				list.add(filesetRelative);
+		if( changePreviewRunnable != null )
+			changePreviewRunnable.stop = true;
+		changePreviewRunnable = new ChangePreviewRunnable();
+		Thread t = new Thread(changePreviewRunnable);
+		t.start();
+	}	
+	
+	protected class ChangePreviewRunnable implements Runnable {
+		public boolean stop = false;
+		public void run() {
+			DirectoryScannerExtension ds = null; 
+			Runnable r;
+			try {
+				ds = DirectoryScannerFactory.createDirectoryScanner( 
+						replaceVariables(), null, includes, excludes, parentNode.getProjectName(), srcDestComposite.isWorkspaceRelative(), true);
+				String[] fsRelative = ds.getIncludedFiles();
+				IPath filesetRelative;
+				final ArrayList<IPath> list = new ArrayList<IPath>();
+				for( int i = 0; i < fsRelative.length; i++ ) {
+					if( flattened )
+						filesetRelative = new Path(new Path(fsRelative[i]).lastSegment());
+					else
+						filesetRelative = new Path(fsRelative[i]);
+					if( !list.contains(filesetRelative))
+						list.add(filesetRelative);
+				}
+				r = new Runnable() {
+					public void run() {
+						previewComposite.setInput(list.toArray());
+					}
+				};
+			} catch( Exception e ) {
+				r = new Runnable() {
+					public void run() {
+						previewComposite.setInput(new IPath[0]);
+					}
+				};
+			}
+			
+			if( !stop ) {
+				Display.getDefault().asyncExec(r);
+			}
 		}
-		previewComposite.setInput(list.toArray());
-	}	
+	}
 }




More information about the jbosstools-commits mailing list