use of org.eclipse.wst.xsl.jaxp.launching.internal.ProcessorPreferences in project webtools.sourceediting by eclipse.
the class ProcessorRegistry method addPersistedVMs.
private void addPersistedVMs() {
// Try retrieving the VM preferences from the preference store
String vmXMLString = JAXPLaunchingPlugin.getDefault().getPluginPreferences().getString(JAXPRuntime.PREF_PROCESSOR_XML);
// If the preference was found, load VMs from it into memory
if (vmXMLString.length() > 0) {
try {
ByteArrayInputStream inputStream = new ByteArrayInputStream(vmXMLString.getBytes());
ProcessorPreferences prefs = ProcessorPreferences.fromXML(inputStream);
String defaultProcessorId = prefs.getDefaultProcessorId();
userInstalls = prefs.getProcessors();
for (Iterator<IProcessorInstall> iter = userInstalls.iterator(); iter.hasNext(); ) {
IProcessorInstall install = iter.next();
if (install.getId().equals(defaultProcessorId)) {
defaultProcessor = install;
}
}
if (defaultProcessor == null) {
for (Iterator<ProcessorInstall> iter = contributedInstalls.iterator(); iter.hasNext(); ) {
IProcessorInstall install = iter.next();
if (defaultProcessor == null && install.getId().equals(defaultProcessorId)) {
defaultProcessor = install;
}
}
}
} catch (CoreException e) {
JAXPLaunchingPlugin.log(e);
}
}
// make the JRE the default default
if (defaultProcessor == null) {
defaultProcessor = jreDefaultProcessor;
}
}
use of org.eclipse.wst.xsl.jaxp.launching.internal.ProcessorPreferences in project webtools.sourceediting by eclipse.
the class JAXPRuntime method saveProcessorPreferences.
public static void saveProcessorPreferences(IProcessorInstall[] installs, IProcessorInstall defaultInstall, IProgressMonitor monitor) throws CoreException {
if (monitor.isCanceled())
return;
try {
monitor.beginTask(Messages.XSLTRuntime_9, 100);
ProcessorPreferences prefs = new ProcessorPreferences();
if (defaultInstall != null)
prefs.setDefaultProcessorId(defaultInstall.getId());
prefs.setProcessors(new ArrayList<IProcessorInstall>(Arrays.asList(installs)));
String xml = prefs.getAsXML();
monitor.worked(40);
if (monitor.isCanceled())
return;
JAXPRuntime.getPreferences().setValue(JAXPRuntime.PREF_PROCESSOR_XML, xml);
monitor.worked(30);
if (monitor.isCanceled())
return;
JAXPRuntime.savePreferences();
monitor.worked(30);
} catch (Exception e) {
throw new CoreException(new Status(IStatus.ERROR, JAXPLaunchingPlugin.PLUGIN_ID, Messages.XSLTRuntime_10, e));
} finally {
monitor.done();
}
}
Aggregations