[430329] - fixed ETFw passing paired arguments and added psprocess for
perfsuite performance tool

Change-Id: I0b54712daed1a52cd81f61b1612190090bdbb495
Signed-off-by: Chris Navarro <cmnavarr@illinois.edu>
diff --git a/tools/etfw/org.eclipse.ptp.etfw.jaxb/META-INF/MANIFEST.MF b/tools/etfw/org.eclipse.ptp.etfw.jaxb/META-INF/MANIFEST.MF
index 38e1bf0..e809651 100644
--- a/tools/etfw/org.eclipse.ptp.etfw.jaxb/META-INF/MANIFEST.MF
+++ b/tools/etfw/org.eclipse.ptp.etfw.jaxb/META-INF/MANIFEST.MF
@@ -14,7 +14,7 @@
  org.eclipse.core.filesystem
 Bundle-ActivationPolicy: lazy
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Export-Package: org.eclipse.ptp.internal.etfw.jaxb;x-friends:="org.eclipse.ptp.etfw.launch",
+Export-Package: org.eclipse.ptp.internal.etfw.jaxb;x-friends:="org.eclipse.ptp.etfw.launch,org.eclipse.ptp.etfw",
  org.eclipse.ptp.internal.etfw.jaxb.data;x-friends:="org.eclipse.ptp.etfw,org.eclipse.ptp.etfw.launch",
  org.eclipse.ptp.internal.etfw.jaxb.osgi;x-internal:=true,
  org.eclipse.ptp.internal.etfw.jaxb.util;x-friends:="org.eclipse.ptp.etfw,org.eclipse.ptp.etfw.launch"
diff --git a/tools/etfw/org.eclipse.ptp.etfw.jaxb/contrib/perfsuite-tool.xml b/tools/etfw/org.eclipse.ptp.etfw.jaxb/contrib/perfsuite-tool.xml
index 9096ed5..4944807 100644
--- a/tools/etfw/org.eclipse.ptp.etfw.jaxb/contrib/perfsuite-tool.xml
+++ b/tools/etfw/org.eclipse.ptp.etfw.jaxb/contrib/perfsuite-tool.xml
@@ -3,8 +3,6 @@
 	<controlData>
 		<attribute name="PERFSUITE_psrun.configuration_id_-CONFIG" type="boolean" translateBooleanAs="-c, ">
 			<rm:description>Specify configuration file</rm:description>
-			<rm:default>
-			</rm:default>
 		</attribute>
 		<attribute name="PERFSUITE_psrun.configuration_id_-CONFIG_SAVED" type="string">
 			<rm:description>Specified configuration file</rm:description>
@@ -69,8 +67,40 @@
 			</rm:default>
 		</attribute>
 		<attribute name="PERFSUITE_psrun.configuration_id_-OVERFLOW_THRESHOLD_SAVED" type="string">
-			<rm:description>Overflow threshold</rm:description>
+			<rm:description>Specify overflow threshold</rm:description>
 		</attribute>
+		<attribute name="PERFSUITE_psrun.configuration_id_-OUTPUT" type="boolean" translateBooleanAs="-o, ">
+			<rm:description>Use output prefix</rm:description>
+			<rm:default>-o</rm:default>
+		</attribute>
+		<attribute name="PERFSUITE_psrun.configuration_id_-OUTPUT_SAVED" type="string">
+			<rm:description>Output prefix</rm:description>
+			<rm:default>psprocess</rm:default>
+		</attribute>
+		
+		<!-- PSProcess Attributes -->
+		<attribute name="PERFSUITE_psprocess.configuration_id_XMLOUTPUT" type="boolean" translateBooleanAs="-x, ">
+		</attribute>
+		<attribute name="PERFSUITE_psprocess.configuration_id_INPUTFILE" type="string">
+		</attribute>
+		<attribute name="PERFSUITE_psprocess.configuration_id_GLOB" type="boolean" translateBooleanAs="--glob , ">
+			<rm:default>--glob</rm:default>
+		</attribute>
+		<attribute name="PERFSUITE_psprocess.configuration_id_GLOB_SAVED" visible="false">
+		</attribute>
+		<attribute name="psProcessOutputDirectoryCB" type="boolean">
+			<rm:default>true</rm:default>
+		</attribute>
+		<attribute name="org.eclipse.ptp.launch.WORKING_DIR_ATTR">
+		</attribute>
+		<attribute name="PERFSUITE_psprocess.configuration_id_-OUTPUT" type="boolean" translateBooleanAs="-o, ">
+			<rm:description>Specify output file</rm:description>
+			<rm:default>-o</rm:default>
+		</attribute>
+		<attribute name="PERFSUITE_psprocess.configuration_id_-OUTPUT_SAVED" type="string">
+			<rm:description>Output file name</rm:description>
+			<rm:default>mhpr.xml</rm:default>
+		</attribute>	
 	</controlData>
 	<execTool tool-name="PerfSuite">
 		<execUtils tool-command="psrun">
