use of org.eclipse.wst.xsl.jaxp.launching.IProcessorInstall in project webtools.sourceediting by eclipse.
the class JAXPJavaLaunchConfigurationDelegate method getVMArguments.
@Override
public String getVMArguments(ILaunchConfiguration configuration) throws CoreException {
String vmargs = super.getVMArguments(configuration);
IProcessorInstall install = getProcessorInstall(configuration, mode);
if (install != null && !install.getProcessorType().isJREDefault()) {
// clear the endorsed dir
File tempDir = getEndorsedDir();
if (tempDir.exists()) {
File[] children = tempDir.listFiles();
for (File child : children) {
child.delete();
}
tempDir.delete();
}
tempDir.mkdir();
// move the required jars to the endorsed dir
IProcessorJar[] jars = install.getProcessorJars();
for (int i = 0; i < jars.length; i++) {
URL entry = jars[i].asURL();
if (entry == null)
throw new CoreException(new Status(IStatus.ERROR, JAXPLaunchingPlugin.PLUGIN_ID, IStatus.ERROR, Messages.XSLTLaunchConfigurationDelegate_23 + jars[i], null));
// $NON-NLS-1$ //$NON-NLS-2$
File file = new File(tempDir, "END_" + i + ".jar");
moveFile(entry, file);
}
// add the endorsed dir
// $NON-NLS-1$ //$NON-NLS-2$
vmargs += " -Djava.endorsed.dirs=\"" + tempDir.getAbsolutePath() + "\"";
String tfactory = getTransformerFactory(install);
if (tfactory != null)
// $NON-NLS-1$
vmargs += " -Djavax.xml.transform.TransformerFactory=" + tfactory;
// if (ILaunchManager.DEBUG_MODE.equals(mode))
// {
// // in debug mode, set the logging to ERROR. This prevents the
// console from popping up on top of the result view!
// try
// {
// URL url =
// FileLocator.resolve(FileLocator.find(Platform.getBundle(JAXPLaunchingPlugin.PLUGIN_ID),
// new Path("/log4j.debug.properties"), null));
// vmargs += " -Dlog4j.configuration=\""+url.toExternalForm()+"\""; //$NON-NLS-1$
// }
// catch (IOException e)
// {
// JAXPLaunchingPlugin.log(e);
// }
// }
}
return vmargs;
}
use of org.eclipse.wst.xsl.jaxp.launching.IProcessorInstall in project webtools.sourceediting by eclipse.
the class JAXPJavaLaunchConfigurationDelegate method getClasspath.
@Override
public String[] getClasspath(ILaunchConfiguration configuration) throws CoreException {
// get the classpath defined by the user
String[] userClasspath = super.getClasspath(configuration);
// get the classpath required for the transformation
IProcessorInvoker invoker = getProcessorInvokerDescriptor(configuration);
List<String> invokerCP = new ArrayList<String>();
for (String entry : invoker.getClasspathEntries()) {
invokerCP.add(entry);
}
// add the debugger...
IProcessorInstall install = getProcessorInstall(configuration, mode);
if (ILaunchManager.DEBUG_MODE.equals(mode) && install.getDebugger() != null) {
String[] jars = install.getDebugger().getClassPath();
for (String jar : jars) {
invokerCP.add(jar);
}
}
String[] invokerClasspath = invokerCP.toArray(new String[0]);
// add them together
String[] classpath = new String[userClasspath.length + invokerClasspath.length];
System.arraycopy(invokerClasspath, 0, classpath, 0, invokerClasspath.length);
System.arraycopy(userClasspath, 0, classpath, invokerClasspath.length, userClasspath.length);
return classpath;
}
use of org.eclipse.wst.xsl.jaxp.launching.IProcessorInstall in project webtools.sourceediting by eclipse.
the class ProcessorPreferences method getAsXML.
public String getAsXML() throws ParserConfigurationException, IOException, TransformerException {
Document doc = PreferenceUtil.getDocument();
// $NON-NLS-1$
Element config = doc.createElement("processorSettings");
doc.appendChild(config);
// Set the defaultVM attribute on the top-level node
if (defaultProcessorId != null) {
// $NON-NLS-1$
config.setAttribute("defaultProcessor", defaultProcessorId);
}
for (Iterator<IProcessorInstall> iter = processors.iterator(); iter.hasNext(); ) {
IProcessorInstall install = iter.next();
if (!install.isContributed()) {
Element vmTypeElement = installAsElement(doc, install);
config.appendChild(vmTypeElement);
}
}
// Serialize the Document and return the resulting String
return PreferenceUtil.serializeDocument(doc);
}
use of org.eclipse.wst.xsl.jaxp.launching.IProcessorInstall in project webtools.sourceediting by eclipse.
the class ProcessorsPreferencePage method createContents.
@Override
protected Control createContents(Composite ancestor) {
initializeDialogUnits(ancestor);
noDefaultAndApplyButton();
GridLayout layout = new GridLayout();
layout.numColumns = 1;
layout.marginHeight = 0;
layout.marginWidth = 0;
ancestor.setLayout(layout);
processorsBlock = new InstalledProcessorsBlock();
processorsBlock.createControl(ancestor);
Control control = processorsBlock.getControl();
GridData data = new GridData(GridData.FILL_BOTH);
data.horizontalSpan = 1;
control.setLayoutData(data);
// TODO PlatformUI.getWorkbench().getHelpSystem().setHelp...
initDefaultInstall();
processorsBlock.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
IProcessorInstall install = getCurrentDefaultProcessor();
if (install == null) {
setValid(false);
setErrorMessage(Messages.ProcessorsPreferencePage_2);
} else {
setValid(true);
setErrorMessage(null);
}
}
});
applyDialogFont(ancestor);
return ancestor;
}
use of org.eclipse.wst.xsl.jaxp.launching.IProcessorInstall in project webtools.sourceediting by eclipse.
the class ProcessorsPreferencePage method performOk.
@Override
public boolean performOk() {
processorsBlock.saveColumnSettings();
final boolean[] ok = new boolean[1];
try {
final IProcessorInstall[] installs = processorsBlock.getProcessors();
final IProcessorInstall defaultProcessor = getCurrentDefaultProcessor();
IRunnableWithProgress runnable = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
try {
JAXPRuntime.saveProcessorPreferences(installs, defaultProcessor, monitor);
} catch (CoreException e) {
XSLDebugUIPlugin.log(e);
}
ok[0] = !monitor.isCanceled();
}
};
XSLDebugUIPlugin.getDefault().getWorkbench().getProgressService().busyCursorWhile(runnable);
} catch (InvocationTargetException e) {
XSLDebugUIPlugin.log(e);
} catch (InterruptedException e) {
XSLDebugUIPlugin.log(e);
}
return ok[0];
}
Aggregations