diff options
author | Darin Swanson | 2003-10-16 23:44:19 +0000 |
---|---|---|
committer | Darin Swanson | 2003-10-16 23:44:19 +0000 |
commit | 530c6c727fca7a2631950e936cc716f01e078a59 (patch) | |
tree | e68951f8e739df58c6345433420e3ce2fca5c6af | |
parent | 9c93f06c034bd2bba932d19b5d5f4207ef38302e (diff) | |
download | eclipse.platform.debug-530c6c727fca7a2631950e936cc716f01e078a59.tar.gz eclipse.platform.debug-530c6c727fca7a2631950e936cc716f01e078a59.tar.xz eclipse.platform.debug-530c6c727fca7a2631950e936cc716f01e078a59.zip |
Bug 44934 - Remove dependancies on Xerces plugin
7 files changed, 61 insertions, 38 deletions
diff --git a/org.eclipse.debug.ui/.classpath b/org.eclipse.debug.ui/.classpath index 096d2c430..d505bd7a2 100644 --- a/org.eclipse.debug.ui/.classpath +++ b/org.eclipse.debug.ui/.classpath @@ -1,14 +1,13 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry kind="src" path="ui/"/> - <classpathentry kind="src" path="/org.apache.xerces"/> - <classpathentry kind="src" path="/org.eclipse.core.resources"/> - <classpathentry kind="src" path="/org.eclipse.ui"/> - <classpathentry kind="src" path="/org.eclipse.debug.core"/> - <classpathentry kind="src" path="/org.eclipse.core.runtime"/> - <classpathentry kind="src" path="/org.eclipse.core.boot"/> - <classpathentry kind="var" path="JRE_LIB" sourcepath="JRE_SRC"/> - <classpathentry kind="src" path="/org.eclipse.help"/> - <classpathentry kind="src" path="/org.eclipse.ui.console"/> - <classpathentry kind="output" path="bin"/> + <classpathentry kind="src" path="ui/"/> + <classpathentry kind="src" path="/org.eclipse.core.resources"/> + <classpathentry kind="src" path="/org.eclipse.ui"/> + <classpathentry kind="src" path="/org.eclipse.debug.core"/> + <classpathentry kind="src" path="/org.eclipse.core.runtime"/> + <classpathentry kind="src" path="/org.eclipse.core.boot"/> + <classpathentry sourcepath="JRE_SRC" kind="var" path="JRE_LIB"/> + <classpathentry kind="src" path="/org.eclipse.help"/> + <classpathentry kind="src" path="/org.eclipse.ui.console"/> + <classpathentry kind="output" path="bin"/> </classpath> diff --git a/org.eclipse.debug.ui/.project b/org.eclipse.debug.ui/.project index fb9a16982..b92199dd9 100644 --- a/org.eclipse.debug.ui/.project +++ b/org.eclipse.debug.ui/.project @@ -3,7 +3,6 @@ <name>org.eclipse.debug.ui</name> <comment></comment> <projects> - <project>org.apache.xerces</project> <project>org.eclipse.core.boot</project> <project>org.eclipse.core.resources</project> <project>org.eclipse.core.runtime</project> diff --git a/org.eclipse.debug.ui/plugin.xml b/org.eclipse.debug.ui/plugin.xml index 2df977225..5b83dd93f 100644 --- a/org.eclipse.debug.ui/plugin.xml +++ b/org.eclipse.debug.ui/plugin.xml @@ -13,7 +13,6 @@ </library> </runtime> <requires> - <import plugin="org.apache.xerces"/> <import plugin="org.eclipse.core.resources"/> <import plugin="org.eclipse.ui"/> <import plugin="org.eclipse.ui.console"/> diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java index 88674aed4..18250e8bf 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java @@ -13,14 +13,18 @@ package org.eclipse.debug.internal.ui; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.io.OutputStreamWriter; import java.lang.reflect.InvocationTargetException; import java.text.MessageFormat; -import org.apache.xml.serialize.Method; -import org.apache.xml.serialize.OutputFormat; -import org.apache.xml.serialize.Serializer; -import org.apache.xml.serialize.SerializerFactory; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; + import org.eclipse.core.resources.IncrementalProjectBuilder; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; @@ -587,20 +591,29 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { * @param doc document to serialize * @return the document as a string */ - public static String serializeDocument(Document doc) throws IOException { + public static String serializeDocument(Document doc) throws TransformerException, IOException { ByteArrayOutputStream s= new ByteArrayOutputStream(); - OutputFormat format = new OutputFormat(); - format.setIndenting(true); - format.setLineSeparator(System.getProperty("line.separator")); //$NON-NLS-1$ - Serializer serializer = - SerializerFactory.getSerializerFactory(Method.XML).makeSerializer( - new OutputStreamWriter(s, "UTF8"), //$NON-NLS-1$ - format); - serializer.asDOMSerializer().serialize(doc); - return s.toString("UTF8"); //$NON-NLS-1$ - } + TransformerFactory factory= TransformerFactory.newInstance(); + Transformer transformer= factory.newTransformer(); + DOMSource source= new DOMSource(doc); + StreamResult outputTarget= new StreamResult(s); + transformer.transform(source, outputTarget); + + return s.toString("UTF8"); //$NON-NLS-1$ + } + + public static Document getDocument() throws ParserConfigurationException { + DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance(); + + dfactory.setNamespaceAware(true); + dfactory.setValidating(true); + DocumentBuilder docBuilder = dfactory.newDocumentBuilder(); + Document doc =docBuilder.newDocument(); + return doc; + } + /** * Determines and returns the selection in the specified window. If nothing is * actually selected, look for an active editor. diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java index db061f884..8279539f6 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java @@ -27,8 +27,8 @@ import java.util.Map; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.TransformerException; -import org.apache.xerces.dom.DocumentImpl; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IExtensionPoint; @@ -137,7 +137,7 @@ public class LaunchConfigurationManager implements ILaunchListener { return false; } - public void shutdown() throws CoreException { + public void shutdown() { ILaunchManager launchManager= DebugPlugin.getDefault().getLaunchManager(); launchManager.removeLaunchListener(this); if (fLaunchHistories != null) { @@ -227,8 +227,8 @@ public class LaunchConfigurationManager implements ILaunchListener { } } - protected String getHistoryAsXML() throws IOException, CoreException { - Document doc = new DocumentImpl(); + protected String getHistoryAsXML() throws CoreException, ParserConfigurationException, TransformerException, IOException { + Document doc = DebugUIPlugin.getDocument(); Element historyRootElement = doc.createElement(HISTORY_ROOT_NODE); doc.appendChild(historyRootElement); @@ -269,7 +269,7 @@ public class LaunchConfigurationManager implements ILaunchListener { * Write out an XML file indicating the entries on the run & debug history lists and * the most recent launch. */ - protected void persistLaunchHistory() throws IOException, CoreException { + protected void persistLaunchHistory() throws IOException, CoreException, TransformerException, ParserConfigurationException { if (fRestoring) { return; } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchHistory.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchHistory.java index 9e3864279..559718041 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchHistory.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchHistory.java @@ -16,6 +16,9 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.TransformerException; + import org.eclipse.core.runtime.CoreException; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunch; @@ -119,6 +122,10 @@ public class LaunchHistory implements ILaunchListener, ILaunchConfigurationListe DebugUIPlugin.log(e); } catch (IOException e) { DebugUIPlugin.log(e); + } catch (ParserConfigurationException e) { + DebugUIPlugin.log(e); + } catch (TransformerException e) { + DebugUIPlugin.log(e); } } } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/PerspectiveManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/PerspectiveManager.java index 353a72527..3a6da2b45 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/PerspectiveManager.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/PerspectiveManager.java @@ -21,8 +21,8 @@ import java.util.Map; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.TransformerException; -import org.apache.xerces.dom.DocumentImpl; import org.eclipse.core.runtime.CoreException; import org.eclipse.debug.core.DebugEvent; import org.eclipse.debug.core.DebugPlugin; @@ -343,6 +343,10 @@ public class PerspectiveManager implements ILaunchListener, IDebugEventSetListen DebugUIPlugin.getDefault().savePluginPreferences(); } catch (IOException e) { DebugUIPlugin.log(DebugUIPlugin.newErrorStatus(LaunchConfigurationsMessages.getString("PerspectiveManager.9"), e)); //$NON-NLS-1$ + } catch (ParserConfigurationException e) { + DebugUIPlugin.log(DebugUIPlugin.newErrorStatus(LaunchConfigurationsMessages.getString("PerspectiveManager.9"), e)); //$NON-NLS-1$ + } catch (TransformerException e) { + DebugUIPlugin.log(DebugUIPlugin.newErrorStatus(LaunchConfigurationsMessages.getString("PerspectiveManager.9"), e)); //$NON-NLS-1$ } } @@ -378,11 +382,13 @@ public class PerspectiveManager implements ILaunchListener, IDebugEventSetListen * Generates XML for the user specified perspective settings. * * @return XML - * @exception CoreException if unable to generate the XML + * @exception IOException if unable to generate the XML + * @exception TransformerException if unable to generate the XML + * @exception ParserConfigurationException if unable to generate the XML */ - private String generatePerspectiveXML() throws IOException { + private String generatePerspectiveXML() throws ParserConfigurationException, TransformerException, IOException { - Document doc = new DocumentImpl(); + Document doc = DebugUIPlugin.getDocument(); Element configRootElement = doc.createElement(ELEMENT_PERSPECTIVES); doc.appendChild(configRootElement); |