@@ -207,9 +237,100 @@
 								<rm:enable-if button="overflow-threshold-button" selected="true" />
 							</rm:control-state>
 						</rm:widget>
+						<rm:widget type="checkbox" title="Output" buttonId="outputCB" style="SWT.LEFT"
+							attribute="PERFSUITE_psrun.configuration_id_-OUTPUT">
+							<rm:layout-data>
+								<rm:grid-data widthHint="150" horizontalAlign="SWT.FILL" grabExcessHorizontal="false" horizontalSpan="1" />
+							</rm:layout-data>
+							<rm:tooltip>Specify output prefix</rm:tooltip>
+						</rm:widget>
+						<rm:widget type="text" style="SWT.BORDER" attribute="PERFSUITE_psrun.configuration_id_-OUTPUT_SAVED">
+							<rm:layout-data>
+								<rm:grid-data horizontalAlign="SWT.FILL" grabExcessHorizontal="true" horizontalSpan="2" />
+							</rm:layout-data>
+							<rm:tooltip>Output prefix to use</rm:tooltip>
+							<rm:control-state>
+								<rm:enable-if button="outputCB" selected="true" />
+							</rm:control-state>
+						</rm:widget>
 					</rm:composite>
 				</optionPane>
 			</toolPanes>
 		</execUtils>
 	</execTool>
