to DOM elements allowing easier manipulation of the XML and better editing of Ant projects. NB: The code currently requires the Sun JAXP library (which Ant needs anyway). git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268166 13f79535-47bb-0310-9956-ffa450edef68master
@@ -1,3 +1,14 @@ | |||
2000-11-09 Simeon H.K. Fitch <simeon@fitch.net> | |||
* org/apache/tools/ant/gui/ProjectProxy.java: Started rework of | |||
project data model, using elements from the XML parser directly | |||
through the new Ant Construction Set package. | |||
2000-11-08 Simeon H.K. Fitch <simeon@fitch.net> | |||
* org/apache/tools/ant/gui/About.java: Useless tweaking inspired | |||
by procrastination. | |||
2000-11-05 Simeon H.K. Fitch <simeon@fitch.net> | |||
* org/apache/tools/ant/gui/LogLevelEnum.java: Added log level | |||
@@ -15,11 +15,14 @@ | |||
<property name="version" value="0.1"/> | |||
<property name="src.dir" value="."/> | |||
<!-- XXX Yuck. Need to fix this with something better --> | |||
<property name="build.dir" value="../../../build/antidote"/> | |||
<property name="lib.dir" value="${build.dir}/lib"/> | |||
<property name="build.classes" value="${build.dir}/classes"/> | |||
<property name="build.javadocs" value="${build.dir}/javadocs"/> | |||
<property name="manifest" value="${src.dir}/etc/manifest"/> | |||
<!-- XXX Yuck. Need to fix this with something better --> | |||
<property name="ant.jar" value="${build.dir}/../ant/lib/ant.jar"/> | |||
<path id="classpath"> | |||
</path> | |||
@@ -114,7 +117,7 @@ | |||
<jvmarg value="-Djava.compiler=NONE"/> | |||
<classpath> | |||
<pathelement location="${build.classes}"/> | |||
<pathelement location="${ant.home}/lib/ant.jar"/> | |||
<pathelement location="${ant.jar}"/> | |||
</classpath> | |||
</java> | |||
</target> | |||
@@ -99,9 +99,17 @@ public class About extends JDialog { | |||
// presented nicely in box. | |||
contributors = props.getProperty("CONTRIBUTORS", "??"); | |||
StringBuffer buf = new StringBuffer(); | |||
StringTokenizer tok = new StringTokenizer(contributors, ","); | |||
while(tok.hasMoreTokens()) { | |||
String name = tok.nextToken(); | |||
buf.append(name); | |||
buf.append("<BR>\n"); | |||
} | |||
String message = context.getResources().getMessage( | |||
getClass(), "message", | |||
new Object[] { version, date, contributors }); | |||
new Object[] { version, date, buf.toString() }); | |||
String title = context.getResources().getString( | |||
getClass(), "title"); | |||
@@ -118,6 +126,9 @@ public class About extends JDialog { | |||
p.add(ok); | |||
getContentPane().add(BorderLayout.SOUTH, p); | |||
getRootPane().setDefaultButton(ok); | |||
// Just go ahead and show it... | |||
pack(); | |||
WindowUtils.centerWindow(context.getParentFrame(), this); | |||
@@ -0,0 +1,83 @@ | |||
/* | |||
* The Apache Software License, Version 1.1 | |||
* | |||
* Copyright (c) 1999, 2000 The Apache Software Foundation. All rights | |||
* reserved. | |||
* | |||
* Redistribution and use in source and binary forms, with or without | |||
* modification, are permitted provided that the following conditions | |||
* are met: | |||
* | |||
* 1. Redistributions of source code must retain the above copyright | |||
* notice, this list of conditions and the following disclaimer. | |||
* | |||
* 2. Redistributions in binary form must reproduce the above copyright | |||
* notice, this list of conditions and the following disclaimer in | |||
* the documentation and/or other materials provided with the | |||
* distribution. | |||
* | |||
* 3. The end-user documentation included with the redistribution, if | |||
* any, must include the following acknowlegement: | |||
* "This product includes software developed by the | |||
* Apache Software Foundation (http://www.apache.org/)." | |||
* Alternately, this acknowlegement may appear in the software itself, | |||
* if and wherever such third-party acknowlegements normally appear. | |||
* | |||
* 4. The names "The Jakarta Project", "Tomcat", and "Apache Software | |||
* Foundation" must not be used to endorse or promote products derived | |||
* from this software without prior written permission. For written | |||
* permission, please contact apache@apache.org. | |||
* | |||
* 5. Products derived from this software may not be called "Apache" | |||
* nor may "Apache" appear in their names without prior written | |||
* permission of the Apache Group. | |||
* | |||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED | |||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR | |||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | |||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | |||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||
* SUCH DAMAGE. | |||
* ==================================================================== | |||
* | |||
* This software consists of voluntary contributions made by many | |||
* individuals on behalf of the Apache Software Foundation. For more | |||
* information on the Apache Software Foundation, please see | |||
* <http://www.apache.org/>. | |||
*/ | |||
package org.apache.tools.ant.gui; | |||
import org.apache.tools.ant.gui.acs.ACSElement; | |||
import javax.swing.tree.DefaultTreeCellRenderer; | |||
import javax.swing.JTree; | |||
import java.awt.Component; | |||
/** | |||
* Cell renderer for displaying the Ant XML file in a JTree. | |||
* | |||
* @version $Revision$ | |||
* @author Simeon Fitch | |||
*/ | |||
public class AntTreeCellRenderer extends DefaultTreeCellRenderer { | |||
public Component getTreeCellRendererComponent(JTree tree, | |||
Object value, | |||
boolean sel, | |||
boolean expanded, | |||
boolean leaf, | |||
int row, | |||
boolean hasFocus) { | |||
super.getTreeCellRendererComponent(tree, value, sel, expanded, | |||
leaf, row, hasFocus); | |||
if(value instanceof ACSElement) { | |||
setText(((ACSElement)value).getDisplayName()); | |||
} | |||
return this; | |||
} | |||
} |
@@ -82,6 +82,7 @@ class ProjectNavigator extends AntEditor { | |||
_tree = new JTree(); | |||
_tree.setModel(null); | |||
_tree.setCellRenderer(new AntTreeCellRenderer()); | |||
JScrollPane scroller = new JScrollPane(_tree); | |||
add(scroller); | |||
@@ -54,6 +54,7 @@ | |||
package org.apache.tools.ant.gui; | |||
import org.apache.tools.ant.*; | |||
import org.apache.tools.ant.gui.event.*; | |||
import org.apache.tools.ant.gui.acs.*; | |||
import java.io.File; | |||
import java.io.IOException; | |||
import javax.swing.tree.TreeModel; | |||
@@ -80,7 +81,7 @@ public class ProjectProxy { | |||
/** The file where the project was last saved. */ | |||
private File _file = null; | |||
/** The real Ant Project instance. */ | |||
private Project _project = null; | |||
private ACSProjectElement _project = null; | |||
/** The current thread executing a build. */ | |||
private Thread _buildThread = null; | |||
/** The selection model for selected targets. */ | |||
@@ -102,23 +103,9 @@ public class ProjectProxy { | |||
* | |||
*/ | |||
private void loadProject() throws IOException { | |||
_project = new Project(); | |||
_project = ACSFactory.getInstance().load(_file); | |||
_selections = new TargetSelectionModel(); | |||
_selections.addTreeSelectionListener(new SelectionForwarder()); | |||
synchronized(_project) { | |||
_project.init(); | |||
// XXX there is a bunch of stuff in the class | |||
// org.apache.tools.ant.Main that needs to be | |||
// abstracted out so that it doesn't have to be | |||
// replicated here. | |||
// XXX need to provide a way to pass in externally | |||
// defined properties. Perhaps define an external | |||
// Antidote properties file. | |||
_project.setUserProperty("ant.file" , _file.getAbsolutePath()); | |||
ProjectHelper.configureProject(_project, _file); | |||
} | |||
} | |||
/** | |||
@@ -137,9 +124,21 @@ public class ProjectProxy { | |||
* | |||
*/ | |||
public void build() throws BuildException { | |||
if(_project == null) return; | |||
Project project = new Project(); | |||
project.init(); | |||
// XXX there is a bunch of stuff in the class | |||
// org.apache.tools.ant.Main that needs to be | |||
// abstracted out so that it doesn't have to be | |||
// replicated here. | |||
// XXX need to provide a way to pass in externally | |||
// defined properties. Perhaps define an external | |||
// Antidote properties file. | |||
project.setUserProperty("ant.file" , _file.getAbsolutePath()); | |||
ProjectHelper.configureProject(project, _file); | |||
_buildThread = new Thread(new BuildRunner()); | |||
_buildThread = new Thread(new BuildRunner(project)); | |||
_buildThread.start(); | |||
} | |||
@@ -180,75 +179,75 @@ public class ProjectProxy { | |||
* @return Document view on project. | |||
*/ | |||
public Document getDocument() { | |||
if(_project != null) { | |||
// This is what the call should look like | |||
//return new ProjectDocument(_project); | |||
// This is what the call should look like | |||
//return new ProjectDocument(_project); | |||
if(_file != null) { | |||
return new ProjectDocument(_file); | |||
} | |||
return null; | |||
} | |||
/** | |||
* Convenience method for causeing the project to fire a build event. | |||
* Implemented because the corresponding method in the Project class | |||
* is not publically accessible. | |||
* | |||
* @param event Event to fire. | |||
*/ | |||
private void fireBuildEvent(BuildEvent event, BuildEventType type) { | |||
synchronized(_project) { | |||
/** Class for executing the build in a separate thread. */ | |||
private class BuildRunner implements Runnable { | |||
private Project _project = null; | |||
public BuildRunner(Project project) { | |||
_project = project; | |||
} | |||
/** | |||
* Convenience method for causeing the project to fire a build event. | |||
* Implemented because the corresponding method in the Project class | |||
* is not publically accessible. | |||
* | |||
* @param event Event to fire. | |||
*/ | |||
private void fireBuildEvent(BuildEvent event, BuildEventType type) { | |||
Enumeration enum = _project.getBuildListeners().elements(); | |||
while(enum.hasMoreElements()) { | |||
BuildListener l = (BuildListener) enum.nextElement(); | |||
type.fireEvent(event, l); | |||
} | |||
} | |||
} | |||
/** Class for executing the build in a separate thread. */ | |||
private class BuildRunner implements Runnable { | |||
public void run() { | |||
synchronized(_project) { | |||
// Add the build listener for | |||
// dispatching BuildEvent objects to the | |||
// EventBus. | |||
BuildEventForwarder handler = | |||
new BuildEventForwarder(_context); | |||
_project.addBuildListener(handler); | |||
try { | |||
fireBuildEvent(new BuildEvent( | |||
_project), BuildEventType.BUILD_STARTED); | |||
// Generate list of targets to execute. | |||
Target[] targets = _selections.getSelectedTargets(); | |||
Vector targetNames = new Vector(); | |||
if(targets.length == 0) { | |||
targetNames.add(_project.getDefaultTarget()); | |||
} | |||
else { | |||
for(int i = 0; i < targets.length; i++) { | |||
targetNames.add(targets[i].getName()); | |||
} | |||
} | |||
// Execute build on selected targets. XXX It would be | |||
// nice if the Project API supported passing in target | |||
// objects rather than String names. | |||
_project.executeTargets(targetNames); | |||
} | |||
catch(BuildException ex) { | |||
BuildEvent errorEvent = new BuildEvent(_project); | |||
errorEvent.setException(ex); | |||
errorEvent.setMessage(ex.getMessage(), Project.MSG_ERR); | |||
fireBuildEvent(errorEvent, BuildEventType.MESSAGE_LOGGED); | |||
// Add the build listener for | |||
// dispatching BuildEvent objects to the | |||
// EventBus. | |||
BuildEventForwarder handler = | |||
new BuildEventForwarder(_context); | |||
_project.addBuildListener(handler); | |||
try { | |||
fireBuildEvent(new BuildEvent( | |||
_project), BuildEventType.BUILD_STARTED); | |||
// Generate list of targets to execute. | |||
ACSTargetElement[] targets = _selections.getSelectedTargets(); | |||
Vector targetNames = new Vector(); | |||
if(targets.length == 0) { | |||
targetNames.add(_project.getDefaultTarget()); | |||
} | |||
finally { | |||
fireBuildEvent(new BuildEvent( | |||
_project), BuildEventType.BUILD_FINISHED); | |||
_project.removeBuildListener(handler); | |||
_buildThread = null; | |||
else { | |||
for(int i = 0; i < targets.length; i++) { | |||
targetNames.add(targets[i].getName()); | |||
} | |||
} | |||
// Execute build on selected targets. XXX It would be | |||
// nice if the Project API supported passing in target | |||
// objects rather than String names. | |||
_project.executeTargets(targetNames); | |||
} | |||
catch(BuildException ex) { | |||
BuildEvent errorEvent = new BuildEvent(_project); | |||
errorEvent.setException(ex); | |||
errorEvent.setMessage(ex.getMessage(), Project.MSG_ERR); | |||
fireBuildEvent(errorEvent, BuildEventType.MESSAGE_LOGGED); | |||
} | |||
finally { | |||
fireBuildEvent(new BuildEvent( | |||
_project), BuildEventType.BUILD_FINISHED); | |||
_project.removeBuildListener(handler); | |||
_buildThread = null; | |||
} | |||
} | |||
} | |||
@@ -54,146 +54,18 @@ | |||
package org.apache.tools.ant.gui; | |||
import javax.swing.tree.TreeModel; | |||
import javax.swing.tree.TreePath; | |||
import javax.swing.event.TreeModelListener; | |||
import org.apache.tools.ant.Project; | |||
import org.apache.tools.ant.Target; | |||
import java.util.*; | |||
import javax.swing.tree.DefaultTreeModel; | |||
import org.apache.tools.ant.gui.acs.ACSProjectElement; | |||
/** | |||
* Provides a tree model view of the Project class. | |||
* Provides a tree model view of the Project class. XXX This | |||
* is a major hack right now that needs to be cleaned up. | |||
* | |||
* @version $Revision$ | |||
* @author Simeon H.K. Fitch | |||
*/ | |||
public class ProjectTreeModel implements TreeModel { | |||
private Project _project = null; | |||
private ProjectWrapper _wrapper = null; | |||
// XXX temp doesn't handle dynamic updates. | |||
/** Defines an ordering for the tasks. */ | |||
private List _targetOrdering = new ArrayList(); | |||
public ProjectTreeModel(Project project) { | |||
_project = project; | |||
_wrapper = new ProjectWrapper(); | |||
Enumeration enum = _project.getTargets().keys(); | |||
while(enum.hasMoreElements()) { | |||
_targetOrdering.add(enum.nextElement()); | |||
} | |||
} | |||
/** | |||
* Returns the root of the tree. Returns null only if the tree has | |||
* no nodes. | |||
* | |||
* @return the root of the tree | |||
*/ | |||
public Object getRoot() { | |||
return _wrapper; | |||
} | |||
/** | |||
* Returns the child of <I>parent</I> at index <I>index</I> in the parent's | |||
* child array. <I>parent</I> must be a node previously obtained from | |||
* this data source. This should not return null if <i>index</i> | |||
* is a valid index for <i>parent</i> (that is <i>index</i> >= 0 && | |||
* <i>index</i> < getChildCount(<i>parent</i>)). | |||
* | |||
* @param parent a node in the tree, obtained from this data source | |||
* @return the child of <I>parent</I> at index <I>index</I> | |||
*/ | |||
public Object getChild(Object parent, int index) { | |||
if(parent != _wrapper) return null; | |||
Object name = _targetOrdering.get(index); | |||
return _project.getTargets().get(name); | |||
} | |||
/** | |||
* Returns the number of children of <I>parent</I>. Returns 0 if the node | |||
* is a leaf or if it has no children. <I>parent</I> must be a node | |||
* previously obtained from this data source. | |||
* | |||
* @param parent a node in the tree, obtained from this data source | |||
* @return the number of children of the node <I>parent</I> | |||
*/ | |||
public int getChildCount(Object parent) { | |||
return parent == _wrapper ? _project.getTargets().size() : 0; | |||
} | |||
/** | |||
* Returns true if <I>node</I> is a leaf. It is possible for this method | |||
* to return false even if <I>node</I> has no children. A directory in a | |||
* filesystem, for example, may contain no files; the node representing | |||
* the directory is not a leaf, but it also has no children. | |||
* | |||
* @param node a node in the tree, obtained from this data source | |||
* @return true if <I>node</I> is a leaf | |||
*/ | |||
public boolean isLeaf(Object node) { | |||
return node != _wrapper; | |||
* @author Simeon H.K. Fitch */ | |||
public class ProjectTreeModel extends DefaultTreeModel { | |||
public ProjectTreeModel(ACSProjectElement root) { | |||
super(root); | |||
} | |||
/** | |||
* Messaged when the user has altered the value for the item identified | |||
* by <I>path</I> to <I>newValue</I>. If <I>newValue</I> signifies | |||
* a truly new value the model should post a treeNodesChanged | |||
* event. | |||
* | |||
* @param path path to the node that the user has altered. | |||
* @param newValue the new value from the TreeCellEditor. | |||
*/ | |||
public void valueForPathChanged(TreePath path, Object newValue) { | |||
System.out.println(path); | |||
} | |||
/** | |||
* Returns the index of child in parent. | |||
*/ | |||
public int getIndexOfChild(Object parent, Object child) { | |||
return parent == _project ? | |||
_targetOrdering.indexOf(((Target)child).getName()) : -1; | |||
} | |||
/** | |||
* Adds a listener for the TreeModelEvent posted after the tree changes. | |||
* | |||
* @see #removeTreeModelListener | |||
* @param l the listener to add | |||
*/ | |||
public void addTreeModelListener(TreeModelListener l) { | |||
} | |||
/** | |||
* Removes a listener previously added with <B>addTreeModelListener()</B>. | |||
* | |||
* @see #addTreeModelListener | |||
* @param l the listener to remove | |||
*/ | |||
public void removeTreeModelListener(TreeModelListener l) { | |||
} | |||
/** | |||
* A wrapper around the Project class to provide different | |||
* toString behavior. XXX this is temporary until a custom | |||
* cell renderer is created. | |||
* | |||
*/ | |||
private class ProjectWrapper { | |||
public String toString() { | |||
return _project.getName(); | |||
} | |||
} | |||
} |
@@ -52,7 +52,7 @@ | |||
* <http://www.apache.org/>. | |||
*/ | |||
package org.apache.tools.ant.gui; | |||
import org.apache.tools.ant.Target; | |||
import org.apache.tools.ant.gui.acs.ACSTargetElement; | |||
import org.apache.tools.ant.gui.event.*; | |||
import javax.swing.*; | |||
import java.util.*; | |||
@@ -86,7 +86,9 @@ class PropertyEditor extends AntEditor { | |||
_text.setEditable(false); | |||
_text.setOpaque(false); | |||
add(BorderLayout.CENTER, _text); | |||
JScrollPane scroller = new JScrollPane(_text); | |||
add(BorderLayout.CENTER, scroller); | |||
} | |||
/** | |||
@@ -94,7 +96,7 @@ class PropertyEditor extends AntEditor { | |||
* | |||
* @param targets Targets to display info for. | |||
*/ | |||
private void displayTargetInfo(Target[] targets) { | |||
private void displayTargetInfo(ACSTargetElement[] targets) { | |||
// The text to display. | |||
String text = null; | |||
@@ -130,16 +132,16 @@ class PropertyEditor extends AntEditor { | |||
* @param target Target to generate params for. | |||
* @return Argument list for the formatted message. | |||
*/ | |||
private Object[] getTargetParams(Target target) { | |||
private Object[] getTargetParams(ACSTargetElement target) { | |||
List args = new LinkedList(); | |||
args.add(target.getName()); | |||
args.add(target.getDescription() == null ? | |||
"" : target.getDescription()); | |||
StringBuffer buf = new StringBuffer(); | |||
Enumeration enum = target.getDependencies(); | |||
while(enum.hasMoreElements()) { | |||
buf.append(enum.nextElement()); | |||
if(enum.hasMoreElements()) { | |||
String[] depends = target.getDependencyNames(); | |||
for(int i = 0; i < depends.length; i++) { | |||
buf.append(depends[i]); | |||
if(i < depends.length - 1) { | |||
buf.append(", "); | |||
} | |||
} | |||
@@ -155,7 +157,7 @@ class PropertyEditor extends AntEditor { | |||
* @param target Targets to generate params for. | |||
* @return Argument list for the formatted message. | |||
*/ | |||
private Object[] getTargetParams(Target[] targets) { | |||
private Object[] getTargetParams(ACSTargetElement[] targets) { | |||
List args = new LinkedList(); | |||
StringBuffer buf = new StringBuffer(); | |||
@@ -166,9 +168,9 @@ class PropertyEditor extends AntEditor { | |||
buf.append(", "); | |||
} | |||
Enumeration enum = targets[i].getDependencies(); | |||
while(enum.hasMoreElements()) { | |||
depends.add(enum.nextElement()); | |||
String[] dependNames = targets[i].getDependencyNames(); | |||
for(int j = 0; j < dependNames.length; j++) { | |||
depends.add(dependNames[j]); | |||
} | |||
} | |||
@@ -209,7 +211,7 @@ class PropertyEditor extends AntEditor { | |||
*/ | |||
public void eventPosted(EventObject event) { | |||
TargetSelectionEvent e = (TargetSelectionEvent) event; | |||
Target[] targets = e.getSelectedTargets(); | |||
ACSTargetElement[] targets = e.getSelectedTargets(); | |||
displayTargetInfo(targets); | |||
} | |||
@@ -52,7 +52,7 @@ | |||
* <http://www.apache.org/>. | |||
*/ | |||
package org.apache.tools.ant.gui; | |||
import org.apache.tools.ant.Target; | |||
import org.apache.tools.ant.gui.acs.ACSTargetElement; | |||
import javax.swing.tree.DefaultTreeSelectionModel; | |||
import javax.swing.tree.TreePath; | |||
@@ -79,17 +79,17 @@ class TargetSelectionModel extends DefaultTreeSelectionModel { | |||
* | |||
* @return the currently selected targets. | |||
*/ | |||
public Target[] getSelectedTargets() { | |||
public ACSTargetElement[] getSelectedTargets() { | |||
TreePath[] path = getSelectionPaths(); | |||
List values = new LinkedList(); | |||
for(int i = 0; path != null && i < path.length; i++) { | |||
Object val = path[i].getLastPathComponent(); | |||
if(val instanceof Target) { | |||
if(val instanceof ACSTargetElement) { | |||
values.add(val); | |||
} | |||
} | |||
Target[] retval = new Target[values.size()]; | |||
ACSTargetElement[] retval = new ACSTargetElement[values.size()]; | |||
values.toArray(retval); | |||
return retval; | |||
} | |||
@@ -0,0 +1,73 @@ | |||
/* | |||
* The Apache Software License, Version 1.1 | |||
* | |||
* Copyright (c) 1999, 2000 The Apache Software Foundation. All rights | |||
* reserved. | |||
* | |||
* Redistribution and use in source and binary forms, with or without | |||
* modification, are permitted provided that the following conditions | |||
* are met: | |||
* | |||
* 1. Redistributions of source code must retain the above copyright | |||
* notice, this list of conditions and the following disclaimer. | |||
* | |||
* 2. Redistributions in binary form must reproduce the above copyright | |||
* notice, this list of conditions and the following disclaimer in | |||
* the documentation and/or other materials provided with the | |||
* distribution. | |||
* | |||
* 3. The end-user documentation included with the redistribution, if | |||
* any, must include the following acknowlegement: | |||
* "This product includes software developed by the | |||
* Apache Software Foundation (http://www.apache.org/)." | |||
* Alternately, this acknowlegement may appear in the software itself, | |||
* if and wherever such third-party acknowlegements normally appear. | |||
* | |||
* 4. The names "The Jakarta Project", "Tomcat", and "Apache Software | |||
* Foundation" must not be used to endorse or promote products derived | |||
* from this software without prior written permission. For written | |||
* permission, please contact apache@apache.org. | |||
* | |||
* 5. Products derived from this software may not be called "Apache" | |||
* nor may "Apache" appear in their names without prior written | |||
* permission of the Apache Group. | |||
* | |||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED | |||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR | |||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | |||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | |||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||
* SUCH DAMAGE. | |||
* ==================================================================== | |||
* | |||
* This software consists of voluntary contributions made by many | |||
* individuals on behalf of the Apache Software Foundation. For more | |||
* information on the Apache Software Foundation, please see | |||
* <http://www.apache.org/>. | |||
*/ | |||
package org.apache.tools.ant.gui.acs; | |||
import com.sun.xml.tree.ElementNode; | |||
/** | |||
* Default element used when no other element is specificed. | |||
* | |||
* @version $Revision$ | |||
* @author Simeon Fitch | |||
*/ | |||
public class ACSDefaultElement extends ACSElement { | |||
/** | |||
* Default ctor. | |||
* | |||
*/ | |||
public ACSDefaultElement() { | |||
} | |||
} |
@@ -0,0 +1,191 @@ | |||
/* | |||
* The Apache Software License, Version 1.1 | |||
* | |||
* Copyright (c) 1999, 2000 The Apache Software Foundation. All rights | |||
* reserved. | |||
* | |||
* Redistribution and use in source and binary forms, with or without | |||
* modification, are permitted provided that the following conditions | |||
* are met: | |||
* | |||
* 1. Redistributions of source code must retain the above copyright | |||
* notice, this list of conditions and the following disclaimer. | |||
* | |||
* 2. Redistributions in binary form must reproduce the above copyright | |||
* notice, this list of conditions and the following disclaimer in | |||
* the documentation and/or other materials provided with the | |||
* distribution. | |||
* | |||
* 3. The end-user documentation included with the redistribution, if | |||
* any, must include the following acknowlegement: | |||
* "This product includes software developed by the | |||
* Apache Software Foundation (http://www.apache.org/)." | |||
* Alternately, this acknowlegement may appear in the software itself, | |||
* if and wherever such third-party acknowlegements normally appear. | |||
* | |||
* 4. The names "The Jakarta Project", "Tomcat", and "Apache Software | |||
* Foundation" must not be used to endorse or promote products derived | |||
* from this software without prior written permission. For written | |||
* permission, please contact apache@apache.org. | |||
* | |||
* 5. Products derived from this software may not be called "Apache" | |||
* nor may "Apache" appear in their names without prior written | |||
* permission of the Apache Group. | |||
* | |||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED | |||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR | |||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | |||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | |||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||
* SUCH DAMAGE. | |||
* ==================================================================== | |||
* | |||
* This software consists of voluntary contributions made by many | |||
* individuals on behalf of the Apache Software Foundation. For more | |||
* information on the Apache Software Foundation, please see | |||
* <http://www.apache.org/>. | |||
*/ | |||
package org.apache.tools.ant.gui.acs; | |||
import org.w3c.dom.Node; | |||
import com.sun.xml.tree.ElementNode; | |||
import javax.swing.tree.TreeNode; | |||
import java.util.*; | |||
/** | |||
* Abstract base class for all Ant Construction Set | |||
* elements. Depends on the JAXP XML library from Sun. | |||
* | |||
* @version $Revision$ | |||
* @author Simeon Fitch */ | |||
public abstract class ACSElement extends ElementNode implements TreeNode { | |||
/** Cache of TreeNode only children. */ | |||
private List _treeNodeCache = null; | |||
/** | |||
* Default ctor. | |||
* | |||
*/ | |||
protected ACSElement() { | |||
} | |||
/** | |||
* Get the display name of this. | |||
* | |||
* @return Display name. | |||
*/ | |||
public String getDisplayName() { | |||
return getTagName(); | |||
} | |||
/** | |||
* Get the cache of TreeNode only children. | |||
* | |||
* @return List of TreeNodes that are children. | |||
*/ | |||
private List getCache() { | |||
if(_treeNodeCache == null) { | |||
_treeNodeCache = new ArrayList(); | |||
for(int i = 0; i < getLength(); i++) { | |||
if(item(i) instanceof TreeNode) { | |||
_treeNodeCache.add(item(i)); | |||
} | |||
} | |||
} | |||
return _treeNodeCache; | |||
} | |||
/** | |||
* Returns the child <code>TreeNode</code> at index | |||
* <code>childIndex</code>. | |||
*/ | |||
public TreeNode getChildAt(int childIndex) { | |||
List nodes = getCache(); | |||
return (TreeNode) nodes.get(childIndex); | |||
} | |||
/** | |||
* Returns the number of children <code>TreeNode</code>s the receiver | |||
* contains. | |||
*/ | |||
public int getChildCount() { | |||
List nodes = getCache(); | |||
return nodes.size(); | |||
} | |||
/** | |||
* Returns the parent <code>TreeNode</code> of the receiver. | |||
*/ | |||
public TreeNode getParent() { | |||
return (TreeNode) getParent(); | |||
} | |||
/** | |||
* Returns the index of <code>node</code> in the receivers children. | |||
* If the receiver does not contain <code>node</code>, -1 will be | |||
* returned. | |||
*/ | |||
public int getIndex(TreeNode node) { | |||
List nodes = getCache(); | |||
return nodes.indexOf(node); | |||
} | |||
/** | |||
* Returns true if the receiver allows children. | |||
*/ | |||
public boolean getAllowsChildren() { | |||
return true; | |||
} | |||
/** | |||
* Returns true if the receiver is a leaf. | |||
*/ | |||
public boolean isLeaf() { | |||
List nodes = getCache(); | |||
return nodes.size() <= 0; | |||
} | |||
/** | |||
* Returns the children of the reciever as an Enumeration. | |||
*/ | |||
public Enumeration children() { | |||
return new NodeEnum(); | |||
} | |||
/** Internal iterator for the child nodes. */ | |||
private class NodeEnum implements Enumeration { | |||
/** Current child index. */ | |||
private int _index = 0; | |||
/** | |||
* Determine if there are more elements to visit. | |||
* | |||
* @return True if nextElement() can be called, false otherwise. | |||
*/ | |||
public boolean hasMoreElements() { | |||
List nodes = getCache(); | |||
return _index < nodes.size(); | |||
} | |||
/** | |||
* Get the next element. hasMoreElements() must currently return true. | |||
* | |||
* @return Next element | |||
*/ | |||
public Object nextElement() { | |||
List nodes = getCache(); | |||
return nodes.get(_index++); | |||
} | |||
} | |||
} |
@@ -0,0 +1,164 @@ | |||
/* | |||
* The Apache Software License, Version 1.1 | |||
* | |||
* Copyright (c) 1999, 2000 The Apache Software Foundation. All rights | |||
* reserved. | |||
* | |||
* Redistribution and use in source and binary forms, with or without | |||
* modification, are permitted provided that the following conditions | |||
* are met: | |||
* | |||
* 1. Redistributions of source code must retain the above copyright | |||
* notice, this list of conditions and the following disclaimer. | |||
* | |||
* 2. Redistributions in binary form must reproduce the above copyright | |||
* notice, this list of conditions and the following disclaimer in | |||
* the documentation and/or other materials provided with the | |||
* distribution. | |||
* | |||
* 3. The end-user documentation included with the redistribution, if | |||
* any, must include the following acknowlegement: | |||
* "This product includes software developed by the | |||
* Apache Software Foundation (http://www.apache.org/)." | |||
* Alternately, this acknowlegement may appear in the software itself, | |||
* if and wherever such third-party acknowlegements normally appear. | |||
* | |||
* 4. The names "The Jakarta Project", "Tomcat", and "Apache Software | |||
* Foundation" must not be used to endorse or promote products derived | |||
* from this software without prior written permission. For written | |||
* permission, please contact apache@apache.org. | |||
* | |||
* 5. Products derived from this software may not be called "Apache" | |||
* nor may "Apache" appear in their names without prior written | |||
* permission of the Apache Group. | |||
* | |||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED | |||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR | |||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | |||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | |||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||
* SUCH DAMAGE. | |||
* ==================================================================== | |||
* | |||
* This software consists of voluntary contributions made by many | |||
* individuals on behalf of the Apache Software Foundation. For more | |||
* information on the Apache Software Foundation, please see | |||
* <http://www.apache.org/>. | |||
*/ | |||
package org.apache.tools.ant.gui.acs; | |||
import javax.xml.parsers.*; | |||
import java.io.File; | |||
import java.io.IOException; | |||
import org.w3c.dom.*; | |||
import com.sun.xml.parser.Parser; | |||
import com.sun.xml.tree.SimpleElementFactory; | |||
import com.sun.xml.tree.XmlDocument; | |||
import com.sun.xml.tree.XmlDocumentBuilder; | |||
import java.util.Properties; | |||
import com.sun.xml.parser.Resolver; | |||
/** | |||
* Factory for loading Ant Construction set elements. | |||
* | |||
* @version $Revision$ | |||
* @author Simeon Fitch | |||
*/ | |||
public class ACSFactory { | |||
/** Singleton instance of the factory. */ | |||
private static ACSFactory _instance = null; | |||
/** Element maping. */ | |||
private static final Properties _elementMap = new Properties(); | |||
static { | |||
try { | |||
_elementMap.load(ACSFactory.class. | |||
getResourceAsStream("acs-element.properties")); | |||
} | |||
catch(Throwable ex) { | |||
ex.printStackTrace(); | |||
System.exit(1); | |||
} | |||
} | |||
/** | |||
* Default ctor. | |||
* | |||
*/ | |||
private ACSFactory() { | |||
} | |||
/** | |||
* Load a project from the given XML file. | |||
* XXX fix me. | |||
* | |||
* @param f File to load. | |||
* @return | |||
*/ | |||
public ACSProjectElement load(File f) throws IOException { | |||
XmlDocument doc = null; | |||
try { | |||
SAXParser sax = SAXParserFactory.newInstance().newSAXParser(); | |||
Parser parser = (Parser) sax.getParser(); | |||
XmlDocumentBuilder builder = new XmlDocumentBuilder(); | |||
builder.setIgnoringLexicalInfo(false); | |||
SimpleElementFactory fact = new SimpleElementFactory(); | |||
fact.addMapping(_elementMap, ACSFactory.class.getClassLoader()); | |||
builder.setElementFactory(fact); | |||
parser.setDocumentHandler(builder); | |||
parser.setEntityResolver(new Resolver()); | |||
//parser.setErrorHandler(); | |||
sax.parse(f, null); | |||
doc = builder.getDocument(); | |||
} | |||
catch(Exception ex) { | |||
ex.printStackTrace(); | |||
throw new IOException(ex.getMessage()); | |||
} | |||
return (ACSProjectElement) doc.getDocumentElement(); | |||
} | |||
/** | |||
* Get an instance of the factory. | |||
* | |||
* @return Factory instance. | |||
*/ | |||
public static ACSFactory getInstance() { | |||
if(_instance == null) { | |||
_instance = new ACSFactory(); | |||
} | |||
return _instance; | |||
} | |||
/** | |||
* Test code | |||
* | |||
* @param args XML file to parse. | |||
*/ | |||
public static void main(String[] args) { | |||
try { | |||
ACSFactory f = ACSFactory.getInstance(); | |||
System.out.println(f.load(new File(args[0]))); | |||
} | |||
catch(Exception ex) { | |||
ex.printStackTrace(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,86 @@ | |||
/* | |||
* The Apache Software License, Version 1.1 | |||
* | |||
* Copyright (c) 1999, 2000 The Apache Software Foundation. All rights | |||
* reserved. | |||
* | |||
* Redistribution and use in source and binary forms, with or without | |||
* modification, are permitted provided that the following conditions | |||
* are met: | |||
* | |||
* 1. Redistributions of source code must retain the above copyright | |||
* notice, this list of conditions and the following disclaimer. | |||
* | |||
* 2. Redistributions in binary form must reproduce the above copyright | |||
* notice, this list of conditions and the following disclaimer in | |||
* the documentation and/or other materials provided with the | |||
* distribution. | |||
* | |||
* 3. The end-user documentation included with the redistribution, if | |||
* any, must include the following acknowlegement: | |||
* "This product includes software developed by the | |||
* Apache Software Foundation (http://www.apache.org/)." | |||
* Alternately, this acknowlegement may appear in the software itself, | |||
* if and wherever such third-party acknowlegements normally appear. | |||
* | |||
* 4. The names "The Jakarta Project", "Tomcat", and "Apache Software | |||
* Foundation" must not be used to endorse or promote products derived | |||
* from this software without prior written permission. For written | |||
* permission, please contact apache@apache.org. | |||
* | |||
* 5. Products derived from this software may not be called "Apache" | |||
* nor may "Apache" appear in their names without prior written | |||
* permission of the Apache Group. | |||
* | |||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED | |||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR | |||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | |||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | |||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||
* SUCH DAMAGE. | |||
* ==================================================================== | |||
* | |||
* This software consists of voluntary contributions made by many | |||
* individuals on behalf of the Apache Software Foundation. For more | |||
* information on the Apache Software Foundation, please see | |||
* <http://www.apache.org/>. | |||
*/ | |||
package org.apache.tools.ant.gui.acs; | |||
import com.sun.xml.tree.ElementNode; | |||
/** | |||
* Class representing a project element in the build file. | |||
* | |||
* @version $Revision$ | |||
* @author Simeon Fitch | |||
*/ | |||
public class ACSProjectElement extends ACSElement { | |||
public ACSProjectElement() { | |||
} | |||
/** | |||
* Get the project name. | |||
* | |||
* @return Project name. | |||
*/ | |||
public String getName() { | |||
return getAttribute("name"); | |||
} | |||
/** | |||
* Get the display name. | |||
* | |||
* @return Display name. | |||
*/ | |||
public String getDisplayName() { | |||
return getTagName() + ": " + getName(); | |||
} | |||
} |
@@ -0,0 +1,118 @@ | |||
/* | |||
* The Apache Software License, Version 1.1 | |||
* | |||
* Copyright (c) 1999, 2000 The Apache Software Foundation. All rights | |||
* reserved. | |||
* | |||
* Redistribution and use in source and binary forms, with or without | |||
* modification, are permitted provided that the following conditions | |||
* are met: | |||
* | |||
* 1. Redistributions of source code must retain the above copyright | |||
* notice, this list of conditions and the following disclaimer. | |||
* | |||
* 2. Redistributions in binary form must reproduce the above copyright | |||
* notice, this list of conditions and the following disclaimer in | |||
* the documentation and/or other materials provided with the | |||
* distribution. | |||
* | |||
* 3. The end-user documentation included with the redistribution, if | |||
* any, must include the following acknowlegement: | |||
* "This product includes software developed by the | |||
* Apache Software Foundation (http://www.apache.org/)." | |||
* Alternately, this acknowlegement may appear in the software itself, | |||
* if and wherever such third-party acknowlegements normally appear. | |||
* | |||
* 4. The names "The Jakarta Project", "Tomcat", and "Apache Software | |||
* Foundation" must not be used to endorse or promote products derived | |||
* from this software without prior written permission. For written | |||
* permission, please contact apache@apache.org. | |||
* | |||
* 5. Products derived from this software may not be called "Apache" | |||
* nor may "Apache" appear in their names without prior written | |||
* permission of the Apache Group. | |||
* | |||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED | |||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR | |||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | |||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | |||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||
* SUCH DAMAGE. | |||
* ==================================================================== | |||
* | |||
* This software consists of voluntary contributions made by many | |||
* individuals on behalf of the Apache Software Foundation. For more | |||
* information on the Apache Software Foundation, please see | |||
* <http://www.apache.org/>. | |||
*/ | |||
package org.apache.tools.ant.gui.acs; | |||
import com.sun.xml.tree.ElementNode; | |||
import java.util.StringTokenizer; | |||
/** | |||
* Class representing a build target. | |||
* | |||
* @version $Revision$ | |||
* @author Simeon Fitch | |||
*/ | |||
public class ACSTargetElement extends ACSElement { | |||
/** | |||
* Default ctor. | |||
* | |||
*/ | |||
public ACSTargetElement() { | |||
} | |||
/** | |||
* Get the target name. | |||
* | |||
* @return Target name. | |||
*/ | |||
public String getName() { | |||
return getAttribute("name"); | |||
} | |||
/** | |||
* Get the long description of the target. | |||
* | |||
* @return Target description. | |||
*/ | |||
public String getDescription() { | |||
return getAttribute("description"); | |||
} | |||
/** | |||
* Set the set of dependency names. | |||
* | |||
* @return Dependency names. | |||
*/ | |||
public String[] getDependencyNames() { | |||
String depends = getAttribute("depends"); | |||
StringTokenizer tok = new StringTokenizer(depends,","); | |||
String[] retval = new String[tok.countTokens()]; | |||
for(int i = 0; i < retval.length; i++) { | |||
retval[i] = tok.nextToken(); | |||
} | |||
return retval; | |||
} | |||
/** | |||
* Get the display name. | |||
* | |||
* @return Display name. | |||
*/ | |||
public String getDisplayName() { | |||
return getTagName() + ": " + getName(); | |||
} | |||
} |
@@ -0,0 +1,10 @@ | |||
# | |||
# Property file mapping DOM nodes to Java class names. | |||
# | |||
# The default element | |||
*Element=org.apache.tools.ant.gui.acs.ACSDefaultElement | |||
# Specific elements. | |||
project=org.apache.tools.ant.gui.acs.ACSProjectElement | |||
target=org.apache.tools.ant.gui.acs.ACSTargetElement |
@@ -0,0 +1,9 @@ | |||
<HTML><BODY> <H1>Ant Construction Set</H1> | |||
<P>This package contains the tools for constructing and manipulating an Ant | |||
build file</P> | |||
<P><B>NB</B>: Requires the <A HREF="http://java.sun.com/xml">Java API for XML | |||
Parsing</A> from Sun.</P> | |||
</BODY> | |||
</HTML> |
@@ -54,6 +54,7 @@ q * | |||
package org.apache.tools.ant.gui.command; | |||
import org.apache.tools.ant.gui.AppContext; | |||
import org.apache.tools.ant.gui.ProjectProxy; | |||
import org.apache.tools.ant.gui.event.ErrorEvent; | |||
/** | |||
* Starts an Ant build. | |||
@@ -84,7 +85,12 @@ public class BuildCmd implements Command { | |||
public void execute() { | |||
ProjectProxy project = _context.getProject(); | |||
if(project != null) { | |||
project.build(); | |||
try { | |||
project.build(); | |||
} | |||
catch(Throwable ex) { | |||
_context.getEventBus().postEvent(new ErrorEvent(_context, ex)); | |||
} | |||
} | |||
} | |||
} |
@@ -52,7 +52,7 @@ | |||
* <http://www.apache.org/>. | |||
*/ | |||
package org.apache.tools.ant.gui.event; | |||
import org.apache.tools.ant.Target; | |||
import org.apache.tools.ant.gui.acs.ACSTargetElement; | |||
import org.apache.tools.ant.gui.command.Command; | |||
import org.apache.tools.ant.gui.command.NoOpCmd; | |||
import org.apache.tools.ant.gui.AppContext; | |||
@@ -66,14 +66,15 @@ import org.apache.tools.ant.gui.AppContext; | |||
public class TargetSelectionEvent extends AntEvent { | |||
/** New set of selected targets. */ | |||
private Target[] _selectedTargets = null; | |||
private ACSTargetElement[] _selectedTargets = null; | |||
/** | |||
* Standard ctor. | |||
* | |||
* @param context application context. | |||
*/ | |||
public TargetSelectionEvent(AppContext context, Target[] selectedTargets) { | |||
public TargetSelectionEvent(AppContext context, | |||
ACSTargetElement[] selectedTargets) { | |||
super(context); | |||
_selectedTargets = selectedTargets; | |||
} | |||
@@ -83,7 +84,7 @@ public class TargetSelectionEvent extends AntEvent { | |||
* | |||
* @return selected target set. | |||
*/ | |||
public Target[] getSelectedTargets() { | |||
public ACSTargetElement[] getSelectedTargets() { | |||
return _selectedTargets; | |||
} | |||
@@ -19,17 +19,17 @@ org.apache.tools.ant.gui.SourceEditor.name=Source | |||
org.apache.tools.ant.gui.PropertyEditor.name=Target Info | |||
org.apache.tools.ant.gui.PropertyEditor.noTargets=No targets selected. | |||
org.apache.tools.ant.gui.PropertyEditor.oneTarget=\ | |||
<html><table>\ | |||
<tr><td align="right"><b>Name</b>:</td><td>{0}</td></tr>\ | |||
<tr><td align="right"><b>Description</b>:</td><td>{1}</td></tr>\ | |||
<tr><td align="right"><b>Depends</b>:</td><td>{2}</td></tr>\ | |||
</table></html> | |||
<html><table>\ | |||
<tr><td align="right" valign="top"><b>Name</b>:</td><td>{0}</td></tr>\ | |||
<tr><td align="right" valign="top"><b>Description</b>:</td><td>{1}</td></tr>\ | |||
<tr><td align="right" valign="top"><b>Depends</b>:</td><td>{2}</td></tr>\ | |||
</table></html> | |||
org.apache.tools.ant.gui.PropertyEditor.manyTargets=\ | |||
<html><table>\ | |||
<tr><td align="right"><b>Names</b>:</td><td>{0}</td></tr>\ | |||
<tr><td align="right"><b>Depends</b>:</td><td>{1}</td></tr>\ | |||
</table></html> | |||
<html><table>\ | |||
<tr><td align="right"><b>Names</b>:</td><td>{0}</td></tr>\ | |||
<tr><td align="right"><b>Depends</b>:</td><td>{1}</td></tr>\ | |||
</table></html> | |||
org.apache.tools.ant.gui.ProjectNavigator.name=Project | |||
org.apache.tools.ant.gui.Console.name=Console | |||
@@ -45,12 +45,14 @@ org.apache.tools.ant.gui.About.title=About | |||
org.apache.tools.ant.gui.About.ok=OK | |||
org.apache.tools.ant.gui.About.message=\ | |||
<html><h1>Antidote</h1> \ | |||
<p><b>Version:</b> {0}</p> \ | |||
<p><b>Date:</b> {1}</p> \ | |||
<p><b>Contributors:</B> {2}</p> \ | |||
<hr> \ | |||
<p>Copyright © 2000 The Apache Software Foundation.</p> | |||
<p>All rights reserved.</p> \ | |||
<table> \ | |||
<tr><td align="right"><b>Version</b>:</td><td>{0}</td></tr> \ | |||
<tr><td align="right"><b>Date</b>:</td><td>{1}</td></tr> \ | |||
<tr><td align="right" valign="top"><b>Contributors</b>:</td>\ | |||
<td>{2}</td></tr> \ | |||
</table> \ | |||
<hr> \ | |||
<p>Copyright © 2000 The Apache Software Foundation.<br> \ | |||
All rights reserved.</p> \ | |||
</html> | |||