Author: tfennelly
Date: 2009-11-27 08:56:32 -0500 (Fri, 27 Nov 2009)
New Revision: 18878
Added:
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/core/SmooksInputType.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/ProcessNodeType.java
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks10/model/smooks/util/SmooksModelUtils.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/.classpath
trunk/smooks/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF
trunk/smooks/plugins/org.jboss.tools.smooks.ui/build.properties
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLaunchConfigurationDelegate.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLaunchMetadata.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLaunchTabGroup.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLauncher.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksRunTab.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5259
Implement rudimentary Test facility for Smooks Config
Added:
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/core/SmooksInputType.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/core/SmooksInputType.java
(rev 0)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/core/SmooksInputType.java 2009-11-27
13:56:32 UTC (rev 18878)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.tools.smooks.core;
+
+/**
+ * Smooks Input Type Enumeration.
+ * @author <a
href="mailto:tom.fennelly@jboss.com">tom.fennelly@jboss.com</a>
+ */
+public class SmooksInputType {
+
+ public static final String INPUT_TYPE_JAVA = "input.java";
+
+ public static final String INPUT_TYPE_CUSTOM = "input.custom";
+
+ public static final String INPUT_TYPE_JSON = "input.json";
+
+ public static final String INPUT_TYPE_CSV = "input.csv";
+
+ public static final String INPUT_TYPE_XML = "input.xml";
+
+ public static final String INPUT_TYPE_XSD = "input.xsd";
+
+ public static final String INPUT_TYPE_EDI = "input.edi";
+}
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks10/model/smooks/util/SmooksModelUtils.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks10/model/smooks/util/SmooksModelUtils.java 2009-11-27
13:06:45 UTC (rev 18877)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks10/model/smooks/util/SmooksModelUtils.java 2009-11-27
13:56:32 UTC (rev 18878)
@@ -29,6 +29,7 @@
import org.eclipse.emf.edit.command.CommandParameter;
import org.eclipse.emf.edit.command.RemoveCommand;
import org.eclipse.emf.edit.domain.EditingDomain;
+import org.jboss.tools.smooks.core.SmooksInputType;
import org.jboss.tools.smooks.model.freemarker.Freemarker;
import org.jboss.tools.smooks.model.freemarker.Template;
import org.jboss.tools.smooks.model.smooks.AbstractResourceConfig;
@@ -62,21 +63,21 @@
public static final String KEY_CSV_QUOTE = "quote";
- public static final String INPUT_TYPE_JAVA = "input.java";
+ public static final String INPUT_TYPE_JAVA = SmooksInputType.INPUT_TYPE_JAVA;
public static final String INPUT_TYPE = "inputType";
- public static final String INPUT_TYPE_CUSTOME = "input.custom";
+ public static final String INPUT_TYPE_CUSTOME = SmooksInputType.INPUT_TYPE_CUSTOM;
- public static final String INPUT_TYPE_JSON_1_1 = "input.json";
+ public static final String INPUT_TYPE_JSON_1_1 = SmooksInputType.INPUT_TYPE_JSON;
- public static final String INPUT_TYPE_CSV = "input.csv";
+ public static final String INPUT_TYPE_CSV = SmooksInputType.INPUT_TYPE_CSV;
public static final String INPUT_ACTIVE_TYPE = "input.type.actived";
public static final String INPUT_DEACTIVE_TYPE = "input.type.deactived";
- public static final String INPUT_TYPE_CSV_1_2 = "input.csv";
+ public static final String INPUT_TYPE_CSV_1_2 = SmooksInputType.INPUT_TYPE_CSV;
public static final String PARAM_NAME_CLASS = "class";
@@ -84,9 +85,9 @@
public static final String PARAM_NAME_ACTIVED = "actived";
- public static final String INPUT_TYPE_XML = "input.xml";
+ public static final String INPUT_TYPE_XML = SmooksInputType.INPUT_TYPE_XML;
- public static final String INPUT_TYPE_XSD = "input.xsd";
+ public static final String INPUT_TYPE_XSD = SmooksInputType.INPUT_TYPE_XSD;
public static final String TYPE_XSL = "xsl";
@@ -98,11 +99,11 @@
public static final String BINDINGS = "bindings";
- public static final String INPUT_TYPE_EDI_1_1 = "input.edi";
+ public static final String INPUT_TYPE_EDI_1_1 = SmooksInputType.INPUT_TYPE_EDI;
- public static final String INPUT_TYPE_EDI_1_2 = "input.edi";
+ public static final String INPUT_TYPE_EDI_1_2 = SmooksInputType.INPUT_TYPE_EDI;
- public static final String INPUT_TYPE_JSON_1_2 = "input.json";
+ public static final String INPUT_TYPE_JSON_1_2 = SmooksInputType.INPUT_TYPE_EDI;
public static EStructuralFeature ATTRIBUTE_PROPERTY =
ExtendedMetaData.INSTANCE.demandFeature(null, "property",
false);
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/.classpath
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/.classpath 2009-11-27 13:06:45 UTC (rev
18877)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/.classpath 2009-11-27 13:56:32 UTC (rev
18878)
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry exported="true" kind="lib"
path="libs/xstream-1.2.2.jar"/>
- <classpathentry exported="true" kind="lib"
path="bin/"/>
<classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con"
path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF 2009-11-27
13:06:45 UTC (rev 18877)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF 2009-11-27
13:56:32 UTC (rev 18878)
@@ -41,8 +41,7 @@
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Vendor: %providerName
-Bundle-ClassPath: bin/,
- libs/dom4j-1.6.1.jar,
+Bundle-ClassPath: libs/dom4j-1.6.1.jar,
.,
libs/xstream-1.2.2.jar
Export-Package: org.jboss.template,
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/build.properties
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/build.properties 2009-11-27 13:06:45
UTC (rev 18877)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/build.properties 2009-11-27 13:56:32
UTC (rev 18878)
@@ -12,5 +12,4 @@
jboss_about.png,\
plugin.properties,\
schema/,\
- bin/,\
libs/xstream-1.2.2.jar
Added:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/ProcessNodeType.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/ProcessNodeType.java
(rev 0)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/ProcessNodeType.java 2009-11-27
13:56:32 UTC (rev 18878)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.tools.smooks.launch;
+
+/**
+ * Configuration process node type enumeration.
+ *
+ * @author <a
href="mailto:tom.fennelly@jboss.com">tom.fennelly@jboss.com</a>
+ */
+public enum ProcessNodeType {
+ TEMPLATING,
+ JAVA_BINDING
+}
\ No newline at end of file
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLaunchConfigurationDelegate.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLaunchConfigurationDelegate.java 2009-11-27
13:06:45 UTC (rev 18877)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLaunchConfigurationDelegate.java 2009-11-27
13:56:32 UTC (rev 18878)
@@ -20,29 +20,34 @@
package org.jboss.tools.smooks.launch;
import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate;
import org.eclipse.jdt.launching.ExecutionArguments;
import org.eclipse.jdt.launching.IVMRunner;
import org.eclipse.jdt.launching.VMRunnerConfiguration;
-import org.eclipse.osgi.baseadaptor.loader.BaseClassLoader;
-import org.eclipse.osgi.baseadaptor.loader.ClasspathEntry;
-import org.eclipse.osgi.baseadaptor.loader.ClasspathManager;
-import org.osgi.framework.BundleException;
+import org.jboss.tools.smooks.core.SmooksInputType;
/**
* @author <a
href="mailto:tom.fennelly@jboss.com">tom.fennelly@jboss.com</a>
*/
public class SmooksLaunchConfigurationDelegate extends JUnitLaunchConfigurationDelegate
{
+ private static final String PLUGIN_ID =
"org.jboss.tools.smooks.ui.smooksLauncher";
public static final String SMOOKS_INPUT = "SmooksInput";
public static final String SMOOKS_INPUT_TYPE = "SmooksInputType";
public static final String SMOOKS_PROCESS_TYPES = "SmooksProcessTypes";
@@ -74,35 +79,16 @@
private VMRunnerConfiguration buildRunnerConfig(ILaunchConfiguration launchConfig)
throws CoreException {
List<String> classpath = new
ArrayList<String>(Arrays.asList(getClasspath(launchConfig)));
- //
====================================================================================================================
- // TODO Total Hack... Fixme: We're using classes here that we shouldn't, as
well as adding bundle paths that we
- // probably shouldn't, but how do I get the SmooksLauncher class on the launcher
classpath?
- // I added the "bin" folder to the bundle classpath as a workaround (with the
following code) for getting
- // the SmooksLauncher class onto the classpath. Need to fix this properly!!!!
- //
- ClassLoader classloader = getClass().getClassLoader();
- if(classloader instanceof BaseClassLoader) {
- ClasspathManager cpManager = ((BaseClassLoader)classloader).getClasspathManager();
- ClasspathEntry[] entries = cpManager.getHostClasspathEntries();
-
- for(ClasspathEntry entry : entries) {
- File baseFile = entry.getBundleFile().getBaseFile();
- try {
- String[] bundleEntries = entry.getBaseData().getClassPath();
- for(String bundleEntry : bundleEntries) {
- String path = baseFile.getAbsolutePath() + "/" + bundleEntry;
- if(!classpath.contains(path)) {
- classpath.add(path);
- }
- }
- } catch (BundleException e) {
- e.printStackTrace();
- }
- }
- }
- //
- //
====================================================================================================================
+ File wsRootDir = ResourcesPlugin.getWorkspace().getRoot().getRawLocation().toFile();
+ File wsTempClasses = new File(wsRootDir, "temp/classes");
+ // We need to add the SmooksLauncher to the launch classpath because it will not be
part of the projects
+ // classpath. Bit of a hack... there's probably a nicer way of doing this!!!
+ addToCP(wsTempClasses, SmooksLauncher.class);
+ addToCP(wsTempClasses, SmooksInputType.class);
+ addToCP(wsTempClasses, ProcessNodeType.class);
+ classpath.add(wsTempClasses.getAbsolutePath());
+
VMRunnerConfiguration runConfig= new
VMRunnerConfiguration(SmooksLauncher.class.getName(), classpath.toArray(new
String[classpath.size()]));
String[] envp= getEnvironment(launchConfig);
ArrayList<String> vmArguments= new ArrayList<String>();
@@ -121,4 +107,49 @@
return runConfig;
}
+
+ private void addToCP(File wsTempClasses, Class<?> theClass) throws CoreException
{
+ String className = theClass.getName().replace(".", "/") +
".class";
+ URL classURI = getClass().getResource("/" + className);
+
+ if(classURI != null) {
+ try {
+ InputStream classStream = classURI.openStream();
+
+ if(classStream != null) {
+ try {
+ File classOutFile = new File(wsTempClasses, className);
+ File classPackage = classOutFile.getParentFile();
+
+ classPackage.mkdirs();
+ if(classPackage.exists()) {
+ FileOutputStream classOutStream = new FileOutputStream(classOutFile);
+
+ try {
+ byte[] readBuf = new byte[100];
+ int readCount = 0;
+
+ while(readCount != -1) {
+ readCount = classStream.read(readBuf);
+ if(readCount != -1) {
+ classOutStream.write(readBuf, 0, readCount);
+ }
+ }
+ } finally {
+ try {
+ classOutStream.flush();
+ } finally {
+ classOutStream.close();
+ }
+ }
+ }
+ } finally {
+ classStream.close();
+ }
+ }
+ } catch (IOException e) {
+ new CoreException(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, "Error
copying SmooksLauncher to classpath.", e));
+ }
+ }
+ }
}
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLaunchMetadata.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLaunchMetadata.java 2009-11-27
13:06:45 UTC (rev 18877)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLaunchMetadata.java 2009-11-27
13:56:32 UTC (rev 18878)
@@ -48,11 +48,6 @@
*/
public class SmooksLaunchMetadata {
- public static enum ProcessNodeType {
- TEMPLATING,
- JAVA_BINDING
- }
-
private Smooks inputParamExtractor;
private boolean isValidSmooksConfig;
private File configFile;
@@ -71,6 +66,28 @@
return isValidSmooksConfig;
}
+ public String getErrorMessage() {
+ if(isValidSmooksConfig) {
+ throw new IllegalStateException("Invalid call to 'getErrorMessage()'.
Smooks configuration is NOT invalid.");
+ }
+
+ if(configFile == null) {
+ return "Smooks configuration file not configured.";
+ } else if(!configFile.exists()) {
+ return "Specified Smooks configuration file not found.";
+ } else if(!configFile.isFile()) {
+ return "Specified Smooks configuration file is not a readable file.";
+ } else if(inputFile == null) {
+ return "Specified Smooks configuration file 'Input' task is not
configured with a sample input file. Please configure the 'Input' task in the
Process flow.";
+ } else if(!inputFile.exists()) {
+ return "Specified Smooks configuration file 'Input' task is configured
with a sample input file, but the file cannot be found. Please reconfigure the
'Input' task in the Process flow.";
+ } else if(!inputFile.isFile()) {
+ return "Specified Smooks configuration file 'Input' task is configured
with a sample input file, but the file cannot be read. Please reconfigure the
'Input' task in the Process flow.";
+ }
+
+ return "";
+ }
+
public File getConfigFile() {
return configFile;
}
@@ -98,22 +115,11 @@
return builder.toString();
}
- public static Set<ProcessNodeType> fromNodeTypeString(String nodeTypeString) {
- String[] tokens = nodeTypeString.split(",");
- Set<ProcessNodeType> nodeTypes = new HashSet<ProcessNodeType>();
-
- for(String token : tokens) {
- nodeTypes.add(ProcessNodeType.valueOf(token));
- }
-
- return nodeTypes;
- }
-
public void setSmooksConfig(IResource smooksConfig) {
reset();
if(smooksConfig != null) {
- configFile = new File(smooksConfig.getRawLocation().toOSString());
+ configFile = new File(smooksConfig.getRawLocation().toOSString().trim());
if(configFile.exists() && configFile.isFile()) {
ExecutionContext execContext = inputParamExtractor.createExecutionContext();
Properties inputParams = new Properties();
@@ -125,15 +131,21 @@
inputParamExtractor.filterSource(execContext, new StreamSource(new
FileInputStream(configFile)));
- String inputType = inputParams.getProperty(SmooksModelUtils.INPUT_TYPE);
+ inputType = inputParams.getProperty(SmooksModelUtils.INPUT_TYPE);
if(inputType != null) {
String inputPath = inputParams.getProperty(inputType);
if(inputPath != null) {
- File inputFile = new File(SmooksUIUtils.parseFilePath(inputPath));
+ String resolvedFilePath;
+ try {
+ resolvedFilePath = SmooksUIUtils.parseFilePath(inputPath.trim());
+ } catch(Exception e) {
+ // It's not a valid config...
+ inputFile = new File(inputPath.trim());
+ return;
+ }
+ inputFile = new File(resolvedFilePath);
if(inputFile.exists() && inputFile.isFile()) {
- this.inputType = inputType;
- this.inputFile = inputFile;
isValidSmooksConfig = true;
}
}
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLaunchTabGroup.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLaunchTabGroup.java 2009-11-27
13:06:45 UTC (rev 18877)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLaunchTabGroup.java 2009-11-27
13:56:32 UTC (rev 18878)
@@ -28,6 +28,7 @@
import org.eclipse.jdt.debug.ui.launchConfigurations.JavaJRETab;
/**
+ * Smooks Launcher Tab Group.
* @author <a
href="mailto:tom.fennelly@jboss.com">tom.fennelly@jboss.com</a>
*/
public class SmooksLaunchTabGroup extends AbstractLaunchConfigurationTabGroup {
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLauncher.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLauncher.java 2009-11-27
13:06:45 UTC (rev 18877)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLauncher.java 2009-11-27
13:56:32 UTC (rev 18878)
@@ -22,14 +22,14 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
+import java.util.HashSet;
import java.util.Set;
import java.util.Map.Entry;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
-import org.jboss.tools.smooks.launch.SmooksLaunchMetadata.ProcessNodeType;
-import org.jboss.tools.smooks10.model.smooks.util.SmooksModelUtils;
+import org.jboss.tools.smooks.core.SmooksInputType;
import org.milyn.Smooks;
import org.milyn.payload.JavaResult;
import org.xml.sax.SAXException;
@@ -52,7 +52,7 @@
throw new RuntimeException("Expected 4 Launch arguments: <Smooks Config>
<Input Type> <Input Path> <Node Types>");
}
- if(args[1].equals(SmooksModelUtils.INPUT_TYPE_JAVA)) {
+ if(args[1].equals(SmooksInputType.INPUT_TYPE_JAVA)) {
System.out.println("Sorry... we don't support Java Inputs yet.");
} else {
File smooksConfig = new File(args[0]);
@@ -63,7 +63,7 @@
Smooks smooks = new Smooks(smooksConfig.getAbsolutePath());
try {
- Set<ProcessNodeType> processNodeTypes =
SmooksLaunchMetadata.fromNodeTypeString(args[3]);
+ Set<ProcessNodeType> processNodeTypes =
SmooksLauncher.fromNodeTypeString(args[3]);
JavaResult javaResult = new JavaResult();
if(processNodeTypes.contains(ProcessNodeType.TEMPLATING)) {
@@ -96,4 +96,15 @@
throw new RuntimeException("Specified '" + name + "' File
'" + file.getAbsolutePath() + "' is a Directory.");
}
}
+
+ public static Set<ProcessNodeType> fromNodeTypeString(String nodeTypeString) {
+ String[] tokens = nodeTypeString.split(",");
+ Set<ProcessNodeType> nodeTypes = new HashSet<ProcessNodeType>();
+
+ for(String token : tokens) {
+ nodeTypes.add(ProcessNodeType.valueOf(token));
+ }
+
+ return nodeTypes;
+ }
}
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksRunTab.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksRunTab.java 2009-11-27
13:06:45 UTC (rev 18877)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksRunTab.java 2009-11-27
13:56:32 UTC (rev 18878)
@@ -66,13 +66,13 @@
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.internal.junit.ui.JUnitMessages;
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
import org.eclipse.jdt.ui.JavaElementLabelProvider;
import org.jboss.tools.smooks.editor.AbstractSmooksFormEditor;
/**
+ * Smooks Run Tab.
* @author <a
href="mailto:tom.fennelly@jboss.com">tom.fennelly@jboss.com</a>
*/
public class SmooksRunTab extends AbstractLaunchConfigurationTab {
@@ -290,8 +290,8 @@
ILabelProvider labelProvider= new
JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT);
ElementListSelectionDialog dialog= new ElementListSelectionDialog(getShell(),
labelProvider);
- dialog.setTitle(JUnitMessages.JUnitLaunchConfigurationTab_projectdialog_title);
- dialog.setMessage(JUnitMessages.JUnitLaunchConfigurationTab_projectdialog_message);
+ dialog.setTitle("Select Smooks Configuration");
+ dialog.setMessage("Type Project name to narrow selection:");
dialog.setElements(projects);
IJavaProject javaProject = getJavaProject();
@@ -378,7 +378,7 @@
}
if(!launchMetaData.isValidSmooksConfig()) {
- setErrorMessage("The selected Smooks configuration is not valid. Must be a valid
Smooks configuration, with a valid configured input.");
+ setErrorMessage(launchMetaData.getErrorMessage());
}
}