diff options
author | nick | 2002-05-22 17:54:57 +0000 |
---|---|---|
committer | nick | 2002-05-22 17:54:57 +0000 |
commit | 7ca671d9a5efd6411188681800fc305d47e241cf (patch) | |
tree | 6e348ff2d7d2c507e4c0d8440a060cae38d18d12 | |
parent | 83c46f3552d4e35676ae98311ffcbc9996792786 (diff) | |
download | eclipse.platform.debug-7ca671d9a5efd6411188681800fc305d47e241cf.tar.gz eclipse.platform.debug-7ca671d9a5efd6411188681800fc305d47e241cf.tar.xz eclipse.platform.debug-7ca671d9a5efd6411188681800fc305d47e241cf.zip |
16587
4 files changed, 51 insertions, 16 deletions
diff --git a/org.eclipse.ui.externaltools/.classpath b/org.eclipse.ui.externaltools/.classpath index c54661a86..7103b9205 100644 --- a/org.eclipse.ui.externaltools/.classpath +++ b/org.eclipse.ui.externaltools/.classpath @@ -1,13 +1,14 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path="External Tools"/> - <classpathentry kind="src" path="Ant Builder"/> - <classpathentry kind="var" path="JRE_LIB" rootpath="JRE_SRCROOT" sourcepath="JRE_SRC"/> - <classpathentry kind="src" path="/org.apache.ant"/> - <classpathentry kind="src" path="/org.eclipse.ant.core"/> - <classpathentry kind="src" path="/org.eclipse.core.resources"/> - <classpathentry kind="src" path="/org.eclipse.ui"/> - <classpathentry kind="src" path="/org.eclipse.core.runtime"/> - <classpathentry kind="src" path="/org.eclipse.core.boot"/> - <classpathentry kind="output" path="bin"/> -</classpath> +<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="External Tools"/>
+ <classpathentry kind="src" path="Ant Builder"/>
+ <classpathentry kind="var" path="JRE_LIB" rootpath="JRE_SRCROOT" sourcepath="JRE_SRC"/>
+ <classpathentry kind="src" path="/org.apache.ant"/>
+ <classpathentry kind="src" path="/org.eclipse.ant.core"/>
+ <classpathentry kind="src" path="/org.eclipse.core.resources"/>
+ <classpathentry kind="src" path="/org.eclipse.ui"/>
+ <classpathentry kind="src" path="/org.eclipse.core.runtime"/>
+ <classpathentry kind="src" path="/org.eclipse.core.boot"/>
+ <classpathentry kind="src" path="/org.apache.xerces"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.eclipse.ui.externaltools/.project b/org.eclipse.ui.externaltools/.project index b525c11d5..55752c3e0 100644 --- a/org.eclipse.ui.externaltools/.project +++ b/org.eclipse.ui.externaltools/.project @@ -4,6 +4,7 @@ <comment></comment>
<projects>
<project>org.apache.ant</project>
+ <project>org.apache.xerces</project>
<project>org.eclipse.ant.core</project>
<project>org.eclipse.core.boot</project>
<project>org.eclipse.core.resources</project>
diff --git a/org.eclipse.ui.externaltools/External Tools/org/eclipse/ui/externaltools/internal/core/AntUtil.java b/org.eclipse.ui.externaltools/External Tools/org/eclipse/ui/externaltools/internal/core/AntUtil.java index 3a2cd9a2f..a2b467ab8 100644 --- a/org.eclipse.ui.externaltools/External Tools/org/eclipse/ui/externaltools/internal/core/AntUtil.java +++ b/org.eclipse.ui.externaltools/External Tools/org/eclipse/ui/externaltools/internal/core/AntUtil.java @@ -11,8 +11,14 @@ Contributors: **********************************************************************/ import java.io.*; -import org.eclipse.core.runtime.*; -import org.eclipse.ui.*; +import javax.xml.parsers.*; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.ui.IMemento; +import org.eclipse.ui.XMLMemento; +import org.w3c.dom.*; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; /** * General utility class dealing with Ant files @@ -48,7 +54,7 @@ public final class AntUtil { private static IMemento getMemento(IPath path) { try { Reader reader = new FileReader(path.toFile()); - return XMLMemento.createReadRoot(reader); + return createReadRoot(reader); } catch (FileNotFoundException e) { ExternalToolsPlugin.getDefault().log("Error: Ant file not found.", e); // $NON-NLS-1$ return null; @@ -56,6 +62,32 @@ public final class AntUtil { } /** + * Creates a <code>Document</code> from the <code>Reader</code> + * and returns a root memento for reading the document. + * + * @param reader the reader used to create the memento's document + * @return the root memento for reading the document + */ + private static XMLMemento createReadRoot(Reader reader) { + Document document = null; + try { + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + DocumentBuilder parser = factory.newDocumentBuilder(); + document = parser.parse(new InputSource(reader)); + NodeList list = document.getChildNodes(); + for(int i=0; i < list.getLength(); i++) { + Node node = list.item(i); + if (node instanceof Element) + return new XMLMemento(document, (Element) node); + } + } catch (ParserConfigurationException e) { + } catch (IOException e) { + } catch (SAXException e) { + } + return null; + } + + /** * Returns the list of targets of the Ant file represented by the * supplied IMemento, or <code>null</code> if the memento is null or * does not represent a valid Ant file. diff --git a/org.eclipse.ui.externaltools/plugin.xml b/org.eclipse.ui.externaltools/plugin.xml index ddba4eba5..f597efa90 100644 --- a/org.eclipse.ui.externaltools/plugin.xml +++ b/org.eclipse.ui.externaltools/plugin.xml @@ -13,6 +13,7 @@ </runtime> <requires> <import plugin="org.apache.ant"/> + <import plugin="org.apache.xerces"/> <import plugin="org.eclipse.ant.core"/> <import plugin="org.eclipse.core.resources"/> <import plugin="org.eclipse.ui"/> |