mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-25 18:05:33 +02:00
Removed dependency to xerces.
This commit is contained in:
parent
2288121f9b
commit
15a02c374e
10 changed files with 153 additions and 85 deletions
|
@ -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.
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
||||
|
|
|
@ -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$
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
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
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue