use of org.eclipse.wst.xsl.jaxp.launching.IProcessorJar 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.IProcessorJar in project webtools.sourceediting by eclipse.
the class ProcessorPreferences method elementAsJars.
private static IProcessorJar[] elementAsJars(Element element) {
// $NON-NLS-1$
Element[] jarEls = PreferenceUtil.getChildElements(element, "jar");
List<ProcessorJar> jars = new ArrayList<ProcessorJar>(jarEls.length);
for (Element jarEl : jarEls) {
Node node = jarEl.getFirstChild();
if (node != null && node.getNodeType() == Node.TEXT_NODE) {
String path = ((Text) node).getNodeValue();
jars.add(new ProcessorJar(Path.fromPortableString(path)));
}
}
return jars.toArray(new IProcessorJar[0]);
}
use of org.eclipse.wst.xsl.jaxp.launching.IProcessorJar in project webtools.sourceediting by eclipse.
the class ProcessorPreferences method jarsAsElement.
private static Element jarsAsElement(Document doc, IProcessorJar[] jars) {
// $NON-NLS-1$
Element jarsEl = doc.createElement("jars");
for (IProcessorJar jar : jars) {
if (jar != null && jar.getPath() != null) {
// $NON-NLS-1$
Element jarEl = doc.createElement("jar");
Text text = doc.createTextNode(jar.getPath().toPortableString());
jarEl.appendChild(text);
jarsEl.appendChild(jarEl);
}
}
return jarsEl;
}
use of org.eclipse.wst.xsl.jaxp.launching.IProcessorJar in project webtools.sourceediting by eclipse.
the class ProcessorRegistry method addProcessor.
public void addProcessor(String bundleId, String id, String label, String processorTypeId, String classpath, String debuggerId, String supports) {
IProcessorJar[] jars = ProcessorInstall.createJars(bundleId, classpath);
contributedInstalls.add(new ProcessorInstall(id, label, processorTypeId, jars, debuggerId, supports, true));
}
use of org.eclipse.wst.xsl.jaxp.launching.IProcessorJar in project webtools.sourceediting by eclipse.
the class ProcessorLibraryBlock method addWorkspace.
private void addWorkspace(IStructuredSelection selection) {
IDialogSettings dialogSettings = XSLDebugUIPlugin.getDefault().getDialogSettings();
String lastUsedPath = dialogSettings.get(LAST_WORKSPACE_PATH_SETTING);
IPath lastPath = null;
if (lastUsedPath != null) {
lastPath = Path.fromPortableString(lastUsedPath);
}
// IResource currentResource = getResource();
ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(tableViewer.getControl().getShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider());
dialog.setTitle(Messages.ProcessorLibraryBlock_WorkspaceFileDialog_Title);
dialog.setMessage(Messages.ProcessorLibraryBlock_WorkspaceFileDialog_Message);
dialog.setValidator(validator);
dialog.addFilter(new ViewerFilter() {
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
if (element instanceof IContainer)
return true;
else if (element instanceof IFile) {
IFile file = (IFile) element;
String extension = file.getFileExtension();
if (extension == null)
return false;
// $NON-NLS-1$
return extension.equals("jar");
}
return false;
}
});
dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
if (lastPath != null)
dialog.setInitialSelection(lastPath);
dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
dialog.setAllowMultiple(true);
if (dialog.open() == Window.OK) {
Object[] elements = dialog.getResult();
if (elements.length > 0) {
IProcessorJar[] libs = new IProcessorJar[elements.length];
for (int i = 0; i < elements.length; i++) {
IFile jar = (IFile) elements[i];
libs[i] = JAXPRuntime.createProcessorJar(jar.getFullPath());
}
IProcessorJar[] currentJars = install.getProcessorJars();
IProcessorJar[] newJars = new IProcessorJar[currentJars.length + libs.length];
System.arraycopy(currentJars, 0, newJars, 0, currentJars.length);
System.arraycopy(libs, 0, newJars, currentJars.length, libs.length);
install.setProcessorJars(newJars);
tableViewer.add(libs);
lastPath = libs[0].getPath();
lastPath = lastPath.uptoSegment(lastPath.segmentCount());
dialogSettings.put(LAST_WORKSPACE_PATH_SETTING, lastPath.toPortableString());
}
}
}
Aggregations