+	<analysisTool>
+		<analysis-commands tool-command="psprocess">
+			<!--   <toolArguments value="-glob mytest*"/> -->
+			<toolPanes virtual="false" embedded="false">
+				<configId>PERFSUITE_psprocess.configuration_id_</configId>
+				<configVarId>PERFSUITE_psprocess.environmentvariables.configuration_id_</configVarId>
+				<optionPane>
+					<rm:title>PSProcess</rm:title>
+					<rm:layout>
+						<rm:grid-layout />
+					</rm:layout>
+					<rm:composite>
+						<rm:layout>
+							<rm:grid-layout numColumns="3" makeColumnsEqualWidth="false" />
+						</rm:layout>
+						<rm:layout-data>
+							<rm:grid-data horizontalAlign="SWT.FILL" verticalAlign="SWT.FILL" grabExcessHorizontal="true" />
+						</rm:layout-data>
+						<rm:widget type="checkbox" title="XML Output" buttonId="xmlOutputCB" style="SWT.LEFT" attribute="PERFSUITE_psprocess.configuration_id_XMLOUTPUT">
+							<rm:layout-data>
+								<rm:grid-data widthHint="150" horizontalAlign="SWT.FILL" grabExcessHorizontal="false" horizontalSpan="3" />
+							</rm:layout-data>
+							<rm:tooltip>Produce xml as output</rm:tooltip>
+						</rm:widget>
+						<rm:widget type="label" style="SWT.LEFT">
+							<rm:layout-data>
+	                     		<rm:grid-data horizontalAlign="SWT.BEGINNING" grabExcessHorizontal="false"/>
+	                  		</rm:layout-data>
+	                  		<rm:tooltip>Specify the directory of the psrun output to post process</rm:tooltip>
+	                  		<rm:fixed-text>Output Directory:</rm:fixed-text>
+						</rm:widget>
+						<rm:browse title="Browse..." localOnly="false" directory="true" textStyle="SWT.BORDER"
+							attribute="org.eclipse.ptp.launch.WORKING_DIR_ATTR">
+							<rm:text-layout-data>
+								<rm:grid-data horizontalSpan="1" horizontalAlign="SWT.FILL" verticalAlign="SWT.FILL" grabExcessHorizontal="true" />
+							</rm:text-layout-data>
+							<rm:button-layout-data>
+								<rm:grid-data horizontalSpan="1" horizontalAlign="SWT.FILL" verticalAlign="SWT.FILL" grabExcessHorizontal="false" />
+							</rm:button-layout-data>
+							<rm:tooltip>Location of the psrun output files</rm:tooltip>
+						</rm:browse>
+						<rm:widget type="label" style="SWT.LEFT">
+							<rm:layout-data>
+	                     		<rm:grid-data horizontalAlign="SWT.BEGINNING" grabExcessHorizontal="false"/>
+	                  		</rm:layout-data>
+	                  		<rm:tooltip>Specify the file output pattern to search on for post processing (e.g. psprocess*)</rm:tooltip>
+	                  		<rm:fixed-text>Output file pattern:</rm:fixed-text>
+						</rm:widget>
+						<rm:widget type="text" style="SWT.BORDER" attribute="PERFSUITE_psprocess.configuration_id_GLOB_SAVED">
+							<rm:layout-data>
+								<rm:grid-data horizontalAlign="SWT.FILL" grabExcessHorizontal="true" horizontalSpan="2" />
+							</rm:layout-data>
+							<rm:tooltip>psrun output prefix to search on for post processing</rm:tooltip>
+						</rm:widget>
+						<rm:widget type="checkbox" title="Output" buttonId="psProcessOutputCB" style="SWT.LEFT"
+							attribute="PERFSUITE_psprocess.configuration_id_-OUTPUT">
+							<rm:layout-data>
+								<rm:grid-data widthHint="150" horizontalAlign="SWT.FILL" grabExcessHorizontal="false" horizontalSpan="1" />
+							</rm:layout-data>
+							<rm:tooltip>Specify output file name</rm:tooltip>
+						</rm:widget>
+						<rm:widget type="text" style="SWT.BORDER" attribute="PERFSUITE_psprocess.configuration_id_-OUTPUT_SAVED">
+							<rm:layout-data>
+								<rm:grid-data horizontalAlign="SWT.FILL" grabExcessHorizontal="true" horizontalSpan="2" />
+							</rm:layout-data>
+							<rm:tooltip>Output file name</rm:tooltip>
+							<rm:control-state>
+								<rm:enable-if button="psProcessOutputCB" selected="true" />
+							</rm:control-state>
+						</rm:widget>
+					</rm:composite>
+				</optionPane>
+			</toolPanes>
+		</analysis-commands>
+	</analysisTool>
 </etfwTool>
\ No newline at end of file
diff --git a/tools/etfw/org.eclipse.ptp.etfw.jaxb/src/org/eclipse/ptp/internal/etfw/jaxb/ETFWCoreConstants.java b/tools/etfw/org.eclipse.ptp.etfw.jaxb/src/org/eclipse/ptp/internal/etfw/jaxb/ETFWCoreConstants.java
index 7f2083b..e387286 100644
--- a/tools/etfw/org.eclipse.ptp.etfw.jaxb/src/org/eclipse/ptp/internal/etfw/jaxb/ETFWCoreConstants.java
+++ b/tools/etfw/org.eclipse.ptp.etfw.jaxb/src/org/eclipse/ptp/internal/etfw/jaxb/ETFWCoreConstants.java
@@ -30,4 +30,6 @@
 	public static final String PAIRED_ATTRIBUTE_SAVED = "_SAVED"; //$NON-NLS-1$
 	public static final String RM_NAME = "org.eclipse.ptp.launch.RESOURCE_MANAGER_NAME"; //$NON-NLS-1$
 	public static final String URL_SP = "%20"; //$NON-NLS-1$
