diff options
author | Mikhail Khodjaiants | 2004-04-03 00:04:03 +0000 |
---|---|---|
committer | Mikhail Khodjaiants | 2004-04-03 00:04:03 +0000 |
commit | 15a02c374e0296ba0276233481e7688735bd0f5d (patch) | |
tree | 8c48f6d496c403d1aafad9144ec82f59cb9a46e7 /debug | |
parent | 2288121f9b9effbf5a3f7dbe65aad8f6ef2010b4 (diff) | |
download | org.eclipse.cdt-15a02c374e0296ba0276233481e7688735bd0f5d.tar.gz org.eclipse.cdt-15a02c374e0296ba0276233481e7688735bd0f5d.tar.xz org.eclipse.cdt-15a02c374e0296ba0276233481e7688735bd0f5d.zip |
Removed dependency to xerces.
Diffstat (limited to 'debug')
10 files changed, 153 insertions, 85 deletions
diff --git a/debug/org.eclipse.cdt.debug.core/ChangeLog b/debug/org.eclipse.cdt.debug.core/ChangeLog index fa9477e158a..9ba973285e3 100644 --- a/debug/org.eclipse.cdt.debug.core/ChangeLog +++ b/debug/org.eclipse.cdt.debug.core/ChangeLog @@ -1,3 +1,12 @@ +2004-04-02 Mikhail Khodjaiants
+ Removed dependency to xerces.
+ * CDebugUtils.java
+ * CDirectorySourceLocation.java
+ * CProjectSourceLocation.java
+ * CSourceLocator.java
+ * SourceUtils.java
+ * plugin.xml
+
2004-04-01 Mikhail Khodjaiants
Changes and additions to support the new implementations of Shared Libraries,
Signals and Disassembly views.
diff --git a/debug/org.eclipse.cdt.debug.core/plugin.xml b/debug/org.eclipse.cdt.debug.core/plugin.xml index 6d62ec84b89..58a1379566e 100644 --- a/debug/org.eclipse.cdt.debug.core/plugin.xml +++ b/debug/org.eclipse.cdt.debug.core/plugin.xml @@ -17,7 +17,6 @@ <import plugin="org.eclipse.debug.core"/> <import plugin="org.eclipse.cdt.core"/> <import plugin="org.eclipse.core.runtime.compatibility"/> - <import plugin="org.apache.xerces"/> </requires> diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugUtils.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugUtils.java index 8024d23c2c0..2b05f9a3220 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugUtils.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugUtils.java @@ -7,16 +7,18 @@ package org.eclipse.cdt.debug.core; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.io.OutputStreamWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Iterator; import java.util.List; -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.transform.OutputKeys; +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.cdt.core.model.IFunction; import org.eclipse.cdt.core.model.IMethod; import org.eclipse.cdt.core.model.ITranslationUnit; @@ -270,16 +272,16 @@ public class CDebugUtils * @param lineSeparator line separator * @return the document as a string */ - public static String serializeDocument( Document doc, String lineSeparator ) throws IOException - { - ByteArrayOutputStream s = new ByteArrayOutputStream(); - OutputFormat format = new OutputFormat(); - format.setIndenting( true ); - format.setLineSeparator( lineSeparator ); //$NON-NLS-1$ - Serializer serializer = SerializerFactory.getSerializerFactory( Method.XML ).makeSerializer( new OutputStreamWriter( s, "UTF8" ), format ); //$NON-NLS-1$ - serializer.asDOMSerializer().serialize( doc ); - return s.toString( "UTF8" ); //$NON-NLS-1$ - } +// public static String serializeDocument( Document doc, String lineSeparator ) throws IOException +// { +// ByteArrayOutputStream s = new ByteArrayOutputStream(); +// OutputFormat format = new OutputFormat(); +// format.setIndenting( true ); +// format.setLineSeparator( lineSeparator ); //$NON-NLS-1$ +// Serializer serializer = SerializerFactory.getSerializerFactory( Method.XML ).makeSerializer( new OutputStreamWriter( s, "UTF8" ), format ); //$NON-NLS-1$ +// serializer.asDOMSerializer().serialize( doc ); +// return s.toString( "UTF8" ); //$NON-NLS-1$ +// } /** * Serializes a XML document into a string - encoded in UTF8 format, @@ -288,15 +290,17 @@ public class CDebugUtils * @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 IOException, TransformerException { 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" ), format ); //$NON-NLS-1$ - serializer.asDOMSerializer().serialize( doc ); - return s.toString( "UTF8" ); //$NON-NLS-1$ + TransformerFactory factory = TransformerFactory.newInstance(); + Transformer transformer = factory.newTransformer(); + transformer.setOutputProperty( OutputKeys.METHOD, "xml" ); //$NON-NLS-1$ + transformer.setOutputProperty( OutputKeys.INDENT, "yes" ); //$NON-NLS-1$ + DOMSource source = new DOMSource( doc ); + StreamResult outputTarget = new StreamResult( s ); + transformer.transform( source, outputTarget ); + return s.toString( "UTF8" ); //$NON-NLS-1$ } diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CDirectorySourceLocation.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CDirectorySourceLocation.java index a3ad974f815..7717fe82b42 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CDirectorySourceLocation.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CDirectorySourceLocation.java @@ -18,8 +18,8 @@ import java.util.List; 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.cdt.core.resources.FileStorage; import org.eclipse.cdt.debug.core.CDebugCorePlugin; import org.eclipse.cdt.debug.core.CDebugUtils; @@ -293,21 +293,32 @@ public class CDirectorySourceLocation implements IDirectorySourceLocation */ public String getMemento() throws CoreException { - Document doc = new DocumentImpl(); - Element node = doc.createElement( ELEMENT_NAME ); - doc.appendChild( node ); - node.setAttribute( ATTR_DIRECTORY, getDirectory().toOSString() ); - if ( getAssociation() != null ) - node.setAttribute( ATTR_ASSOCIATION, getAssociation().toOSString() ); - node.setAttribute( ATTR_SEARCH_SUBFOLDERS, new Boolean( searchSubfolders() ).toString() ); - try + Document document = null; + Throwable ex = null; + try { - return CDebugUtils.serializeDocument( doc, " " ); //$NON-NLS-1$ - } + document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); + Element node = document.createElement( ELEMENT_NAME ); + document.appendChild( node ); + node.setAttribute( ATTR_DIRECTORY, getDirectory().toOSString() ); + if ( getAssociation() != null ) + node.setAttribute( ATTR_ASSOCIATION, getAssociation().toOSString() ); + node.setAttribute( ATTR_SEARCH_SUBFOLDERS, new Boolean( searchSubfolders() ).toString() ); + return CDebugUtils.serializeDocument( document ); + } + catch( ParserConfigurationException e ) + { + ex = e; + } catch( IOException e ) { - abort( MessageFormat.format( CDebugCorePlugin.getResourceString("internal.core.sourcelookup.CDirectorySourceLocation.Unable_to_create_memento"), new String[] { getDirectory().toOSString() } ), e ); //$NON-NLS-1$ + ex = e; + } + catch( TransformerException e ) + { + ex = e; } + abort( MessageFormat.format( CDebugCorePlugin.getResourceString( "internal.core.sourcelookup.CDirectorySourceLocation.Unable_to_create_memento" ), new String[] { getDirectory().toOSString() } ), ex ); //$NON-NLS-1$ // execution will not reach here return null; } diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CProjectSourceLocation.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CProjectSourceLocation.java index 0b36188c1bd..8ebc98fee80 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CProjectSourceLocation.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CProjectSourceLocation.java @@ -15,8 +15,8 @@ import java.util.LinkedList; 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.cdt.debug.core.CDebugCorePlugin; import org.eclipse.cdt.debug.core.CDebugUtils; import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation; @@ -226,19 +226,30 @@ public class CProjectSourceLocation implements IProjectSourceLocation */ public String getMemento() throws CoreException { - Document doc = new DocumentImpl(); - Element node = doc.createElement( ELEMENT_NAME ); - doc.appendChild( node ); - node.setAttribute( ATTR_PROJECT, getProject().getName() ); - node.setAttribute( ATTR_GENERIC, new Boolean( isGeneric() ).toString() ); - try + Document document = null; + Throwable ex = null; + try { - return CDebugUtils.serializeDocument( doc, " " ); //$NON-NLS-1$ - } + document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); + Element node = document.createElement( ELEMENT_NAME ); + document.appendChild( node ); + node.setAttribute( ATTR_PROJECT, getProject().getName() ); + node.setAttribute( ATTR_GENERIC, new Boolean( isGeneric() ).toString() ); + return CDebugUtils.serializeDocument( document ); + } + catch( ParserConfigurationException e ) + { + ex = e; + } catch( IOException e ) { - abort( CDebugCorePlugin.getFormattedString("internal.core.sourcelookup.CProjectSourceLocation.Unable_to_create_memento_for_src_location", new String[] { getProject().getName() } ), e ); //$NON-NLS-1$ + ex = e; + } + catch( TransformerException e ) + { + ex = e; } + abort( CDebugCorePlugin.getFormattedString( "internal.core.sourcelookup.CProjectSourceLocation.Unable_to_create_memento_for_src_location", new String[] { getProject().getName() } ), ex ); //$NON-NLS-1$ // execution will not reach here return null; } diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceLocator.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceLocator.java index d44ff2fd681..033606e2c7d 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceLocator.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceLocator.java @@ -19,8 +19,8 @@ import java.util.List; 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.cdt.debug.core.CDebugCorePlugin; import org.eclipse.cdt.debug.core.CDebugUtils; import org.eclipse.cdt.debug.core.model.IStackFrameInfo; @@ -291,22 +291,32 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato */ public String getMemento() throws CoreException { - Document doc = new DocumentImpl(); - Element node = doc.createElement( SOURCE_LOCATOR_NAME ); - doc.appendChild( node ); - - ICSourceLocation[] locations = getSourceLocations(); - saveDisabledGenericSourceLocations( locations, doc, node ); - saveAdditionalSourceLocations( locations, doc, node ); - node.setAttribute( ATTR_DUPLICATE_FILES, new Boolean( searchForDuplicateFiles() ).toString() ); - try + Document document = null; + Throwable ex = null; + try { - return CDebugUtils.serializeDocument( doc, " " ); //$NON-NLS-1$ - } + document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); + Element node = document.createElement( SOURCE_LOCATOR_NAME ); + document.appendChild( node ); + ICSourceLocation[] locations = getSourceLocations(); + saveDisabledGenericSourceLocations( locations, document, node ); + saveAdditionalSourceLocations( locations, document, node ); + node.setAttribute( ATTR_DUPLICATE_FILES, new Boolean( searchForDuplicateFiles() ).toString() ); + return CDebugUtils.serializeDocument( document ); + } + catch( ParserConfigurationException e ) + { + ex = e; + } catch( IOException e ) { - abort( CDebugCorePlugin.getResourceString("internal.core.sourcelookup.CSourceLocator.Unable_to_create_memento"), e ); //$NON-NLS-1$ + ex = e; + } + catch( TransformerException e ) + { + ex = e; } + abort( CDebugCorePlugin.getResourceString( "internal.core.sourcelookup.CSourceLocator.Unable_to_create_memento" ), ex ); //$NON-NLS-1$ // execution will not reach here return null; } @@ -370,7 +380,7 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato abort( CDebugCorePlugin.getResourceString("internal.core.sourcelookup.CSourceLocator.Exception_initializing_src_locator"), ex ); //$NON-NLS-1$ } - private void removeDisabledLocations( Element root, List sourceLocations ) throws CoreException + private void removeDisabledLocations( Element root, List sourceLocations ) { NodeList list = root.getChildNodes(); int length = list.getLength(); diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/SourceUtils.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/SourceUtils.java index a26fbee65a2..523e41a2679 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/SourceUtils.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/SourceUtils.java @@ -15,8 +15,8 @@ import java.util.List; 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.cdt.debug.core.CDebugCorePlugin; import org.eclipse.cdt.debug.core.CDebugUtils; import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation; @@ -44,19 +44,29 @@ public class SourceUtils public static String getCommonSourceLocationsMemento( ICSourceLocation[] locations ) { - Document doc = new DocumentImpl(); - Element node = doc.createElement( NAME_COMMON_SOURCE_LOCATIONS ); - doc.appendChild( node ); - - saveSourceLocations( doc, node, locations ); - try + Document document = null; + Throwable ex = null; + try { - return CDebugUtils.serializeDocument( doc, " " ); //$NON-NLS-1$ - } + document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); + Element element = document.createElement( NAME_COMMON_SOURCE_LOCATIONS ); + document.appendChild( element ); + saveSourceLocations( document, element, locations ); + return CDebugUtils.serializeDocument( document ); + } + catch( ParserConfigurationException e ) + { + ex = e; + } catch( IOException e ) { - CDebugCorePlugin.log( new Status( IStatus.ERROR, CDebugCorePlugin.getUniqueIdentifier(), 0, "Error saving common source settings.", e ) ); //$NON-NLS-1$ + ex = e; + } + catch( TransformerException e ) + { + ex = e; } + CDebugCorePlugin.log( new Status( IStatus.ERROR, CDebugCorePlugin.getUniqueIdentifier(), 0, "Error saving common source settings.", ex ) ); //$NON-NLS-1$ return null; } diff --git a/debug/org.eclipse.cdt.debug.ui/ChangeLog b/debug/org.eclipse.cdt.debug.ui/ChangeLog index 68a06e4ce50..bf2c5f85061 100644 --- a/debug/org.eclipse.cdt.debug.ui/ChangeLog +++ b/debug/org.eclipse.cdt.debug.ui/ChangeLog @@ -1,4 +1,9 @@ 2004-04-02 Mikhail Khodjaiants
+ Removed dependency to xerces.
+ * DefaultSourceLocator.java
+ * plugin.xml
+
+2004-04-02 Mikhail Khodjaiants
Fix for bug 57160: Don't override Debug perspective's "autoClose" behavior.
* plugin.xml
diff --git a/debug/org.eclipse.cdt.debug.ui/plugin.xml b/debug/org.eclipse.cdt.debug.ui/plugin.xml index 04148dd0db3..4189cffd1e0 100644 --- a/debug/org.eclipse.cdt.debug.ui/plugin.xml +++ b/debug/org.eclipse.cdt.debug.ui/plugin.xml @@ -24,7 +24,6 @@ <import plugin="org.eclipse.cdt.debug.core"/> <import plugin="org.eclipse.cdt.ui"/> <import plugin="org.eclipse.cdt.core"/> - <import plugin="org.apache.xerces"/> <import plugin="org.eclipse.core.runtime.compatibility"/> </requires> @@ -1247,7 +1246,7 @@ contextId="org.eclipse.cdt.debug.ui.debugging"> </contextViewBinding> <contextViewBinding - viewId="org.eclipse.debug.ui.RegistersView" + viewId="org.eclipse.debug.ui.RegisterView" contextId="org.eclipse.cdt.debug.ui.debugging"> </contextViewBinding> </extension> diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/DefaultSourceLocator.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/DefaultSourceLocator.java index 72361f0adbb..93509fadeba 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/DefaultSourceLocator.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/DefaultSourceLocator.java @@ -15,8 +15,8 @@ import java.util.List; 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.cdt.core.resources.FileStorage; import org.eclipse.cdt.debug.core.CDebugUtils; import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; @@ -151,24 +151,34 @@ public class DefaultSourceLocator implements IPersistableSourceLocator, IAdaptab { if ( getCSourceLocator() != null ) { - Document doc = new DocumentImpl(); - Element node = doc.createElement( ELEMENT_NAME ); - doc.appendChild( node ); - node.setAttribute( ATTR_PROJECT, getCSourceLocator().getProject().getName() ); - - IPersistableSourceLocator psl = getPersistableSourceLocator(); - if ( psl != null ) + Document document = null; + Throwable ex = null; + try { - node.setAttribute( ATTR_MEMENTO, psl.getMemento() ); - } - try + document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); + Element element = document.createElement( ELEMENT_NAME ); + document.appendChild( element ); + element.setAttribute( ATTR_PROJECT, getCSourceLocator().getProject().getName() ); + IPersistableSourceLocator psl = getPersistableSourceLocator(); + if ( psl != null ) + { + element.setAttribute( ATTR_MEMENTO, psl.getMemento() ); + } + return CDebugUtils.serializeDocument( document ); + } + catch( ParserConfigurationException e ) { - return CDebugUtils.serializeDocument( doc, " " ); //$NON-NLS-1$ - } + ex = e; + } catch( IOException e ) { - abort( CDebugUIPlugin.getResourceString("ui.sourcelookup.DefaultSourceLocator.Unable_to_create_memento_for_src_location"), e ); //$NON-NLS-1$ + ex = e; + } + catch( TransformerException e ) + { + ex = e; } + abort( CDebugUIPlugin.getResourceString( "ui.sourcelookup.DefaultSourceLocator.Unable_to_create_memento_for_src_location" ), ex ); //$NON-NLS-1$ } return null; } |