use of org.eclipse.wst.xsl.jaxp.debug.invoker.TypedValue in project webtools.sourceediting by eclipse.
the class LaunchHelper method save.
public void save(File file) throws CoreException {
BufferedWriter writer = null;
try {
// ensure it exists
file.createNewFile();
writer = new BufferedWriter(new FileWriter(file));
PipelineDefinition pdef = new PipelineDefinition();
for (Iterator<?> iter = attributes.getAttributes().iterator(); iter.hasNext(); ) {
LaunchAttribute att = (LaunchAttribute) iter.next();
pdef.addAttribute(new TypedValue(att.uri, TypedValue.TYPE_STRING, att.value));
}
for (Iterator<?> iter = pipeline.getTransformDefs().iterator(); iter.hasNext(); ) {
LaunchTransform lt = (LaunchTransform) iter.next();
TransformDefinition tdef = new TransformDefinition();
URL url = pathToURL(lt.getLocation());
tdef.setStylesheetURL(url.toExternalForm());
tdef.setResolverClass(lt.getResolver());
for (Iterator<?> iterator = lt.getParameters().iterator(); iterator.hasNext(); ) {
LaunchAttribute att = (LaunchAttribute) iterator.next();
tdef.addParameter(new TypedValue(att.uri, TypedValue.TYPE_STRING, att.getResolvedValue()));
}
// set the output props for the LAST transform only
if (!iter.hasNext()) {
for (Map.Entry<String, String> entry : outputProperties.getProperties().entrySet()) {
String name = entry.getKey();
String value = entry.getValue();
if (name != null && value != null)
tdef.setOutputProperty(name, value);
}
}
pdef.addTransformDef(tdef);
}
Document doc = pdef.toXML();
String s = PreferenceUtil.serializeDocument(doc);
writer.write(s);
} catch (FileNotFoundException e) {
throw new CoreException(new Status(IStatus.ERROR, JAXPLaunchingPlugin.PLUGIN_ID, IStatus.ERROR, Messages.LaunchHelper_0, e));
} catch (IOException e) {
throw new CoreException(new Status(IStatus.ERROR, JAXPLaunchingPlugin.PLUGIN_ID, IStatus.ERROR, Messages.LaunchHelper_1, e));
} catch (ParserConfigurationException e) {
throw new CoreException(new Status(IStatus.ERROR, JAXPLaunchingPlugin.PLUGIN_ID, IStatus.ERROR, "ParserConfigurationException", // $NON-NLS-1$
e));
} catch (TransformerException e) {
throw new CoreException(new Status(IStatus.ERROR, JAXPLaunchingPlugin.PLUGIN_ID, IStatus.ERROR, "TransformerException", // $NON-NLS-1$
e));
} finally {
if (writer != null) {
try {
writer.close();
} catch (IOException e) {
JAXPLaunchingPlugin.log(e);
}
}
}
}
use of org.eclipse.wst.xsl.jaxp.debug.invoker.TypedValue in project webtools.sourceediting by eclipse.
the class PipelineDefintionTest method testRemoveAttribute.
@Test
public void testRemoveAttribute() throws Exception {
TypedValue attr = setupAttribute();
pldef.addAttribute(attr);
assertEquals(1, pldef.getAttributes().size());
pldef.removeAttribute(attr);
assertEquals(0, pldef.getAttributes().size());
}
use of org.eclipse.wst.xsl.jaxp.debug.invoker.TypedValue in project webtools.sourceediting by eclipse.
the class TransformDefinitonTest method setupParameters.
private TypedValue setupParameters() {
TypedValue param = new TypedValue("param", TypedValue.TYPE_STRING, "test");
tdef.addParameter(param);
return param;
}
use of org.eclipse.wst.xsl.jaxp.debug.invoker.TypedValue in project webtools.sourceediting by eclipse.
the class TransformDefinitonTest method testRemoveParameter.
@Test
public void testRemoveParameter() throws Exception {
TypedValue param = setupParameters();
assertTrue(tdef.getParameters().size() > 0);
tdef.removeParameter(param);
assertTrue("Found parameters when there should be zero.", tdef.getParameters().size() == 0);
}
use of org.eclipse.wst.xsl.jaxp.debug.invoker.TypedValue in project webtools.sourceediting by eclipse.
the class PipelineDefintionTest method setupAttribute.
private TypedValue setupAttribute() {
TypedValue attr = new TypedValue("attr", TypedValue.TYPE_STRING, "1");
pldef.addAttribute(attr);
return attr;
}
Aggregations