+	public static final String EQ = JAXBCoreConstants.EQ;
+	
 }
diff --git a/tools/etfw/org.eclipse.ptp.etfw.jaxb/src/org/eclipse/ptp/internal/etfw/jaxb/util/ToolAppTypeUtil.java b/tools/etfw/org.eclipse.ptp.etfw.jaxb/src/org/eclipse/ptp/internal/etfw/jaxb/util/ToolAppTypeUtil.java
index 0c483d4..e79b874 100644
--- a/tools/etfw/org.eclipse.ptp.etfw.jaxb/src/org/eclipse/ptp/internal/etfw/jaxb/util/ToolAppTypeUtil.java
+++ b/tools/etfw/org.eclipse.ptp.etfw.jaxb/src/org/eclipse/ptp/internal/etfw/jaxb/util/ToolAppTypeUtil.java
@@ -18,7 +18,6 @@
 import org.eclipse.debug.core.ILaunchConfiguration;
 import org.eclipse.ptp.internal.etfw.jaxb.data.ToolArgumentType;
 import org.eclipse.ptp.internal.etfw.jaxb.data.ToolPaneType;
-import org.eclipse.ptp.internal.rm.jaxb.core.JAXBCoreConstants;
 
 /**
  * Utility methods for getting tool app arguments and environment variables.
@@ -59,32 +58,20 @@
 
 		if (toolPanes != null) {
 			for (ToolPaneType toolPane : toolPanes) {
-				String arg = JAXBCoreConstants.ZEROSTR;
 				if (toolPane.getPrependWith() != null) {
-					arg += toolPane.getPrependWith();
+					input.add(toolPane.getPrependWith());
 				}
 
 				if (toolPane.getEncloseWith() != null) {
-					arg += toolPane.getEncloseWith();
+					input.add(toolPane.getEncloseWith().trim());
 				}
-				String nextArg = ToolPaneTypeUtil.getArgument(configuration, toolPane.getConfigId());
-				if (nextArg != null) {
-					nextArg = nextArg.trim();
-					arg += nextArg;
-					if (toolPane.getEncloseWith() != null) {
-						arg += toolPane.getEncloseWith();
-					}
-
-					if (arg.length() > 0)
-					{
-						int space = arg.indexOf(' ');
-						if (arg.indexOf('-') == 0 && space > 0) {
-							input.add(arg.substring(0, space).trim());
-							arg = arg.substring(space).trim();
-						}
-
-						input.add(arg);
-					}
+				List<String> nextArguments = ToolPaneTypeUtil.getArguments(configuration, toolPane.getConfigId());
+				if(!nextArguments.isEmpty()) {
+					input.addAll(nextArguments);
+				}
+				
+				if (toolPane.getEncloseWith() != null) {
+					input.add(toolPane.getEncloseWith());
 				}
 			}
 		}
diff --git a/tools/etfw/org.eclipse.ptp.etfw.jaxb/src/org/eclipse/ptp/internal/etfw/jaxb/util/ToolPaneTypeUtil.java b/tools/etfw/org.eclipse.ptp.etfw.jaxb/src/org/eclipse/ptp/internal/etfw/jaxb/util/ToolPaneTypeUtil.java
index 8f4e6a2..f0703f0 100644
--- a/tools/etfw/org.eclipse.ptp.etfw.jaxb/src/org/eclipse/ptp/internal/etfw/jaxb/util/ToolPaneTypeUtil.java
+++ b/tools/etfw/org.eclipse.ptp.etfw.jaxb/src/org/eclipse/ptp/internal/etfw/jaxb/util/ToolPaneTypeUtil.java
@@ -9,8 +9,10 @@
  *******************************************************************************/
 package org.eclipse.ptp.internal.etfw.jaxb.util;
 
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 
 import org.eclipse.core.runtime.CoreException;
