git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268895 13f79535-47bb-0310-9956-ffa450edef68master
@@ -70,6 +70,7 @@ | |||
<fileset dir="${src.dir}"> | |||
<include name="**/*.properties" /> | |||
<include name="**/*.gif" /> | |||
<include name="**/*.dtd" /> | |||
</fileset> | |||
</copy> | |||
@@ -0,0 +1,390 @@ | |||
/* | |||
* 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", "Ant", 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 java.io.*; | |||
import java.net.*; | |||
import java.util.*; | |||
import org.w3c.dom.*; | |||
import javax.xml.parsers.*; | |||
import org.xml.sax.SAXException; | |||
import org.xml.sax.InputSource; | |||
import com.sun.xml.parser.Parser; | |||
import com.sun.xml.parser.DtdEventListener; | |||
import com.sun.xml.parser.ValidatingParser; | |||
import com.sun.xml.tree.*; | |||
import com.sun.xml.parser.Resolver; | |||
/** | |||
* Reads the ANT DTD and provides information about it. | |||
* | |||
* @version $Revision$ | |||
* @author Nick Davis<a href="mailto:nick_home_account@yahoo.com">nick_home_account@yahoo.com</a> | |||
*/ | |||
public class ACSDocumentType extends java.lang.Object { | |||
/** True if the DTD has been loaded */ | |||
private boolean isInit = false; | |||
/** Hold the DTD elements */ | |||
private HashMap elementMap = new HashMap(); | |||
/** XML document used to load the DTD */ | |||
final static String XMLDOC = | |||
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + | |||
"<!DOCTYPE project SYSTEM \"file:/project.dtd\">" + | |||
"<project name=\"sample-project\">" + | |||
"</project>"; | |||
/** | |||
* Standard ctor. | |||
*/ | |||
public ACSDocumentType() { | |||
} | |||
/** | |||
* Loads the DTD if not already loaded. | |||
*/ | |||
public void init() { | |||
// Return if already inited. | |||
if (isInit) { | |||
return; | |||
} | |||
try { | |||
// Setup the parser | |||
Parser p = new Parser(); | |||
p.setEntityResolver(new ACSResolver()); | |||
// Setup the builder | |||
XmlDocumentBuilder builder = new XmlDocumentBuilder(); | |||
SimpleElementFactory fact = new SimpleElementFactory(); | |||
fact.addMapping(new Properties(), | |||
ACSDocumentType.class.getClassLoader()); | |||
builder.setElementFactory(fact); | |||
builder.setParser(p); | |||
DtdHandler dtdh = new DtdHandler(); | |||
p.setDTDHandler(dtdh); | |||
// Create the default xml file | |||
InputSource xmldoc = new InputSource( | |||
new ByteArrayInputStream(XMLDOC.getBytes())); | |||
// Parse the document | |||
p.parse(xmldoc); | |||
isInit = true; | |||
} catch (Exception e) { | |||
System.out.println(e); | |||
} | |||
} | |||
/** | |||
* Returns the dtd element. | |||
* | |||
* @param name the element name | |||
*/ | |||
public DtdElement findElement(String name) { | |||
return (DtdElement) elementMap.get(name); | |||
} | |||
/** | |||
* Class which represents a DTD element. | |||
*/ | |||
static class DtdElement { | |||
private String _name; | |||
private String[] _contentModel; | |||
private HashMap _map = new HashMap(); | |||
public String getName() { | |||
return _name; | |||
} | |||
public void setName(String name) { | |||
_name = name; | |||
} | |||
public String[] getContentModel() { | |||
return _contentModel; | |||
} | |||
public void setContentModel(String[] model) { | |||
_contentModel = model; | |||
} | |||
public HashMap getMap() { | |||
return _map; | |||
} | |||
} | |||
/** | |||
* Class which represents a DTD attribute. | |||
*/ | |||
static class DtdAttribute { | |||
private String _name; | |||
private String _type; | |||
private String[] _options; | |||
private String _defaultValue; | |||
private boolean _isFixed; | |||
private boolean _isRequired; | |||
public String getName() { | |||
return _name; | |||
} | |||
public void setName(String name) { | |||
_name = _name; | |||
} | |||
public String getType() { | |||
return _type; | |||
} | |||
public void setType(String type) { | |||
_name = type; | |||
} | |||
public String getDefaultValue() { | |||
return _defaultValue; | |||
} | |||
public void setDefaultValue(String value) { | |||
_defaultValue = value; | |||
} | |||
public String[] getOptions() { | |||
return _options; | |||
} | |||
public void setOptions(String[] s) { | |||
_options = s; | |||
} | |||
public boolean isFixed() { | |||
return _isFixed; | |||
} | |||
public void setFixed(boolean value) { | |||
_isFixed = value; | |||
} | |||
public boolean isRequired() { | |||
return _isRequired; | |||
} | |||
public void setRequired(boolean value) { | |||
_isRequired = value; | |||
} | |||
} | |||
/** | |||
* When parsing XML documents, DTD related events are signaled through | |||
* this interface. | |||
*/ | |||
class DtdHandler implements DtdEventListener { | |||
public void externalDtdDecl ( | |||
String publicId, | |||
String systemId) | |||
throws SAXException { } | |||
public void internalDtdDecl ( | |||
String internalSubset) | |||
throws SAXException { } | |||
public void internalEntityDecl ( | |||
String name, | |||
String value) | |||
throws SAXException { } | |||
public void externalEntityDecl ( | |||
String name, | |||
String publicId, | |||
String systemId) | |||
throws SAXException { } | |||
public void endDtd () | |||
throws SAXException { } | |||
public void notationDecl ( | |||
String name, | |||
String publicId, | |||
String systemId) | |||
throws SAXException { } | |||
public void unparsedEntityDecl ( | |||
String name, | |||
String publicId, | |||
String systemId, | |||
String notationName) | |||
throws SAXException { } | |||
public void startDtd ( | |||
String rootName | |||
) throws SAXException | |||
{ | |||
elementMap.clear(); | |||
} | |||
/** | |||
* Reports an attribute declaration found within the DTD. | |||
* | |||
* @param elementName The name of the element to which the attribute | |||
* applies; this includes a namespace prefix if one was used within | |||
* the DTD. | |||
* @param attributeName The name of the attribute being declared; this | |||
* includes a namespace prefix if one was used within the DTD. | |||
* @param attributeType The type of the attribute, either CDATA, NMTOKEN, | |||
* NMTOKENS, ENTITY, ENTITIES, NOTATION, ID, IDREF, or IDREFS as | |||
* defined in the XML specification; or null for enumerations. | |||
* @param options When attributeType is null or NOTATION, this is an | |||
* array of the values which are permitted; it is otherwise null. | |||
* @param defaultValue When not null, this provides the default value | |||
* of this attribute. | |||
* @param isFixed When true, the defaultValue is the only legal value. | |||
* (Precludes isRequired.) | |||
* @param isRequired When true, the attribute value must be provided | |||
* for each element of the named type. (Precludes isFixed.) | |||
*/ | |||
public void attributeDecl ( | |||
String elementName, | |||
String attributeName, | |||
String attributeType, | |||
String options [], | |||
String defaultValue, | |||
boolean isFixed, | |||
boolean isRequired | |||
) throws SAXException | |||
{ | |||
// Try to find the element. | |||
DtdElement e = (DtdElement) elementMap.get(elementName); | |||
if (e == null) { | |||
throw new SAXException("element " + elementName + | |||
" not declared before attributes"); | |||
} | |||
// Update the element's attribute. | |||
DtdAttribute attrib = new DtdAttribute(); | |||
attrib.setName(attributeName); | |||
attrib.setType(attributeType); | |||
attrib.setFixed(isFixed); | |||
attrib.setRequired(isRequired); | |||
attrib.setDefaultValue(defaultValue); | |||
attrib.setOptions(options); | |||
e.getMap().put(attrib.getName(), e); | |||
} | |||
/** | |||
* Reports an element declaration found within the DTD. The content | |||
* model will be a string such as "ANY", "EMPTY", "(#PCDATA|foo)*", | |||
* or "(caption?,tr*)". | |||
* | |||
* @param elementName The name of the element; this includes a namespace | |||
* prefix if one was used within the DTD. | |||
* @param contentModel The content model as defined in the DTD, with | |||
* any whitespace removed. | |||
*/ | |||
public void elementDecl ( | |||
String elementName, | |||
String contentModel | |||
) throws SAXException | |||
{ | |||
DtdElement e = new DtdElement(); | |||
e.setName(elementName); | |||
// Break the contentModel string into pieces. | |||
ArrayList list = new ArrayList(); | |||
StringTokenizer st = new StringTokenizer(contentModel, "|()*"); | |||
while (st.hasMoreTokens()) { | |||
String s = st.nextToken(); | |||
if ( s.length() > 0 && !"EMPTY".equals(s) ) { | |||
list.add(s); | |||
} | |||
} | |||
String[] array = new String[list.size()]; | |||
list.toArray(array); | |||
e.setContentModel(array); | |||
// Update the map | |||
elementMap.put(e.getName(), e); | |||
} | |||
} | |||
/** | |||
* We provide the location for the ant dtds. | |||
*/ | |||
class ACSResolver implements org.xml.sax.EntityResolver { | |||
/** | |||
* We process the project.dtd and project-ext.dtd. | |||
* | |||
* @param name Used to find alternate copies of the entity, when | |||
* this value is non-null; this is the XML "public ID". | |||
* @param uri Used when no alternate copy of the entity is found; | |||
* this is the XML "system ID", normally a URI. | |||
*/ | |||
public InputSource resolveEntity ( | |||
String publicId, | |||
String systemId) | |||
throws SAXException, IOException { | |||
final String PROJECT = "project.dtd"; | |||
final String PROJECTEXT = "project-ext.dtd"; | |||
InputStream result = null; | |||
// Is it the project.dtd? | |||
if (systemId.indexOf(PROJECT) != -1) { | |||
try { | |||
// Look for it as a resource | |||
result = getClass().getResourceAsStream(PROJECT); | |||
} catch (Exception e) {} | |||
} | |||
// Is it the project-ext.dtd? | |||
if (systemId.indexOf(PROJECTEXT) != -1) { | |||
try { | |||
// Look for it as a resource | |||
result = getClass().getResourceAsStream(PROJECTEXT); | |||
} catch (Exception e) {} | |||
} | |||
if (result != null) { | |||
return new InputSource(result); | |||
} | |||
// Otherwise, use the default impl. | |||
com.sun.xml.parser.Resolver r = new com.sun.xml.parser.Resolver(); | |||
return r.resolveEntity(publicId, systemId); | |||
} | |||
} | |||
} |
@@ -0,0 +1,215 @@ | |||
/* | |||
* 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", "Ant", 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.apache.tools.ant.gui.command.NewElementCmd; | |||
import org.w3c.dom.*; | |||
import java.beans.*; | |||
import java.util.*; | |||
/** | |||
* Element defined by the DTD. | |||
* | |||
* @version $Revision$ | |||
* @author Nick Davis<a href="mailto:nick_home_account@yahoo.com">nick_home_account@yahoo.com</a> | |||
*/ | |||
public class ACSDtdDefinedElement extends ACSTreeNodeElement | |||
implements ACSInfoProvider { | |||
/** Property name for the task type. */ | |||
public static final String TASK_TYPE = "taskType"; | |||
/** Property name for attributes. It's called "namedValues" so | |||
* it doesn't collide with the Node.getAttributes() method. */ | |||
public static final String NAMED_VALUES = "namedValues"; | |||
/** The ANT DTD */ | |||
static ACSDocumentType docType = new ACSDocumentType(); | |||
/** Our menu string */ | |||
public String[] menuString = null; | |||
/** | |||
* Default ctor. | |||
* | |||
*/ | |||
public ACSDtdDefinedElement() { | |||
// Load the DTD | |||
docType.init(); | |||
} | |||
/** | |||
* Get the task type. | |||
* | |||
* @return Task type. | |||
*/ | |||
public String getTaskType() { | |||
return getTagName(); | |||
} | |||
/** | |||
* Set the task type. | |||
* | |||
* @param type Type name. | |||
*/ | |||
public void setTaskType(String type) { | |||
setTag(type); | |||
} | |||
/** | |||
* Get the attributes (named value mappings). This method is not named | |||
* getAttributes() because there is already a method of that name in | |||
* the Node interface. | |||
* | |||
* @return Name-value mappings. | |||
*/ | |||
public Properties getNamedValues() { | |||
Properties retval = new Properties(); | |||
NamedNodeMap attribs = getAttributes(); | |||
for(int i = 0, len = attribs.getLength(); i < len; i++) { | |||
Node n = attribs.item(i); | |||
retval.setProperty(n.getNodeName(), n.getNodeValue()); | |||
} | |||
return retval; | |||
} | |||
/** | |||
* Set the attributes. This method sets the Node attirbutes using | |||
* the given Map containing name-value pairs. | |||
* | |||
* @param attributes New attribute set. | |||
*/ | |||
public void setNamedValues(Properties props) { | |||
// XXX this code really sucks. It is really annoying that the | |||
// DOM interfaces don't have a general "setAttributes()" or | |||
// "removeAllAttributes()" method, but instead make you | |||
// remove each attribute individually, or require you to figure | |||
// out what the differences are between the two. | |||
// Although this is very inefficient, I'm taking the conceptually | |||
// simplistic approach to this and brute force removing the existing | |||
// set and replacing it with a brand new set. If this becomes a | |||
// performance concern (which I doubt it will) it can be optimized | |||
// later. | |||
Properties old = getNamedValues(); | |||
Enumeration enum = old.propertyNames(); | |||
while(enum.hasMoreElements()) { | |||
String name = (String) enum.nextElement(); | |||
removeAttribute(name); | |||
} | |||
enum = props.propertyNames(); | |||
while(enum.hasMoreElements()) { | |||
String key = (String) enum.nextElement(); | |||
setAttribute(key, props.getProperty(key)); | |||
} | |||
firePropertyChange(NAMED_VALUES, old, props); | |||
} | |||
/** | |||
* Returns the menu items which may be used for this element. | |||
*/ | |||
public String[] getMenuString() { | |||
// If it already exists, use it. | |||
if (menuString != null) { | |||
return menuString; | |||
} | |||
// Find the DtdElement | |||
String name = getTagName(); | |||
ACSDocumentType.DtdElement e = | |||
docType.findElement(name); | |||
if (e != null) { | |||
// Use the content model (all the possible | |||
// sub-elements) to create the menu. | |||
String[] temp = e.getContentModel(); | |||
int size = (temp.length > 5) ? 5 : temp.length; | |||
menuString = new String[size+2]; | |||
System.arraycopy(temp, 0, menuString, 0, size); | |||
// Add the delete and generic create commands | |||
menuString[menuString.length-1] = "deleteElement"; | |||
menuString[menuString.length-2] = "newElement"; | |||
} | |||
return menuString; | |||
} | |||
/** | |||
* Returns the string to use if an action ID is not found. | |||
* In our case, the newElement command is used. | |||
*/ | |||
public String getDefaultActionID() { | |||
return "newElement"; | |||
} | |||
/** | |||
* Retuns a string array which contains this elements | |||
* possible children. It is created from the DTD's | |||
* content model. | |||
*/ | |||
public String[] getPossibleChildren() { | |||
String name = getTagName(); | |||
ACSDocumentType.DtdElement e = | |||
docType.findElement(name); | |||
if (e != null) { | |||
return e.getContentModel(); | |||
} | |||
return null; | |||
} | |||
} | |||
@@ -0,0 +1,133 @@ | |||
/* | |||
* 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", "Ant", 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.apache.tools.ant.gui.customizer.DynamicCustomizer; | |||
import java.beans.*; | |||
/** | |||
* BeanInfo for the ACSDtdDefinedElement class. | |||
* | |||
* @version $Revision$ | |||
* @author Nick Davis<a href="mailto:nick_home_account@yahoo.com">nick_home_account@yahoo.com</a> | |||
*/ | |||
public class ACSDtdDefinedElementBeanInfo extends BaseBeanInfo { | |||
/** | |||
* Default ctor. | |||
* | |||
*/ | |||
public ACSDtdDefinedElementBeanInfo() { | |||
} | |||
/** | |||
* Get the type that this BeanInfo represents. | |||
* | |||
* @return Type. | |||
*/ | |||
public Class getType() { | |||
return ACSDtdDefinedElement.class; | |||
} | |||
/** | |||
* Get the customizer type. | |||
* | |||
* @return Customizer type. | |||
*/ | |||
public Class getCustomizerType() { | |||
return Customizer.class; | |||
} | |||
/** | |||
* Get the property descriptors. | |||
* | |||
* @return Property descriptors. | |||
*/ | |||
public PropertyDescriptor[] getPropertyDescriptors() { | |||
PropertyDescriptor[] retval = null; | |||
try { | |||
retval = new PropertyDescriptor[] { | |||
new PropertyDescriptor(ACSDtdDefinedElement.TASK_TYPE, | |||
ACSDtdDefinedElement.class, | |||
"getTaskType", null), | |||
new PropertyDescriptor(ACSDtdDefinedElement.NAMED_VALUES, | |||
ACSDtdDefinedElement.class), | |||
new PropertyDescriptor(ACSDtdDefinedElement.XML_STRING, | |||
ACSDtdDefinedElement.class, | |||
"getXMLString", null) | |||
}; | |||
int pos = 0; | |||
retval[pos++].setDisplayName(getResources().getString( | |||
getClass(),ACSDtdDefinedElement.TASK_TYPE)); | |||
retval[pos++].setDisplayName(getResources().getString( | |||
getClass(),ACSDtdDefinedElement.NAMED_VALUES)); | |||
retval[pos++].setDisplayName(getResources().getString( | |||
getClass(),ACSDtdDefinedElement.XML_STRING)); | |||
setSortingOrder(retval); | |||
} catch(IntrospectionException ex) { | |||
ex.printStackTrace(); | |||
throw new Error(ex.toString()); | |||
} | |||
return retval; | |||
} | |||
/** Customizer for this bean info. */ | |||
public static class Customizer extends DynamicCustomizer { | |||
public Customizer() { | |||
super(ACSDtdDefinedElement.class); | |||
} | |||
} | |||
} | |||
@@ -60,9 +60,7 @@ import java.net.URL; | |||
import org.w3c.dom.*; | |||
import org.xml.sax.SAXException; | |||
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 com.sun.xml.tree.*; | |||
import java.util.Properties; | |||
import java.util.Enumeration; | |||
import com.sun.xml.parser.Resolver; | |||
@@ -92,7 +90,7 @@ public class ACSFactory { | |||
String name = (String) enum.nextElement(); | |||
// XXX the name of the class needs to be stored externally. | |||
_elementMap.setProperty( | |||
name, "org.apache.tools.ant.gui.acs.ACSTaskElement"); | |||
name, "org.apache.tools.ant.gui.acs.ACSDtdDefinedElement"); | |||
} | |||
// Then we add/override the local definitions. | |||
@@ -164,7 +162,6 @@ public class ACSFactory { | |||
sax.parse(location.openStream(), null); | |||
doc = builder.getDocument(); | |||
} | |||
catch(ParserConfigurationException ex) { | |||
ex.printStackTrace(); | |||
@@ -235,6 +232,22 @@ public class ACSFactory { | |||
return retval; | |||
} | |||
/** | |||
* Create a new element. | |||
* | |||
* @param node the Node to assign the property to. | |||
* @param name the new elements type. | |||
* @return New, unnamed property. | |||
*/ | |||
public ACSElement createElement(ACSElement node, String name) { | |||
ACSElement retval = (ACSElement) node. | |||
getOwnerDocument().createElement(name); | |||
// XXX fixme. | |||
indent(node, 1); | |||
node.appendChild(retval); | |||
return retval; | |||
} | |||
/** | |||
* Insert a new line and indentation at the end of the given | |||
* node in preparation for a new element being added. | |||
@@ -0,0 +1,75 @@ | |||
/* | |||
* 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", "Ant", 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; | |||
/** | |||
* Provides menu infomation for a node. | |||
* | |||
* @version $Revision$ | |||
* @author Nick Davis<a href="mailto:nick_home_account@yahoo.com">nick_home_account@yahoo.com</a> | |||
*/ | |||
public interface ACSInfoProvider { | |||
/** | |||
* Returns the menu items which may be used on this node. | |||
* If the strings are not valid action IDs, use | |||
* <code>getDefaultActionID</code> to find the action for the menu item. | |||
*/ | |||
public String[] getMenuString(); | |||
/** | |||
* Returns the action ID to use for a menu item which does not | |||
* represent a valid action ID. | |||
*/ | |||
public String getDefaultActionID(); | |||
} | |||
@@ -62,7 +62,7 @@ import java.util.StringTokenizer; | |||
* @version $Revision$ | |||
* @author Simeon Fitch | |||
*/ | |||
public class ACSNamedElement extends ACSTreeNodeElement { | |||
public class ACSNamedElement extends ACSDtdDefinedElement { | |||
/** The 'name' property name. */ | |||
public static final String NAME = "name"; | |||
/** The discription property name. */ | |||
@@ -73,7 +73,6 @@ public class ACSNamedElement extends ACSTreeNodeElement { | |||
* | |||
*/ | |||
public ACSNamedElement() { | |||
} | |||
/** | |||
@@ -61,7 +61,7 @@ import com.sun.xml.tree.ElementNode; | |||
* @version $Revision$ | |||
* @author Simeon Fitch | |||
*/ | |||
public class ACSPropertyElement extends ACSTreeNodeElement { | |||
public class ACSPropertyElement extends ACSDtdDefinedElement { | |||
/** The 'name' property name. */ | |||
public static final String NAME = "name"; | |||
/** The 'value' property name. */ | |||
@@ -3,10 +3,12 @@ | |||
# | |||
# The default element | |||
*Element=org.apache.tools.ant.gui.acs.ACSDefaultElement | |||
*Element=org.apache.tools.ant.gui.acs.ACSDtdDefinedElement | |||
# Specific elements. | |||
project=org.apache.tools.ant.gui.acs.ACSProjectElement | |||
property=org.apache.tools.ant.gui.acs.ACSPropertyElement | |||
target=org.apache.tools.ant.gui.acs.ACSTargetElement | |||
task=org.apache.tools.ant.gui.acs.ACSTaskElement | |||
@@ -0,0 +1,34 @@ | |||
<?xml version="1.0" encoding="iso-8859-1"?> | |||
<!-- | |||
Copyright (c) 2000 Michel CASABIANCA. All Rights Reserved. | |||
Permission to use, copy, modify, and distribute this software and its | |||
documentation for any purpose and without fee or royalty is hereby | |||
granted, provided that both the above copyright notice and this | |||
permission notice appear in all copies of the software and | |||
documentation or portions thereof, including modifications, that you | |||
make. | |||
THIS SOFTWARE IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO | |||
REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF EXAMPLE, | |||
BUT NOT LIMITATION, COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR | |||
WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR | |||
THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY | |||
THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. | |||
COPYRIGHT HOLDERS WILL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE | |||
OR DOCUMENTATION. | |||
--> | |||
<!-- project ext DTD for Ant --> | |||
<!-- 2000-04-03 --> | |||
<!ENTITY % ext "| xt"> | |||
<!ELEMENT xt EMPTY> | |||
<!ATTLIST xt | |||
xml CDATA #REQUIRED | |||
xsl CDATA #REQUIRED | |||
out CDATA #REQUIRED> | |||
@@ -0,0 +1,282 @@ | |||
<?xml version="1.0" encoding="iso-8859-1"?> | |||
<!-- | |||
Copyright (c) 2000 Michel CASABIANCA. All Rights Reserved. | |||
Permission to use, copy, modify, and distribute this software and its | |||
documentation for any purpose and without fee or royalty is hereby | |||
granted, provided that both the above copyright notice and this | |||
permission notice appear in all copies of the software and | |||
documentation or portions thereof, including modifications, that you | |||
make. | |||
THIS SOFTWARE IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO | |||
REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF EXAMPLE, | |||
BUT NOT LIMITATION, COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR | |||
WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR | |||
THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY | |||
THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. | |||
COPYRIGHT HOLDERS WILL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE | |||
OR DOCUMENTATION. | |||
--> | |||
<!-- project DTD for Ant --> | |||
<!-- 2000-04-03 --> | |||
<!ENTITY % ext-file SYSTEM "file:/project-ext.dtd"> | |||
%ext-file; | |||
<!ELEMENT project (target | property | path)*> | |||
<!ATTLIST project | |||
name CDATA #REQUIRED | |||
default CDATA #REQUIRED | |||
basedir CDATA #REQUIRED | |||
> | |||
<!ELEMENT target (ant | available | chmod | copy | cvs | delete | deltree | echo | exec | expand | filter | get | gzip | fixcrlf | jar | java | javac | javadoc | keysubst | mkdir | property | rename | replace | rmic | tar | taskdef | tstamp | zip | path | classpath)*> | |||
<!ATTLIST target | |||
name CDATA #REQUIRED | |||
depends CDATA #IMPLIED | |||
if CDATA #IMPLIED | |||
> | |||
<!ELEMENT path (pathelement | path)*> | |||
<!ATTLIST path | |||
id CDATA #IMPLIED | |||
refid CDATA #IMPLIED | |||
> | |||
<!ELEMENT classpath (pathelement | path | fileset)*> | |||
<!ATTLIST classpath | |||
id CDATA #IMPLIED | |||
refid CDATA #IMPLIED | |||
> | |||
<!ELEMENT fileset (include | exclude)*> | |||
<!ATTLIST fileset | |||
dir CDATA #IMPLIED | |||
> | |||
<!ELEMENT exclude EMPTY> | |||
<!ATTLIST exclude | |||
name CDATA #REQUIRED | |||
unless CDATA #IMPLIED | |||
> | |||
<!ELEMENT include EMPTY> | |||
<!ATTLIST include | |||
name CDATA #REQUIRED | |||
> | |||
<!ELEMENT pathelement EMPTY> | |||
<!ATTLIST pathelement | |||
location CDATA #IMPLIED | |||
path CDATA #IMPLIED | |||
> | |||
<!ELEMENT property EMPTY> | |||
<!ATTLIST property | |||
name CDATA #IMPLIED | |||
value CDATA #IMPLIED | |||
resource CDATA #IMPLIED | |||
file CDATA #IMPLIED | |||
> | |||
<!ELEMENT ant EMPTY> | |||
<!ATTLIST ant | |||
antfile CDATA #IMPLIED | |||
dir CDATA #REQUIRED | |||
target CDATA #IMPLIED | |||
> | |||
<!ELEMENT available EMPTY> | |||
<!ATTLIST available | |||
property CDATA #REQUIRED | |||
classname CDATA #REQUIRED | |||
resource CDATA #REQUIRED | |||
file CDATA #REQUIRED | |||
> | |||
<!ELEMENT chmod EMPTY> | |||
<!ATTLIST chmod | |||
src CDATA #REQUIRED | |||
perm CDATA #REQUIRED | |||
> | |||
<!ELEMENT copy (fileset)*> | |||
<!ATTLIST copy | |||
file CDATA #IMPLIED | |||
todir CDATA #IMPLIED | |||
todir CDATA #IMPLIED | |||
> | |||
<!ELEMENT cvs EMPTY> | |||
<!ATTLIST cvs | |||
cvsRoot CDATA #REQUIRED | |||
dest CDATA #REQUIRED | |||
package CDATA #REQUIRED | |||
tag CDATA #IMPLIED | |||
> | |||
<!ELEMENT delete EMPTY> | |||
<!ATTLIST delete | |||
file CDATA #REQUIRED | |||
> | |||
<!ELEMENT deltree EMPTY> | |||
<!ATTLIST deltree | |||
dir CDATA #REQUIRED | |||
> | |||
<!ELEMENT echo EMPTY> | |||
<!ATTLIST echo | |||
message CDATA #REQUIRED | |||
> | |||
<!ELEMENT exec EMPTY> | |||
<!ATTLIST exec | |||
command CDATA #REQUIRED | |||
dir CDATA #REQUIRED | |||
os CDATA #IMPLIED | |||
output CDATA #REQUIRED | |||
> | |||
<!ELEMENT expand EMPTY> | |||
<!ATTLIST expand | |||
src CDATA #REQUIRED | |||
dest CDATA #REQUIRED | |||
> | |||
<!ELEMENT filter EMPTY> | |||
<!ATTLIST filter | |||
token CDATA #REQUIRED | |||
value CDATA #REQUIRED | |||
> | |||
<!ELEMENT get EMPTY> | |||
<!ATTLIST get | |||
src CDATA #REQUIRED | |||
dest CDATA #REQUIRED | |||
verbose CDATA #IMPLIED | |||
> | |||
<!ELEMENT gzip EMPTY> | |||
<!ATTLIST gzip | |||
src CDATA #REQUIRED | |||
zipfile CDATA #REQUIRED | |||
> | |||
<!ELEMENT fixcrlf EMPTY> | |||
<!ATTLIST fixcrlf | |||
srcdir CDATA #REQUIRED | |||
destDir CDATA #IMPLIED | |||
includes CDATA #IMPLIED | |||
excludes CDATA #IMPLIED | |||
cr CDATA #IMPLIED | |||
tab CDATA #IMPLIED | |||
eof CDATA #IMPLIED | |||
> | |||
<!ELEMENT jar EMPTY> | |||
<!ATTLIST jar | |||
jarfile CDATA #REQUIRED | |||
basedir CDATA #REQUIRED | |||
items CDATA #IMPLIED | |||
ignore CDATA #IMPLIED | |||
includes CDATA #IMPLIED | |||
excludes CDATA #IMPLIED | |||
defaultexcludes CDATA #IMPLIED | |||
manifest CDATA #IMPLIED | |||
> | |||
<!ELEMENT java EMPTY> | |||
<!ATTLIST java | |||
classname CDATA #REQUIRED | |||
args CDATA #IMPLIED | |||
fork CDATA #IMPLIED | |||
jvmargs CDATA #IMPLIED | |||
> | |||
<!ELEMENT javac (classpath | exclude | property)*> | |||
<!ATTLIST javac | |||
srcdir CDATA #REQUIRED | |||
destdir CDATA #REQUIRED | |||
includes CDATA #IMPLIED | |||
excludes CDATA #IMPLIED | |||
defaultexcludes CDATA #IMPLIED | |||
classpath CDATA #IMPLIED | |||
bootclasspath CDATA #IMPLIED | |||
extdirs CDATA #IMPLIED | |||
debug CDATA #IMPLIED | |||
optimize CDATA #IMPLIED | |||
deprecation CDATA #IMPLIED | |||
filtering CDATA #IMPLIED | |||
> | |||
<!ELEMENT javadoc EMPTY> | |||
<!ATTLIST javadoc | |||
sourcepath CDATA #REQUIRED | |||
destdir CDATA #REQUIRED | |||
sourcefiles CDATA #IMPLIED | |||
packagenames CDATA #IMPLIED | |||
classpath CDATA #IMPLIED | |||
bootclasspath CDATA #IMPLIED | |||
extdirs CDATA #IMPLIED | |||
overview CDATA #IMPLIED | |||
public CDATA #IMPLIED | |||
protected CDATA #IMPLIED | |||
package CDATA #IMPLIED | |||
private CDATA #IMPLIED | |||
old CDATA #IMPLIED | |||
verbose CDATA #IMPLIED | |||
locale CDATA #IMPLIED | |||
encoding CDATA #IMPLIED | |||
version CDATA #IMPLIED | |||
use CDATA #IMPLIED | |||
author CDATA #IMPLIED | |||
splitindex CDATA #IMPLIED | |||
windowtitle CDATA #IMPLIED | |||
doctitle CDATA #IMPLIED | |||
header CDATA #IMPLIED | |||
footer CDATA #IMPLIED | |||
bottom CDATA #IMPLIED | |||
link CDATA #IMPLIED | |||
linkoffline CDATA #IMPLIED | |||
group CDATA #IMPLIED | |||
nodedeprecated CDATA #IMPLIED | |||
nodedeprecatedlist CDATA #IMPLIED | |||
notree CDATA #IMPLIED | |||
noindex CDATA #IMPLIED | |||
nohelp CDATA #IMPLIED | |||
nonavbar CDATA #IMPLIED | |||
serialwarn CDATA #IMPLIED | |||
helpfile CDATA #IMPLIED | |||
stylesheetfile CDATA #IMPLIED | |||
charset CDATA #IMPLIED | |||
docencoding CDATA #IMPLIED | |||
> | |||
<!ELEMENT keysubst EMPTY> | |||
<!ATTLIST keysubst | |||
src CDATA #REQUIRED | |||
dest CDATA #REQUIRED | |||
sep CDATA #IMPLIED | |||
keys CDATA #REQUIRED | |||
> | |||
<!ELEMENT mkdir EMPTY> | |||
<!ATTLIST mkdir | |||
dir CDATA #REQUIRED | |||
> | |||
<!ELEMENT rename EMPTY> | |||
<!ATTLIST rename | |||
src CDATA #REQUIRED | |||
dest CDATA #REQUIRED | |||
replace CDATA #IMPLIED | |||
> | |||
<!ELEMENT replace EMPTY> | |||
<!ATTLIST replace | |||
file CDATA #REQUIRED | |||
token CDATA #REQUIRED | |||
value CDATA #IMPLIED | |||
> | |||
<!ELEMENT rmic EMPTY> | |||
<!ATTLIST rmic | |||
base CDATA #REQUIRED | |||
classname CDATA #REQUIRED | |||
filtering CDATA #IMPLIED | |||
> | |||
<!ELEMENT tar EMPTY> | |||
<!ATTLIST tar | |||
tarfile CDATA #REQUIRED | |||
basedir CDATA #REQUIRED | |||
includes CDATA #IMPLIED | |||
excludes CDATA #IMPLIED | |||
defaultexcludes CDATA #IMPLIED | |||
> | |||
<!ELEMENT taskdef EMPTY> | |||
<!ATTLIST taskdef | |||
name CDATA #REQUIRED | |||
classname CDATA #REQUIRED | |||
> | |||
<!ELEMENT tstamp EMPTY> | |||
<!ELEMENT zip EMPTY> | |||
<!ATTLIST zip | |||
zipfile CDATA #REQUIRED | |||
basedir CDATA #REQUIRED | |||
items CDATA #IMPLIED | |||
ignore CDATA #IMPLIED | |||
includes CDATA #IMPLIED | |||
excludes CDATA #IMPLIED | |||
defaultexcludes CDATA #IMPLIED | |||
> |
@@ -0,0 +1,106 @@ | |||
/* | |||
* The Apache Software License, Version 1.1 | |||
* | |||
* Copyright (c) 2001 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", "Ant", 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.command; | |||
import java.util.EventObject; | |||
import javax.swing.JOptionPane; | |||
import org.w3c.dom.Node; | |||
import org.apache.tools.ant.gui.core.AppContext; | |||
import org.apache.tools.ant.gui.event.DeleteElementEvent; | |||
import org.apache.tools.ant.gui.acs.*; | |||
/** | |||
* Command for removing the selected element. | |||
* | |||
* @version $Revision$ | |||
* @author Nick Davis<a href="mailto:nick_home_account@yahoo.com">nick_home_account@yahoo.com</a> | |||
*/ | |||
public class DeleteElementCmd extends AbstractCommand { | |||
/** | |||
* Standard ctor. | |||
* | |||
* @param context Application context. | |||
*/ | |||
public DeleteElementCmd(AppContext context) { | |||
super(context); | |||
} | |||
/** | |||
* Delete the selected element. | |||
*/ | |||
public void run() { | |||
// Ask "Are you sure?" | |||
int option = JOptionPane.showConfirmDialog(null, "Are You Sure?", | |||
"Confirm Delete", JOptionPane.YES_NO_OPTION); | |||
if (option == JOptionPane.YES_OPTION) { | |||
// Find the element to remove | |||
ACSElement[] vals = getContext().getSelectionManager(). | |||
getSelectedElements(); | |||
if(vals != null && vals.length > 0) { | |||
Node item = vals[vals.length - 1]; | |||
// Find the parent and remove the element. | |||
Node parent = item.getParentNode(); | |||
parent.removeChild(item); | |||
// Notify the tree the element was removed. | |||
DeleteElementEvent event = new DeleteElementEvent( | |||
getContext(), (ACSElement) parent); | |||
getContext().getEventBus().postEvent(event); | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,155 @@ | |||
/* | |||
* The Apache Software License, Version 1.1 | |||
* | |||
* Copyright (c) 2001 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", "Ant", 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.command; | |||
import java.util.EventObject; | |||
import javax.swing.AbstractButton; | |||
import javax.swing.Action; | |||
import org.apache.tools.ant.gui.core.AppContext; | |||
import org.apache.tools.ant.gui.event.NewBaseElementEvent; | |||
import org.apache.tools.ant.gui.event.RefreshDisplayEvent; | |||
import org.apache.tools.ant.gui.acs.*; | |||
import org.apache.tools.ant.gui.util.WindowUtils; | |||
import org.apache.tools.ant.gui.core.AntAction; | |||
/** | |||
* Command for creating a new propertyh. | |||
* | |||
* @version $Revision$ | |||
* @author Simeon Fitch | |||
*/ | |||
public class NewElementCmd extends AbstractCommand { | |||
/** New count for this session. Used to create default names, | |||
* numbered as a convenience. */ | |||
private static int _count = 1; | |||
private EventObject _event = null; | |||
/** | |||
* Standard ctor. | |||
* | |||
* @param context Application context. | |||
*/ | |||
public NewElementCmd(AppContext context, EventObject event) { | |||
super(context); | |||
_event = event; | |||
} | |||
/** | |||
* Creates a new xml element based on the button which | |||
* was pressed. The button text may contain the name | |||
* of the new element or a dialog box is presented which | |||
* asks the user for the element type. | |||
*/ | |||
public void run() { | |||
// Find which element is selected. | |||
ACSElement[] vals = getContext().getSelectionManager(). | |||
getSelectedElements(); | |||
if(vals == null || vals.length == 0) { | |||
return; | |||
} | |||
// Find the text of the button which was pressed | |||
// to determine the type of element to create. | |||
Object source = _event.getSource(); | |||
if (!(source instanceof AbstractButton)) { | |||
return; | |||
} | |||
AbstractButton button = (AbstractButton) source; | |||
String name = button.getText(); | |||
// Get the AntAction | |||
Action action = button.getAction(); | |||
if (!(action instanceof AntAction)) { | |||
return; | |||
} | |||
AntAction antAction = (AntAction) action; | |||
ACSElement e = vals[vals.length - 1]; | |||
// Should we prompt the user use the element type? | |||
if (antAction.getName().equals(name)) { | |||
// Display the dialog box. | |||
ACSDtdDefinedElement dtde = (ACSDtdDefinedElement) e; | |||
NewElementDlg dlg = new NewElementDlg( | |||
getContext().getParentFrame(), true); | |||
dlg.setList(dtde.getPossibleChildren()); | |||
dlg.pack(); | |||
WindowUtils.centerWindow(dlg); | |||
dlg.setTitle("Select the new element type"); | |||
dlg.setVisible(true); | |||
// Get the element type | |||
if (dlg.getCancel()) { | |||
name = ""; | |||
} else { | |||
name = dlg.getElementName(); | |||
} | |||
} | |||
if (name.length() > 0) { | |||
// Create the new element | |||
ACSElement retval = | |||
ACSFactory.getInstance().createElement(e, name); | |||
getContext().getEventBus().postEvent( | |||
new NewBaseElementEvent(getContext(), retval)); | |||
} else { | |||
// Request a refresh so the popup menu is removed | |||
// from the display. | |||
getContext().getEventBus().postEvent( | |||
new RefreshDisplayEvent(getContext())); | |||
} | |||
} | |||
} | |||
@@ -0,0 +1,261 @@ | |||
/* | |||
* 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", "Ant", 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.command; | |||
import javax.swing.*; | |||
/** | |||
* A Dialog which asks for a new xml element's type. | |||
* | |||
* @version $Revision$ | |||
* @author Nick Davis<a href="mailto:nick_home_account@yahoo.com">nick_home_account@yahoo.com</a> | |||
*/ | |||
public class NewElementDlg extends javax.swing.JDialog { | |||
// Dialog's components | |||
private javax.swing.JPanel _southPanel; | |||
private javax.swing.JPanel _buttonPanel; | |||
private javax.swing.JButton _buttonOK; | |||
private javax.swing.JButton _buttonCancel; | |||
private javax.swing.JPanel _selectPanel; | |||
private javax.swing.JPanel _panelData; | |||
private javax.swing.JLabel _label; | |||
private javax.swing.JTextField _elementText; | |||
private javax.swing.JScrollPane _listScrollPane; | |||
private javax.swing.JList _elementList; | |||
/** set to true if cancel is pressed */ | |||
private boolean _cancel = true; | |||
/** holds the element type */ | |||
private String _elementName; | |||
/** | |||
* Creates new form NewElementDlg | |||
*/ | |||
public NewElementDlg(java.awt.Frame parent,boolean modal) { | |||
super(parent, modal); | |||
initComponents(); | |||
enableButtons(); | |||
} | |||
/** | |||
* Fills the listbox with the input list. | |||
*/ | |||
public void setList(String[] list) { | |||
if (list == null || list.length == 0) { | |||
_listScrollPane.setVisible(false); | |||
} else { | |||
_elementList.setListData(list); | |||
} | |||
} | |||
/** | |||
* Returns true if cancel was pressed | |||
*/ | |||
public boolean getCancel() { | |||
return _cancel; | |||
} | |||
/** | |||
* Returns the entered element type | |||
*/ | |||
public String getElementName() { | |||
return _elementName; | |||
} | |||
/** | |||
* Enable or disable buttons | |||
*/ | |||
private void enableButtons() { | |||
if (_elementText.getText().length() > 0) { | |||
_buttonOK.setEnabled(true); | |||
} else { | |||
_buttonOK.setEnabled(false); | |||
} | |||
} | |||
/** | |||
* This method is called from within the constructor to | |||
* initialize the form. | |||
*/ | |||
private void initComponents() { | |||
_southPanel = new javax.swing.JPanel(); | |||
_buttonPanel = new javax.swing.JPanel(); | |||
_buttonOK = new javax.swing.JButton(); | |||
_buttonCancel = new javax.swing.JButton(); | |||
_selectPanel = new javax.swing.JPanel(); | |||
_panelData = new javax.swing.JPanel(); | |||
_label = new javax.swing.JLabel(); | |||
_elementText = new javax.swing.JTextField(); | |||
_listScrollPane = new javax.swing.JScrollPane(); | |||
_elementList = new javax.swing.JList(); | |||
getContentPane().setLayout(new java.awt.BorderLayout(10, 10)); | |||
addWindowListener(new java.awt.event.WindowAdapter() { | |||
public void windowClosing(java.awt.event.WindowEvent evt) { | |||
closeDialog(evt); | |||
} | |||
} | |||
); | |||
_southPanel.setLayout(new java.awt.FlowLayout(2, 2, 0)); | |||
_southPanel.setPreferredSize(new java.awt.Dimension(156, 50)); | |||
_southPanel.setMinimumSize(new java.awt.Dimension(154, 50)); | |||
_buttonPanel.setLayout(new java.awt.FlowLayout(1, 2, 0)); | |||
_buttonPanel.setPreferredSize(new java.awt.Dimension(146, 50)); | |||
_buttonPanel.setMinimumSize(new java.awt.Dimension(150, 50)); | |||
_buttonPanel.setAlignmentY(0.0F); | |||
_buttonPanel.setAlignmentX(0.0F); | |||
_buttonOK.setText("OK"); | |||
_buttonOK.setPreferredSize(new java.awt.Dimension(50, 30)); | |||
_buttonOK.setMaximumSize(new java.awt.Dimension(50, 30)); | |||
_buttonOK.setMargin(new java.awt.Insets(10, 10, 10, 10)); | |||
_buttonOK.setMinimumSize(new java.awt.Dimension(50, 30)); | |||
_buttonOK.addActionListener(new java.awt.event.ActionListener() { | |||
public void actionPerformed(java.awt.event.ActionEvent evt) { | |||
clickOK(evt); | |||
} | |||
} | |||
); | |||
_buttonPanel.add(_buttonOK); | |||
_buttonCancel.setText("Cancel"); | |||
_buttonCancel.setPreferredSize(new java.awt.Dimension(70, 30)); | |||
_buttonCancel.setMaximumSize(new java.awt.Dimension(60, 30)); | |||
_buttonCancel.setMargin(new java.awt.Insets(10, 10, 10, 10)); | |||
_buttonCancel.setMinimumSize(new java.awt.Dimension(60, 30)); | |||
_buttonCancel.addActionListener(new java.awt.event.ActionListener() { | |||
public void actionPerformed(java.awt.event.ActionEvent evt) { | |||
clickCancel(evt); | |||
} | |||
} | |||
); | |||
_buttonPanel.add(_buttonCancel); | |||
_southPanel.add(_buttonPanel); | |||
getContentPane().add(_southPanel, java.awt.BorderLayout.SOUTH); | |||
_selectPanel.setLayout(new java.awt.BorderLayout(10, 10)); | |||
_selectPanel.setBorder(new javax.swing.border.EtchedBorder()); | |||
_label.setText("Element Type:"); | |||
_label.setAlignmentX(0.5F); | |||
_panelData.add(_label); | |||
_elementText.setPreferredSize(new java.awt.Dimension(110, 25)); | |||
_elementText.setMargin(new java.awt.Insets(2, 2, 2, 2)); | |||
_elementText.setMinimumSize(new java.awt.Dimension(14, 25)); | |||
_elementText.addKeyListener(new java.awt.event.KeyAdapter() { | |||
public void keyReleased(java.awt.event.KeyEvent evt) { | |||
_elementTextKeyReleased(evt); | |||
} | |||
} | |||
); | |||
_panelData.add(_elementText); | |||
_selectPanel.add(_panelData, java.awt.BorderLayout.SOUTH); | |||
_elementList.setMaximumSize(new java.awt.Dimension(100, 20)); | |||
_elementList.setMinimumSize(new java.awt.Dimension(10, 10)); | |||
_elementList.addListSelectionListener(new javax.swing.event.ListSelectionListener() { | |||
public void valueChanged(javax.swing.event.ListSelectionEvent evt) { | |||
itemSelected(evt); | |||
} | |||
} | |||
); | |||
_listScrollPane.setViewportView(_elementList); | |||
_selectPanel.add(_listScrollPane, java.awt.BorderLayout.CENTER); | |||
getContentPane().add(_selectPanel, java.awt.BorderLayout.CENTER); | |||
pack(); | |||
} | |||
/** Called when a key is released */ | |||
private void _elementTextKeyReleased(java.awt.event.KeyEvent evt) { | |||
enableButtons(); | |||
} | |||
/** Called when an item is selected from the list */ | |||
private void itemSelected(javax.swing.event.ListSelectionEvent evt) { | |||
_elementText.setText((String) _elementList.getSelectedValue()); | |||
enableButtons(); | |||
} | |||
/** Called when the Cancel button is pressed */ | |||
private void clickCancel(java.awt.event.ActionEvent evt) { | |||
// Add your handling code here: | |||
setVisible(false); | |||
dispose(); | |||
_cancel = true; | |||
} | |||
/** Called when the OK button is pressed */ | |||
private void clickOK(java.awt.event.ActionEvent evt) { | |||
setVisible(false); | |||
dispose(); | |||
_cancel = false; | |||
_elementName = _elementText.getText(); | |||
} | |||
/** Closes the dialog */ | |||
private void closeDialog(java.awt.event.WindowEvent evt) { | |||
setVisible(false); | |||
dispose(); | |||
} | |||
/** | |||
* Test the dialog | |||
* | |||
* @param args the command line arguments | |||
*/ | |||
public static void main(String args[]) { | |||
new NewElementDlg(new javax.swing.JFrame(), true).show(); | |||
} | |||
} |
@@ -72,6 +72,8 @@ import java.lang.reflect.Constructor; | |||
public class ActionManager { | |||
/** Parameters for the Command constructor. */ | |||
private static final Class[] COMMAND_CTOR_PARAMS = { AppContext.class }; | |||
private static final Class[] COMMAND_CTOR_PARAMS_WITH_EVENT = | |||
{ AppContext.class, EventObject.class }; | |||
/** Externalized resources. */ | |||
private ResourceManager _resources = null; | |||
@@ -207,6 +209,12 @@ public class ActionManager { | |||
for(int i = 0; i < _actionIDs.length; i++) { | |||
AntAction action = (AntAction) _actions.get(_actionIDs[i]); | |||
// If the action is hidden do not display it. | |||
if(action.isHidden()) { | |||
continue; | |||
} | |||
// If it has an icon, then we add it to the toolbar. | |||
if(action.getIcon() != null) { | |||
if(action.isPreceededBySeparator()) { | |||
@@ -232,22 +240,39 @@ public class ActionManager { | |||
return retval; | |||
} | |||
/** | |||
/** | |||
* Create a popup menu with the given actionIDs. | |||
* XXX check this for object leak. Does the button | |||
* get added to the action as a listener? There are also some | |||
* changes to this behavior in 1.3. | |||
* | |||
* XXX check this for object leak. Does the button | |||
* get added to the action as a listener? There are also some | |||
* changes to this behavior in 1.3. | |||
* | |||
* @param actionIDs List of action IDs for actions | |||
* to appear in popup menu. | |||
* to appear in popup menu. | |||
* @param defaultID Use this action ID if the item | |||
* from the list is not found. | |||
* @return Popup menu to display. | |||
*/ | |||
public JPopupMenu createPopup(String[] actionIDs) { | |||
public JPopupMenu createPopup(String[] actionIDs, String defaultID) { | |||
JPopupMenu retval = new JPopupMenu(); | |||
for(int i = 0; i < actionIDs.length; i++) { | |||
AntAction action = (AntAction) _actions.get(actionIDs[i]); | |||
if(action != null) { | |||
// If the ID is not found, use the default. | |||
if (action == null && defaultID != null) { | |||
action = (AntAction) _actions.get(defaultID); | |||
AbstractButton button = retval.add(action); | |||
// Set the button text to the action ID. | |||
button.setText(actionIDs[i]); | |||
addNiceStuff(button, action); | |||
} else { | |||
if(action.isPopupPreceededBySeparator() && | |||
retval.getComponentCount() > 0) { | |||
retval.addSeparator(); | |||
} | |||
AbstractButton button = retval.add(action); | |||
addNiceStuff(button, action); | |||
} | |||
@@ -256,27 +281,37 @@ public class ActionManager { | |||
return retval; | |||
} | |||
/** | |||
/** | |||
* Get the command assocaited with the Action with the given id. | |||
* | |||
* | |||
* @param actionID Id of action to get command for. | |||
* @return Command associated with action, or null if none available. | |||
*/ | |||
public Command getActionCommand(String actionID, AppContext context) { | |||
public Command getActionCommand(String actionID, | |||
AppContext context, | |||
EventObject event) { | |||
Command retval = null; | |||
AntAction action = (AntAction) _actions.get(actionID); | |||
if(action != null) { | |||
Class clazz = action.getCommandClass(); | |||
if(clazz != null) { | |||
try { | |||
Constructor ctor = | |||
Constructor ctor = | |||
clazz.getConstructor(COMMAND_CTOR_PARAMS); | |||
retval = (Command) ctor.newInstance( | |||
new Object[] { context }); | |||
} | |||
catch(Exception ex) { | |||
// XXX log me. | |||
ex.printStackTrace(); | |||
try { | |||
Constructor ctor = clazz.getConstructor( | |||
COMMAND_CTOR_PARAMS_WITH_EVENT); | |||
retval = (Command) ctor.newInstance( | |||
new Object[] { context, event }); | |||
} | |||
catch (Exception ex2) { | |||
// XXX log me. | |||
ex.printStackTrace(); | |||
} | |||
} | |||
} | |||
} | |||
@@ -73,6 +73,7 @@ public class AntAction extends AbstractAction { | |||
/** Property name for the parent menu item. */ | |||
public static final String PARENT_MENU_NAME = "parentMenuName"; | |||
public static final String SEPARATOR = "separator"; | |||
public static final String POPUP_SEPARATOR = "popupSeparator"; | |||
public static final String ACCELERATOR = "accelerator"; | |||
public static final String ENABLED = "enabled"; | |||
public static final String ENABLE_ON = "enableOn"; | |||
@@ -81,6 +82,7 @@ public class AntAction extends AbstractAction { | |||
public static final String CHECKED_TRUE_ON = "checkedTrueOn"; | |||
public static final String CHECKED_FALSE_ON = "checkedFalseOn"; | |||
public static final String COMMAND = "command"; | |||
public static final String HIDDEN = "hidden"; | |||
/** Property resources. */ | |||
private ResourceManager _resources = null; | |||
@@ -118,6 +120,8 @@ public class AntAction extends AbstractAction { | |||
putValue(SHORT_DESCRIPTION, getString("shortDescription")); | |||
putValue(PARENT_MENU_NAME, getString(PARENT_MENU_NAME)); | |||
putValue(SEPARATOR, getString(SEPARATOR)); | |||
putValue(POPUP_SEPARATOR, getString(POPUP_SEPARATOR)); | |||
putValue(HIDDEN, getString(HIDDEN)); | |||
// Set the default enabled state. | |||
@@ -268,6 +272,28 @@ public class AntAction extends AbstractAction { | |||
return (Icon) getValue(SMALL_ICON); | |||
} | |||
/** | |||
* Determine if a separator should appear before the action | |||
* when the popup menu is created. | |||
* | |||
* @return True if add separator, false otherwise. | |||
*/ | |||
public boolean isPopupPreceededBySeparator() { | |||
return Boolean.valueOf( | |||
String.valueOf(getValue(POPUP_SEPARATOR))).booleanValue(); | |||
} | |||
/** | |||
* Determine if the action is hidden and should not | |||
* be displayed from a button. | |||
* | |||
* @return True the action is hidden. | |||
*/ | |||
public boolean isHidden() { | |||
return Boolean.valueOf( | |||
String.valueOf(getValue(HIDDEN))).booleanValue(); | |||
} | |||
/** | |||
* Get the accelerator keystroke. | |||
* | |||
@@ -113,9 +113,8 @@ public class EventResponder { | |||
*/ | |||
public boolean eventPosted(EventObject event) { | |||
String command = ((ActionEvent)event).getActionCommand(); | |||
Command cmd = | |||
_context.getActions().getActionCommand(command, _context); | |||
_context.getActions().getActionCommand(command, _context, event); | |||
if(cmd != null) { | |||
cmd.run(); | |||
return false; | |||
@@ -0,0 +1,88 @@ | |||
/* | |||
* 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", "Ant", 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.event; | |||
import org.apache.tools.ant.gui.core.AppContext; | |||
import org.apache.tools.ant.gui.acs.ACSProjectElement; | |||
import org.apache.tools.ant.gui.acs.ACSElement; | |||
/** | |||
* FIX UP Nick | |||
*/ | |||
public class DeleteElementEvent extends AntEvent { | |||
ACSElement _element = null; | |||
/** | |||
* Standard ctor. | |||
* | |||
* @param context application context. | |||
*/ | |||
public DeleteElementEvent(AppContext context,ACSElement e) { | |||
super(context); | |||
if(e == null) { | |||
throw new IllegalArgumentException("A deleted element can't be null."); | |||
} | |||
_element = e; | |||
} | |||
/** | |||
* Get the newly added project. | |||
* | |||
* @return New project. | |||
*/ | |||
public ACSElement getDeletedElement() { | |||
return _element; | |||
} | |||
} |
@@ -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", "Ant", 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.event; | |||
import org.apache.tools.ant.gui.acs.ACSElement; | |||
import org.apache.tools.ant.gui.acs.ACSDtdDefinedElement; | |||
import org.apache.tools.ant.gui.core.AppContext; | |||
/** | |||
* Event indicating that a DtdDefined element was selected. | |||
* | |||
* @version $Revision$ | |||
* @author Nick Davis<a href="mailto:nick_home_account@yahoo.com">nick_home_account@yahoo.com</a> | |||
*/ | |||
public class DtdDefinedElementSelectionEvent extends ElementSelectionEvent { | |||
/** | |||
* Standard ctor. | |||
* | |||
* @param context application context. | |||
* @param selected the selected Elements. | |||
*/ | |||
public DtdDefinedElementSelectionEvent(AppContext context,ACSElement[] selected) { | |||
super(context, selected); | |||
} | |||
/** | |||
* Get the selected properties. | |||
*/ | |||
public ACSDtdDefinedElement[] getSelectedProperties() { | |||
return (ACSDtdDefinedElement[]) getFiltered(ACSDtdDefinedElement.class); | |||
} | |||
} |
@@ -132,19 +132,23 @@ public class ElementSelectionEvent extends AntEvent { | |||
if(selected != null && selected.length > 0) { | |||
Class type = selected[selected.length - 1].getClass(); | |||
if(type.isAssignableFrom(ACSTargetElement.class)) { | |||
if(ACSTargetElement.class.isAssignableFrom(type)) { | |||
retval = new TargetSelectionEvent(context, selected); | |||
} | |||
else if(type.isAssignableFrom(ACSTaskElement.class)) { | |||
else if(ACSTaskElement.class.isAssignableFrom(type)) { | |||
retval = new TaskSelectionEvent(context, selected); | |||
} | |||
else if(type.isAssignableFrom(ACSPropertyElement.class)) { | |||
else if(ACSPropertyElement.class.isAssignableFrom(type)) { | |||
retval = new PropertySelectionEvent(context, selected); | |||
} | |||
else if(type.isAssignableFrom(ACSProjectElement.class)) { | |||
else if(ACSProjectElement.class.isAssignableFrom(type)) { | |||
retval = new ProjectSelectedEvent( | |||
context, (ACSProjectElement) selected[0]); | |||
} | |||
else if(ACSDtdDefinedElement.class.isAssignableFrom(type)) { | |||
retval = new DtdDefinedElementSelectionEvent( | |||
context, selected); | |||
} | |||
else { | |||
// For elements without a specific event | |||
// type just send and instance of this. | |||
@@ -0,0 +1,91 @@ | |||
/* | |||
* 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", "Ant", 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.event; | |||
import org.apache.tools.ant.gui.core.AppContext; | |||
import org.apache.tools.ant.gui.acs.ACSProjectElement; | |||
import org.apache.tools.ant.gui.acs.ACSElement; | |||
/** | |||
* Event indicating that a new node was added. | |||
* | |||
* @version $Revision$ | |||
* @author Nick Davis<a href="mailto:nick_home_account@yahoo.com">nick_home_account@yahoo.com</a> | |||
*/ | |||
public class NewBaseElementEvent extends AntEvent implements NewElementEvent { | |||
ACSElement _element = null; | |||
/** | |||
* Standard ctor. | |||
* | |||
* @param context application context. | |||
*/ | |||
public NewBaseElementEvent(AppContext context,ACSElement e) { | |||
super(context); | |||
if(e == null) { | |||
throw new IllegalArgumentException("A new element can't be null."); | |||
} | |||
_element = e; | |||
} | |||
/** | |||
* Get the element. | |||
* | |||
* @return New project. | |||
*/ | |||
public ACSElement getNewElement() { | |||
return _element; | |||
} | |||
} |
@@ -0,0 +1,74 @@ | |||
/* | |||
* 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", "Ant", 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.event; | |||
import org.apache.tools.ant.gui.core.*; | |||
import org.apache.tools.ant.gui.command.*; | |||
/** | |||
* Request to show the console pane | |||
* | |||
* @version $Revision$ | |||
* @author Nick Davis<a href="mailto:nick_home_account@yahoo.com">nick_home_account@yahoo.com</a> | |||
*/ | |||
public class RefreshDisplayEvent extends AntEvent { | |||
/** | |||
* Standard ctor. | |||
* | |||
* @param context application context. | |||
*/ | |||
public RefreshDisplayEvent(AppContext context) { | |||
super(context); | |||
} | |||
} |
@@ -138,6 +138,9 @@ public class ElementNavigator extends AntModule { | |||
// The project node has changed. | |||
model.fireNodeChanged((ACSElement)event.getSource()); | |||
} | |||
else if(event instanceof RefreshDisplayEvent && model != null) { | |||
_tree.updateUI(); | |||
} | |||
else if(event instanceof NewElementEvent && model != null) { | |||
ACSElement element = ((NewElementEvent)event).getNewElement(); | |||
model.fireNodeAdded(element); | |||
@@ -145,6 +148,9 @@ public class ElementNavigator extends AntModule { | |||
_selections.setSelectionPath(path); | |||
_tree.scrollPathToVisible(path); | |||
} | |||
else if(event instanceof DeleteElementEvent && model != null) { | |||
_tree.updateUI(); | |||
} | |||
else { | |||
ACSProjectElement project = null; | |||
if(event instanceof ProjectSelectedEvent) { | |||
@@ -163,11 +169,31 @@ public class ElementNavigator extends AntModule { | |||
ElementSelectionEvent.createEvent(getContext(), null); | |||
} | |||
else { | |||
_tree.setModel(new ElementTreeModel(project)); | |||
_selections = new ElementTreeSelectionModel(); | |||
_selections.addTreeSelectionListener( | |||
new SelectionForwarder()); | |||
_tree.setSelectionModel(_selections); | |||
boolean updateModel = false; | |||
TreeModel testModel = _tree.getModel(); | |||
// Set the model if's not an ElementTreeModel | |||
if (testModel instanceof ElementTreeModel) { | |||
ElementTreeModel etm = (ElementTreeModel) testModel; | |||
ACSProjectElement currentProject = | |||
(ACSProjectElement) etm.getRoot(); | |||
// Set the model if the project is wrong | |||
if (currentProject != project) { | |||
updateModel = true; | |||
} | |||
} else { | |||
updateModel = true; | |||
} | |||
// Should we update the tree model | |||
if (updateModel) { | |||
_tree.setModel(new ElementTreeModel(project)); | |||
_selections = new ElementTreeSelectionModel(); | |||
_selections.addTreeSelectionListener( | |||
new SelectionForwarder()); | |||
_tree.setSelectionModel(_selections); | |||
} | |||
} | |||
} | |||
return true; | |||
@@ -195,7 +221,9 @@ public class ElementNavigator extends AntModule { | |||
return event instanceof ProjectSelectedEvent || | |||
event instanceof ProjectClosedEvent || | |||
event instanceof NewElementEvent || | |||
event instanceof PropertyChangeEvent; | |||
event instanceof PropertyChangeEvent || | |||
event instanceof DeleteElementEvent || | |||
event instanceof RefreshDisplayEvent; | |||
} | |||
} | |||
@@ -203,11 +231,42 @@ public class ElementNavigator extends AntModule { | |||
private class PopupHandler extends MouseAdapter { | |||
private void handle(MouseEvent e) { | |||
if(e.isPopupTrigger()) { | |||
ActionManager mgr = getContext().getActions(); | |||
JPopupMenu menu = mgr.createPopup( | |||
getContext().getResources().getStringArray( | |||
ElementNavigator.class, "popupActions")); | |||
menu.show((JComponent)e.getSource(), e.getX(), e.getY()); | |||
Object source = e.getSource(); | |||
String[] menuStr = null; | |||
JTree tree = (JTree) source; | |||
// Find the selected path. | |||
TreePath selPath = tree.getPathForLocation( | |||
e.getX(), e.getY()); | |||
if (selPath == null) { | |||
return; | |||
} | |||
// Update the selection. | |||
tree.setSelectionPath(selPath); | |||
// Find the selected object. | |||
Object selObj = selPath.getLastPathComponent(); | |||
String defaultID = null; | |||
// Does the item provide its own menu? | |||
if (selObj instanceof ACSInfoProvider) { | |||
ACSInfoProvider ip = (ACSInfoProvider) selObj; | |||
menuStr = ip.getMenuString(); | |||
defaultID = ip.getDefaultActionID(); | |||
} else { | |||
// Get the menu from the prop file. | |||
menuStr = getContext().getResources().getStringArray( | |||
ElementNavigator.class, defaultID); | |||
} | |||
// Should we create a menu? | |||
if (menuStr != null && menuStr.length != 0) { | |||
ActionManager mgr = getContext().getActions(); | |||
JPopupMenu menu = mgr.createPopup(menuStr, defaultID); | |||
menu.show((JComponent)e.getSource(), e.getX(), e.getY()); | |||
} | |||
} | |||
} | |||
@@ -4,7 +4,7 @@ menus=File, View, Build, Projects, Help | |||
# Declare the list of known actions. | |||
actions=\ | |||
new, open, save, saveas, close, exit, about, \ | |||
newTarget, newTask, newProperty \ | |||
newTarget, newElement, newProperty, deleteElement, \ | |||
startBuild, stopBuild, viewConsole | |||
# Configure the decalred actions. | |||
@@ -120,7 +120,8 @@ newTarget.disableOn=\ | |||
org.apache.tools.ant.gui.event.TaskSelectionEvent, \ | |||
org.apache.tools.ant.gui.event.PropertySelectionEvent, \ | |||
org.apache.tools.ant.gui.event.ProjectClosedEvent, \ | |||
org.apache.tools.ant.gui.event.NullSelectionEvent | |||
org.apache.tools.ant.gui.event.NullSelectionEvent, \ | |||
org.apache.tools.ant.gui.event.DtdDefinedElementSelectionEvent | |||
newTask.name=New Task | |||
newTask.shortDescription=Create a new task under the selected target | |||
@@ -133,7 +134,8 @@ newTask.disableOn=\ | |||
org.apache.tools.ant.gui.event.ProjectClosedEvent, \ | |||
org.apache.tools.ant.gui.event.TaskSelectionEvent, \ | |||
org.apache.tools.ant.gui.event.PropertySelectionEvent, \ | |||
org.apache.tools.ant.gui.event.NullSelectionEvent | |||
org.apache.tools.ant.gui.event.NullSelectionEvent, \ | |||
org.apache.tools.ant.gui.event.DtdDefinedElementSelectionEvent | |||
newProperty.name=New Property | |||
newProperty.shortDescription=Create a new property under the selected element | |||
@@ -148,7 +150,24 @@ newProperty.enableOn=\ | |||
newProperty.disableOn=\ | |||
org.apache.tools.ant.gui.event.PropertySelectionEvent, \ | |||
org.apache.tools.ant.gui.event.ProjectClosedEvent, \ | |||
org.apache.tools.ant.gui.event.NullSelectionEvent | |||
org.apache.tools.ant.gui.event.NullSelectionEvent, \ | |||
org.apache.tools.ant.gui.event.DtdDefinedElementSelectionEvent | |||
newElement.name=New Element | |||
newElement.shortDescription=Create a new element under the selected element | |||
newElement.icon=default.gif | |||
newElement.command=org.apache.tools.ant.gui.command.NewElementCmd | |||
newElement.enabled=true | |||
newElement.hidden=true | |||
newElement.popupSeparator=true | |||
deleteElement.name=Delete Element | |||
deleteElement.shortDescription=Delete the selected element | |||
deleteElement.icon=default.gif | |||
deleteElement.command=org.apache.tools.ant.gui.command.DeleteElementCmd | |||
deleteElement.enabled=true | |||
deleteElement.hidden=true | |||
deleteElement.popupSeparator=true | |||
viewConsole.name=console | |||
viewConsole.shortDescription=Displays or hides the console pane | |||
@@ -108,6 +108,14 @@ org.apache.tools.ant.gui.acs.ACSTaskElementBeanInfo.namedValues=Attributes | |||
org.apache.tools.ant.gui.acs.ACSTaskElementBeanInfo.xmlString=XML Code | |||
org.apache.tools.ant.gui.acs.ACSTaskElementBeanInfo.icon=task.gif | |||
org.apache.tools.ant.gui.acs.ACSDtdDefinedElementBeanInfo.beanName= | |||
org.apache.tools.ant.gui.acs.ACSDtdDefinedElementBeanInfo.beanDescription=\ | |||
A scoped property | |||
org.apache.tools.ant.gui.acs.ACSDtdDefinedElementBeanInfo.taskType=Type | |||
org.apache.tools.ant.gui.acs.ACSDtdDefinedElementBeanInfo.namedValues=\ | |||
Attributes | |||
org.apache.tools.ant.gui.acs.ACSDtdDefinedElementBeanInfo.xmlString=XML Code | |||
org.apache.tools.ant.gui.acs.ACSDtdDefinedElementBeanInfo.icon=default.gif | |||
org.apache.tools.ant.gui.command.NewProjectCmd.defName=New Project | |||
org.apache.tools.ant.gui.command.NewTargetCmd.defName=New Target | |||