@@ -27,13 +29,14 @@
  */
 public class ToolPaneTypeUtil {
 
-	public static String getArgument(ILaunchConfiguration configuration, String configID) {
+	public static List<String> getArguments(ILaunchConfiguration configuration, String configID) {
+		List<String> arguments = new ArrayList<String>();
 		try {
 			String controlId = configuration.getAttribute(ETFWCoreConstants.RM_NAME,
 					JAXBCoreConstants.ZEROSTR);
 			String attributeKey = controlId + JAXBCoreConstants.DOT + configID;
-			String args = new String(JAXBCoreConstants.ZEROSTR);
 			Iterator<?> iterator = configuration.getAttributes().keySet().iterator();
+			
 			while (iterator.hasNext()) {
 				String key = iterator.next().toString();
 				if (key.startsWith(attributeKey) && !key.endsWith(ETFWCoreConstants.PAIRED_ATTRIBUTE_SAVED)) {
@@ -45,29 +48,25 @@
 						try {
 							value = Integer.toString(configuration.getAttribute(key, 0));
 						} catch (DebugException e1) {
-							// e1.printStackTrace();
 							// just ignore the value
 						}
 					}
-
+					
 					if (!value.trim().isEmpty()) {
-						if (value.endsWith(JAXBCoreConstants.EQ)) {
-							// Locate paired attribute
-							String pairedKey = key + ETFWCoreConstants.PAIRED_ATTRIBUTE_SAVED;
-							if (configuration.hasAttribute(pairedKey)) {
-								value += configuration.getAttribute(pairedKey, JAXBCoreConstants.ZEROSTR);
-							}
-						}
-						args += value + JAXBCoreConstants.SP;
+						 arguments.add(value);
+						// Locate paired attribute
+						String pairedKey = key + ETFWCoreConstants.PAIRED_ATTRIBUTE_SAVED;
+						if (configuration.hasAttribute(pairedKey)) {
+							arguments.add(configuration.getAttribute(pairedKey, JAXBCoreConstants.ZEROSTR));
+						} 
 					}
 				}
 			}
-			args = args.trim();
-			return args;
+			return arguments;
 		} catch (CoreException e) {
 			e.printStackTrace();
 		}
-		return ""; //$NON-NLS-1$
+		return arguments;
 	}
 
 	public static Map<String, String> getEnvVars(ILaunchConfiguration configuration, String configVarID) {
@@ -84,36 +83,36 @@
 			while (iterator.hasNext()) {
 				String key = iterator.next().toString();
 				if (key.startsWith(keyStartsWith)) {
-					
-					String value = ""; //$NON-NLS-1$
-					if (key.endsWith("MAP")) {
+
+					String value = JAXBCoreConstants.ZEROSTR; 
+					if (key.endsWith("MAP")) { //$NON-NLS-1$
 						Map map = configuration.getAttribute(key, new HashMap<String, String>());
 						Iterator mapIterator = map.keySet().iterator();
-						while(mapIterator.hasNext()) {
+						while (mapIterator.hasNext()) {
 							Object envKey = mapIterator.next();
 							Object envValue = map.get(envKey);
 							envMap.put(envKey.toString().trim(), envValue.toString().trim());
-							
+
 						}
 					}
-					else{
+					else {
 						// split the key with the variable name (after the last underscore)
 						String mapKey = key.replace(keyStartsWith, JAXBCoreConstants.ZEROSTR);
-					try {
-						// Try string attribute
-						value = configuration.getAttribute(key, JAXBCoreConstants.ZEROSTR);
-					} catch (DebugException e) {
 						try {
-							// Try integer attribute
-							value = Integer.toString(configuration.getAttribute(key, 0));
-						} catch (DebugException e1) {
-							// Ignore other types
+							// Try string attribute
+							value = configuration.getAttribute(key, JAXBCoreConstants.ZEROSTR);
+						} catch (DebugException e) {
+							try {
+								// Try integer attribute
+								value = Integer.toString(configuration.getAttribute(key, 0));
+							} catch (DebugException e1) {
+								// Ignore other types
+							}
+						}
+						if (value != null && value.trim().length() > 0) {
+							envMap.put(mapKey, value);
 						}
 					}
-					if (value != null && value.trim().length() > 0) {
-						envMap.put(mapKey, value);
-					}
-				}
 				}
 			}
 			return envMap;
diff --git a/tools/etfw/org.eclipse.ptp.etfw.launch/src/org/eclipse/ptp/internal/etfw/launch/PerformanceAnalysisTab.java b/tools/etfw/org.eclipse.ptp.etfw.launch/src/org/eclipse/ptp/internal/etfw/launch/PerformanceAnalysisTab.java
index 17562bc..cbe2216 100644
--- a/tools/etfw/org.eclipse.ptp.etfw.launch/src/org/eclipse/ptp/internal/etfw/launch/PerformanceAnalysisTab.java
+++ b/tools/etfw/org.eclipse.ptp.etfw.launch/src/org/eclipse/ptp/internal/etfw/launch/PerformanceAnalysisTab.java
@@ -25,6 +25,7 @@
 import org.eclipse.ptp.etfw.IToolLaunchConfigurationConstants;
 import org.eclipse.ptp.etfw.PreferenceConstants;
 import org.eclipse.ptp.internal.etfw.jaxb.JAXBInitializationUtil;
+import org.eclipse.ptp.internal.etfw.jaxb.data.AnalysisToolType;
 import org.eclipse.ptp.internal.etfw.jaxb.data.BuildToolType;
 import org.eclipse.ptp.internal.etfw.jaxb.data.EtfwToolProcessType;
 import org.eclipse.ptp.internal.etfw.jaxb.data.ExecToolType;
@@ -347,6 +348,23 @@
 						}
 					}
 				}
+			} else if (tool instanceof AnalysisToolType) {
+				AnalysisToolType analysisTool = (AnalysisToolType) tool;
+				if (analysisTool.getGlobal() != null) {
+					for (ToolPaneType toolPane : analysisTool.getGlobal().getToolPanes()) {
+						if (!toolPane.isVirtual() && toolPane.getOptionPane() != null) {
+							subTabs.add(toolPane);
+						}
+					}
+				}
+
+				for (ToolAppType toolApp : analysisTool.getAnalysisCommands()) {
+					for (ToolPaneType toolPane : toolApp.getToolPanes()) {
+						if (!toolPane.isVirtual() && toolPane.getOptionPane() != null) {
+							subTabs.add(toolPane);
+						}
+					}
+				}
 			}
 		}
 		return subTabs;
@@ -458,7 +476,7 @@
 		@Override
 		public void widgetSelected(SelectionEvent e) {
 			int selection = toolCombo.getSelectionIndex();
-			if(selection != -1) {
+			if (selection != -1) {
 				String toolName = toolCombo.getItem(selection);
 				rebuildTab(toolName);
 				updateLaunchConfigurationDialog();
@@ -474,6 +492,7 @@
 
 	/*
 	 * (non-Javadoc)
+	 * 
 	 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName()
 	 */
 	@Override
@@ -493,7 +512,10 @@
 
 	/*
 	 * (non-Javadoc)
-	 * @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#setLaunchConfigurationDialog(org.eclipse.debug.ui.ILaunchConfigurationDialog)
+	 * 
+	 * @see
+	 * org.eclipse.debug.ui.AbstractLaunchConfigurationTab#setLaunchConfigurationDialog(org.eclipse.debug.ui.ILaunchConfigurationDialog
+	 * )
 	 */
 	@Override
 	public void setLaunchConfigurationDialog(ILaunchConfigurationDialog dialog) {
@@ -532,7 +554,7 @@
 
 		return true;
 	}
-	
+
 	public Image getImage() {
 		return LaunchImages.getImage(LaunchImages.IMG_PERFORMANCE_TAB);
 	}
diff --git a/tools/etfw/org.eclipse.ptp.etfw/src/org/eclipse/ptp/internal/etfw/ETFWAnalysisTool.java b/tools/etfw/org.eclipse.ptp.etfw/src/org/eclipse/ptp/internal/etfw/ETFWAnalysisTool.java
index 3928931..084dd9e 100644
--- a/tools/etfw/org.eclipse.ptp.etfw/src/org/eclipse/ptp/internal/etfw/ETFWAnalysisTool.java
+++ b/tools/etfw/org.eclipse.ptp.etfw/src/org/eclipse/ptp/internal/etfw/ETFWAnalysisTool.java
@@ -128,16 +128,15 @@
 		IFileStore[] filea = null;
 		try {
 			filea = root.childStores(EFS.NONE, null);
+			for (final IFileStore f : filea) {
+				if (f.fetchInfo().isDirectory()) {
+					files.add(f);
+				}
+			}
 		} catch (final CoreException e) {
 			e.printStackTrace();
 		}
 
-		for (final IFileStore f : filea) {
-			if (f.fetchInfo().isDirectory()) {
-				files.add(f);
-			}
-		}
-
 		return files;
 	}
 
@@ -209,7 +208,7 @@
 								utilBLob.runTool(runTool, null, outputLocation, anap.getOutToFile());
 							} else {
 								byte[] utout = null;
-								final MessageConsole mc = findConsole("ETFw");
+								final MessageConsole mc = findConsole("ETFw"); //$NON-NLS-1$
 								mc.clearConsole();
 								final OutputStream os = mc.newOutputStream();
 								utout = utilBlob.runToolGetOutput(runTool, null, outputLocation, true);
@@ -312,7 +311,10 @@
 			String customOutLoc = null;
 
 			try {
-				customOutLoc = configuration.getAttribute(IPTPLaunchConfigurationConstants.ATTR_WORKING_DIR, (String) null);
+				String rmName = configuration.getAttribute(IPTPLaunchConfigurationConstants.ATTR_RESOURCE_MANAGER_UNIQUENAME,
+						IToolLaunchConfigurationConstants.EMPTY);
+				customOutLoc = configuration.getAttribute(rmName + IToolLaunchConfigurationConstants.DOT
+						+ IPTPLaunchConfigurationConstants.ATTR_WORKING_DIR, (String) null);
 			} catch (final CoreException e1) {
 				e1.printStackTrace();
 			}
diff --git a/tools/etfw/org.eclipse.ptp.etfw/src/org/eclipse/ptp/internal/etfw/ETFWToolStep.java b/tools/etfw/org.eclipse.ptp.etfw/src/org/eclipse/ptp/internal/etfw/ETFWToolStep.java
index 42201e9..361f21a 100644
--- a/tools/etfw/org.eclipse.ptp.etfw/src/org/eclipse/ptp/internal/etfw/ETFWToolStep.java
+++ b/tools/etfw/org.eclipse.ptp.etfw/src/org/eclipse/ptp/internal/etfw/ETFWToolStep.java
@@ -26,6 +26,7 @@
 import org.eclipse.ptp.etfw.IToolLaunchConfigurationConstants;
 import org.eclipse.ptp.etfw.toolopts.ToolApp;
 import org.eclipse.ptp.etfw.toolopts.ToolsOptionsConstants;
+import org.eclipse.ptp.internal.etfw.jaxb.ETFWCoreConstants;
 import org.eclipse.ptp.internal.etfw.jaxb.data.ToolAppType;
 import org.eclipse.ptp.internal.etfw.jaxb.data.ToolIOType;
 import org.eclipse.ptp.internal.etfw.jaxb.util.ToolAppTypeUtil;
@@ -151,7 +152,11 @@
 		}
 
 		for (final String a : argList) {
-			args += a + " "; //$NON-NLS-1$
+			if(a.endsWith(ETFWCoreConstants.EQ)) {
+				args += a;
+			} else {
+				args += a + IToolLaunchConfigurationConstants.SPACE;
+			}
 		}
 
 		// Formerly replaced with projectLocation global variable. May be the