Thread: [Jsxe-cvs] SF.net SVN: jsxe: [901] branches/jsxe2
Status: Inactive
Brought to you by:
ian_lewis
From: <ian...@us...> - 2006-06-05 23:51:26
|
Revision: 901 Author: ian_lewis Date: 2006-06-03 23:06:10 -0700 (Sat, 03 Jun 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=901&view=rev Log Message: ----------- added XMLElement to model element nodes Modified Paths: -------------- branches/jsxe2/Changelog branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLNode.java Added Paths: ----------- branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLElement.java Modified: branches/jsxe2/Changelog =================================================================== --- branches/jsxe2/Changelog 2006-06-04 01:54:23 UTC (rev 900) +++ branches/jsxe2/Changelog 2006-06-04 06:06:10 UTC (rev 901) @@ -1,3 +1,7 @@ +06/04/2006 Ian Lewis <Ian...@me...> + + * XMLElement was added to model element nodes + 06/03/2006 Ian Lewis <Ian...@me...> * Added the XMLException class for use in handling XML errors Added: branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLElement.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLElement.java (rev 0) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLElement.java 2006-06-04 06:06:10 UTC (rev 901) @@ -0,0 +1,62 @@ +/* +XMLElement.java +:tabSize=4:indentSize=4:noTabs=true: +:folding=explicit:collapseFolds=1: + +Copyright (C) 2006 Ian Lewis (Ian...@me...) + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +Optionally, you may find a copy of the GNU General Public License +from http://www.fsf.org/copyleft/gpl.txt +*/ + +package net.sourceforge.jsxe.dom; + +//{{{ Imports +import java.util.HashMap; +//}}} + +/** + * The XMLElement class represents an element in the XMLDocument tree. It allows + * attibute modifications which will translate to text modifications in the + * XMLDocument. + * @author Ian Lewis (<a href="mailto:Ian...@me...">Ian...@me...</a>) + * @version $Id$ + * @see XMLDocument + * @since jsXe 0.5 pre1 + */ +public class XMLElement extends XMLNode { + + //{{{ XMLElement constructor + /** + * Creates a new XMLElement + * @param document the document that owns this element + */ + XMLElement(XMLDocument document) { + m_attributes = new HashMap(); + }//}}} + + //{{{ getAttributes() + /** + * Returns a HashMap of attribute names to XMLAttribute objects. + */ + public HashMap getAttributes() { + return m_attributes; + }//}}} + + //{{{ Private Members + private HashMap m_attributes; + //}}} +} Property changes on: branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLElement.java ___________________________________________________________________ Name: svn:executable + * Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLNode.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLNode.java 2006-06-04 01:54:23 UTC (rev 900) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLNode.java 2006-06-04 06:06:10 UTC (rev 901) @@ -43,7 +43,7 @@ /** * <p>The XMLNode class is meant to represent an XMLNode in a XMLDocument tree * but also as a section of text within that document tree. It - * allows tree and attribute modifications only, however these modifications + * allows tree modifications only, however these modifications * will correspond to text modifications to the XMLDocument. Direct text * modifications are only allowed at the XMLDocument level.</p> * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ian...@us...> - 2006-06-06 01:31:26
|
Revision: 899 Author: ian_lewis Date: 2006-06-03 18:53:46 -0700 (Sat, 03 Jun 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=899&view=rev Log Message: ----------- Added the XMLNodeListener class for use in notifying objects concerning changes to nodes Updated the XMLNode class to have a simple implementation of an XML Node editing interface AdapterNode and AdapterNodeListener are now deprecated Updated the Changelog Modified Paths: -------------- branches/jsxe2/Changelog branches/jsxe2/src/net/sourceforge/jsxe/dom/AdapterNode.java branches/jsxe2/src/net/sourceforge/jsxe/dom/AdapterNodeListener.java branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLNode.java Added Paths: ----------- branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLNodeListener.java Modified: branches/jsxe2/Changelog =================================================================== --- branches/jsxe2/Changelog 2006-06-03 22:41:07 UTC (rev 898) +++ branches/jsxe2/Changelog 2006-06-04 01:53:46 UTC (rev 899) @@ -1,3 +1,8 @@ +06/03/2006 Ian Lewis <Ian...@me...> + + * Added the XMLException class for use in handling XML errors + * Updated the XMLNode class to support a simple interface for Node editing. + 06/01/2006 Ian Lewis <Ian...@me...> * Added insertUpdate and removeUpdate methods to the XMLDocumentListener Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom/AdapterNode.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom/AdapterNode.java 2006-06-03 22:41:07 UTC (rev 898) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom/AdapterNode.java 2006-06-04 01:53:46 UTC (rev 899) @@ -62,6 +62,7 @@ * @version $Id$ * @see XMLDocument * @see XMLDocument#addAdapterNode(AdapterNode, String, String, short) + * @deprecated */ public class AdapterNode { Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom/AdapterNodeListener.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom/AdapterNodeListener.java 2006-06-03 22:41:07 UTC (rev 898) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom/AdapterNodeListener.java 2006-06-04 01:53:46 UTC (rev 899) @@ -46,6 +46,9 @@ //}}} +/** + * @deprecated + */ public interface AdapterNodeListener { //{{{ nodeAdded() Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLNode.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLNode.java 2006-06-03 22:41:07 UTC (rev 898) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLNode.java 2006-06-04 01:53:46 UTC (rev 899) @@ -31,6 +31,7 @@ import net.sourceforge.jsxe.util.Log; import net.sourceforge.jsxe.util.MiscUtilities; import net.sourceforge.jsxe.dom.completion.*; +import net.sourceforge.jsxe.gui.Messages; //}}} //{{{ Java Base Classes @@ -119,7 +120,7 @@ * <p>Adds an XMLNodeListener to be notified when this node changes</p> * @param listener the listener to add */ - public void addAdapterNodeListener(XMLNodeListener listener) { + public void addXMLNodeListener(XMLNodeListener listener) { m_listeners.add(listener); }//}}} @@ -128,7 +129,7 @@ * <p>Removes a listener from this node if it exists</p> * @param listener the listener to remove */ - public void removeAdapterNodeListener(XMLNodeListener listener) { + public void removeXMLNodeListener(XMLNodeListener listener) { m_listeners.remove(m_listeners.indexOf(listener)); }//}}} @@ -194,23 +195,24 @@ * @param type the type of the new child node * @param index the index where to add the new child node. * @return the new child that was created - * @throws DOMException INVALID_CHARACTER_ERR: Raised if the specified name + * @throws XMLException INVALID_CHARACTER_ERR: Raised if the specified name * or value contains an illegal character. - * @throws DOMException NOT_SUPPORTED_ERR: Raised if the node type is not + * @throws XMLException NOT_SUPPORTED_ERR: Raised if the node type is not * supported. - * @throws DOMException HIERARCHY_REQUEST_ERR: Raised if this node is of a + * @throws XMLException HIERARCHY_REQUEST_ERR: Raised if this node is of a * type that does not allow children of the type of the * newChild node, or if the node to append is one of this * node's ancestors or this node itself. - * @throws DOMException NO_MODIFICATION_ALLOWED_ERR: Raised if this node is + * @throws XMLException NO_MODIFICATION_ALLOWED_ERR: Raised if this node is * readonly or if the previous parent of the node being * inserted is readonly. */ - public XMLNode addAdapterNode(String name, String value, short type, int index) throws DOMException { + public XMLNode addChildNode(String name, String value, short type, int index) throws XMLException { //TODO: error checking //TODO: update the XMLDocument text //TODO: create node and add it to m_children. //TODO: notify listeners that the document has changed. + return null; }//}}} //{{{ addChildNode() @@ -219,22 +221,22 @@ * is added after all child nodes that this node contains. * @param node the node to be added. * @return a reference to the node that was added. - * @throws DOMException HIERARCHY_REQUEST_ERR: Raised if this node is of a + * @throws XMLException HIERARCHY_REQUEST_ERR: Raised if this node is of a * type that does not allow children of the type of the * newChild node, or if the node to append is one of this * node's ancestors or this node itself. - * @throws DOMException WRONG_DOCUMENT_ERR: Raised if newChild was created + * @throws XMLException WRONG_DOCUMENT_ERR: Raised if newChild was created * from a different document than the one that created * this node. - * @throws DOMException NO_MODIFICATION_ALLOWED_ERR: Raised if this node is + * @throws XMLException NO_MODIFICATION_ALLOWED_ERR: Raised if this node is * readonly or if the previous parent of the node being * inserted is readonly. */ - public XMLNode addXMLNode(XMLNode node) throws DOMException { + public XMLNode addChildNode(XMLNode node) throws XMLException { //TODO: error checking //TODO: updated XMLDocument text //TODO: update listeners that the doc has changed - m_children.add(node); + return addChildNodeAt(node, getChildCount()); }//}}} //{{{ addChildNodeAt() @@ -248,47 +250,47 @@ * @param node the node to add to this parent node. * @param index the index to add it at. * @return the node added. - * @throws DOMException HIERARCHY_REQUEST_ERR: Raised if this node is of a + * @throws XMLException HIERARCHY_REQUEST_ERR: Raised if this node is of a * type that does not allow children of the type of the * newChild node, or if the node to append is one of this * node's ancestors or this node itself. - * @throws DOMException WRONG_DOCUMENT_ERR: Raised if newChild was created + * @throws XMLException WRONG_DOCUMENT_ERR: Raised if newChild was created * from a different document than the one that created * this node. - * @throws DOMException NO_MODIFICATION_ALLOWED_ERR: Raised if this node is + * @throws XMLException NO_MODIFICATION_ALLOWED_ERR: Raised if this node is * readonly or if the previous parent of the node being * inserted is readonly. */ - public XMLNode addChildNodeAt(XMLNode node, int index) throws DOMException { + public XMLNode addChildNodeAt(XMLNode node, int index) throws XMLException { //TODO: error checking //TODO: updated XMLDocument text //TODO: update listeners that the doc has changed - m_children.add(index, node); + if (index >= 0 && index < getChildCount()) { + m_children.add(index, node); + } else { + if (index == getChildCount()) { + m_children.add(node); + } else { + throw new XMLException(XMLException.INDEX_SIZE_ERR, Messages.getMessage("Index.Out.Of.Bounds.Error")); + } + } + return node; }//}}} //{{{ remove() /** * <p>Removes a child from this node.</p> * @param child the child node to remove from this node - * @throws DOMException NO_MODIFICATION_ALLOWED_ERR: Raised if this node is + * @throws XMLException NO_MODIFICATION_ALLOWED_ERR: Raised if this node is * readonly. - * @throws DOMException NOT_FOUND_ERR: Raised if oldChild is not + * @throws XMLException NOT_FOUND_ERR: Raised if oldChild is not * a child of this node. */ - public void remove(XMLNode child) throws DOMException { - if (child != null) { - if (getNodeType() == DOCUMENT_NODE && getNodeType() == Node.ELEMENT_NODE) { - throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "You cannot remove the root element node."); - } - if (child.getNodeType() != Node.DOCUMENT_TYPE_NODE) { - m_domNode.removeChild(child.getNode()); - m_children.remove(child); - child.setParent(null); - fireNodeRemoved(this, child); - } else { - throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Cannot remove Document Type Nodes"); - } - } + public void remove(XMLNode child) throws XMLException { + //TODO: error checking + //TODO: updated XMLDocument text + //TODO: update listeners that the doc has changed + m_children.remove(child); }//}}} //{{{ getNodeName() @@ -314,14 +316,14 @@ /** * <p>Sets the local name of the node.</p> * @param newValue the new local name for this node - * @throws DOMException INVALID_CHARACTER_ERR: Raised if the specified name + * @throws XMLException INVALID_CHARACTER_ERR: Raised if the specified name * contains an illegal character. */ - public void setLocalName(String localName) throws DOMException { + public void setLocalName(String localName) throws XMLException { //checking for illegal characters etc will be done by subclasses. - m_localName = localName; //TODO: Notify listeners that the local name has changed //TODO: Update XMLDocument text with the change. + m_localName = localName; }//}}} //{{{ getNSPrefix() @@ -339,12 +341,12 @@ * Sets the namespace prefix for this node. To remove this node from a * namespace this method should be passed null. * @param prefix The new prefix for this node - * @throws DOMException INVALID_CHARACTER_ERR: Raised if the specified + * @throws XMLException INVALID_CHARACTER_ERR: Raised if the specified * prefix contains an illegal character, per the * XML 1.0 specification . - * @throws DOMException NO_MODIFICATION_ALLOWED_ERR: Raised if this node is + * @throws XMLException NO_MODIFICATION_ALLOWED_ERR: Raised if this node is * readonly. - * @throws DOMException NAMESPACE_ERR: Raised if the specified prefix is + * @throws XMLException NAMESPACE_ERR: Raised if the specified prefix is * malformed per the Namespaces in XML specification, * if the namespaceURI of this node is null, if the * specified prefix is "xml" and the namespaceURI of @@ -356,11 +358,11 @@ * an attribute and the qualifiedName of this node is * "xmlns" . */ - public void setNSPrefix(String prefix) throws DOMException { + public void setNSPrefix(String prefix) throws XMLException { //TODO: Error checking - m_namespacePrefix = prefix; //TODO: Notify listeners that the namespaces has changed //TODO: Updated XMLDocument text with the change + m_namespacePrefix = prefix; }//}}} //{{{ getProperty() Added: branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLNodeListener.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLNodeListener.java (rev 0) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLNodeListener.java 2006-06-04 01:53:46 UTC (rev 899) @@ -0,0 +1,39 @@ +/* +XMLNodeListener.java +:tabSize=4:indentSize=4:noTabs=true: +:folding=explicit:collapseFolds=1: + +Copyright (C) 2006 Ian Lewis (Ian...@me...) + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +Optionally, you may find a copy of the GNU General Public License +from http://www.fsf.org/copyleft/gpl.txt +*/ + +package net.sourceforge.jsxe.dom; + +/** + * XMLNodeListener is used to notify objects of a change to a specific XMLNode. + * These changes can occur via changes to the text or document structure. Both + * are maintained by the XMLDocument class. + * + * @author Ian Lewis (<a href="mailto:Ian...@me...">Ian...@me...</a>) + * @version $Id$ + * @since jsXe 0.5 pre1 + * @see XMLDocument + */ +public interface XMLNodeListener { + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ian...@us...> - 2006-07-08 18:22:22
|
Revision: 1003 Author: ian_lewis Date: 2006-07-08 11:22:12 -0700 (Sat, 08 Jul 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1003&view=rev Log Message: ----------- Added a new XMLDocumentType class Added factory methods for XMLElements and XMLAttributes to the XMLDocument class. Modified Paths: -------------- branches/jsxe2/Changelog branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLNode.java Added Paths: ----------- branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocumentType.java Modified: branches/jsxe2/Changelog =================================================================== --- branches/jsxe2/Changelog 2006-07-08 15:57:53 UTC (rev 1002) +++ branches/jsxe2/Changelog 2006-07-08 18:22:12 UTC (rev 1003) @@ -5,6 +5,9 @@ * Created an new XMLDocument class. * Made use of the DOM events model to allow users to register DOM event listeners. + * Added a new XMLDocumentType class + * Added factory methods for XMLElements and XMLAttributes to the + XMLDocument class. 06/04/2006 Ian Lewis <Ian...@me...> Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java 2006-07-08 15:57:53 UTC (rev 1002) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java 2006-07-08 18:22:12 UTC (rev 1003) @@ -58,9 +58,12 @@ * provided to allow user objects to interact with the XML document as text * or as a tree structure seamlessly. * + * Properties of XMLDocuments are saved by jsXe as string values. And are loaded + * later when if the document was loaded recently. + * * @author Ian Lewis (<a href="mailto:Ian...@me...">Ian...@me...</a>) * @version $Id: XMLDocument.java 999 2006-07-07 20:59:23Z ian_lewis $ - * @see AdapterNode + * @see XMLNode */ public class XMLDocument /* implements javax.swing.text.Document */ { @@ -217,7 +220,13 @@ }//}}} //{{{ putProperty() - + /** + * Add a property to the XMLDocument. + * They are saved in memory as objects however, jsXe saves properties as + * Strings when saving the Document to the recent buffers file, and when + * the document is opened later the property will be loaded as a String. + * Generally String properties are stored here. + */ public void putProperty(Object key, Object value) { m_properties.put(key, value); }//}}} @@ -261,6 +270,45 @@ //}}} + //{{{ getDocumentType() + + public XMLDocumentType getDocumentType() { + DocumentType docType = m_document.getDocType(); + if (docType != null) { + return (XMLDocumentType)docType.getUserData(USER_DATA_KEY); + } else { + return null; + } + }//}}} + + //{{{ getProperties() + + public Map getProperties() { + return m_properties; + }//}}} + + //{{{ Node Factory methods + + //{{{ newElementNode() + /** + * Create a new XMLElement node with the given name. + * @param name the qualified name of the new node. + */ + public XMLElement newElementNode(String name) throws DOMException { + return new XMLElement(m_document.createElementNS("", name)); + }//}}} + + //{{{ newAttributeNode() + /** + * Create a new XMLAttribute node with the given name. + * @param name the qualified name of the new node. + */ + public XMLAttribute newAttributeNode(String name) throws DOMException { + return new XMLAttribute(m_document.createAttributeNS("", name)); + }//}}} + + //}}} + //{{{ Private members //{{{ ContentManager class Added: branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocumentType.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocumentType.java (rev 0) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocumentType.java 2006-07-08 18:22:12 UTC (rev 1003) @@ -0,0 +1,77 @@ +/* +XMLDocumentType.java +:tabSize=4:indentSize=4:noTabs=true: +:folding=explicit:collapseFolds=1: + +Copyright (C) 2006 Ian Lewis (Ian...@me...) + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +Optionally, you may find a copy of the GNU General Public License +from http://www.fsf.org/copyleft/gpl.txt +*/ + +package net.sourceforge.jsxe.dom2; + +//{{{ Imports + +//{{{ Swing classes +import javax.swing.text.*; +//}}} + +//{{{ DOM classes +import org.w3c.dom.*; +import org.w3c.dom.events.*; +//}}} + +//}}} + +/** + * XMLDocumentType represents a Document Type node in an XML Document. + * It is generated from the DTD and contains element, attribute and entity + * delarations.. + * + * @author Ian Lewis (<a href="mailto:Ian...@me...">Ian...@me...</a>) + * @version $Id$ + * @see XMLDocument + */ +public class XMLDocumentType extends XMLNode { + + //{{{ XMLDocumentType constructor + /** + * Creates a new Document Type node. + * @param docType the DocumentType node that this node wraps + */ + XMLDocumentType(DocumentType docType) { + super(docType); + }//}}} + + //{{{ getPublicId() + /** + * The system identifier of the external subset. + * This may be an absolute URI or not. + */ + public String getPublicId() { + return ((DocumentType)getNode()).getPublicId(); + }//}}} + + //{{{ getPublicId() + /** + * The public identifier of the external subset. + */ + public String getSystemId() { + return ((DocumentType)getNode()).getSystemId(); + }//}}} + +} Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLNode.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLNode.java 2006-07-08 15:57:53 UTC (rev 1002) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLNode.java 2006-07-08 18:22:12 UTC (rev 1003) @@ -60,7 +60,7 @@ */ public abstract class XMLNode /* implements javax.swing.text.Element */ { - static final String USER_DATA_KEY = "net.sourceforge.jsxe.dom.XMLNode"; + protected static final String USER_DATA_KEY = "net.sourceforge.jsxe.dom.XMLNode"; //{{{ Private members This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ian...@us...> - 2006-07-20 21:55:22
|
Revision: 1045 Author: ian_lewis Date: 2006-07-20 14:55:13 -0700 (Thu, 20 Jul 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1045&view=rev Log Message: ----------- dom2 package can now be compiled. Xerces 2.8.0 needs to be installed in the java endorsed dir now Modified Paths: -------------- branches/jsxe2/Changelog branches/jsxe2/build.xml branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLAttribute.java branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLElement.java Modified: branches/jsxe2/Changelog =================================================================== --- branches/jsxe2/Changelog 2006-07-20 18:38:42 UTC (rev 1044) +++ branches/jsxe2/Changelog 2006-07-20 21:55:13 UTC (rev 1045) @@ -1,3 +1,8 @@ +07/20/2006 Ian Lewis <Ian...@me...> + + * Xerces needs to be installed in the java endorsed directory now to make + use of DOM3 classes. + 06/08/2006 Ian Lewis <Ian...@me...> * XMLAttribute was added to the new data model. Modified: branches/jsxe2/build.xml =================================================================== --- branches/jsxe2/build.xml 2006-07-20 18:38:42 UTC (rev 1044) +++ branches/jsxe2/build.xml 2006-07-20 21:55:13 UTC (rev 1045) @@ -59,7 +59,8 @@ <!--<property name="app_version" value="${major.version}_${minor.version}beta"/>--> <property name="distbin.dir" value="${build.dir}/${app.name}-${app_version}-bin"/> <property name="distsrc.dir" value="${build.dir}/${app.name}-${app_version}-src"/> - <path id="classpath"> + + <path id="classpath"> <pathelement location="."/> <pathelement location="${build.dest}"/> <pathelement location="${build.src}"/> @@ -132,7 +133,7 @@ <mkdir dir="${build.dest}"/> <javac debug="${javac.debug}" deprecation="${javac.deprecation}" includeJavaRuntime="${javac.include.runtime}" optimize="${javac.optimize}" source="${javac.source}" destdir="${build.dest}" srcdir="${build.src}"> <classpath refid="classpath"/> - <include name="**/*.java"/> + <include name="**/*.java"/> </javac> <copy todir="${build.dest}"> <fileset dir="${build.src}"> Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLAttribute.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLAttribute.java 2006-07-20 18:38:42 UTC (rev 1044) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLAttribute.java 2006-07-20 21:55:13 UTC (rev 1045) @@ -71,7 +71,7 @@ //{{{ isId() public boolean isId() { - return ((Attr)getNode()).getId(); + return ((Attr)getNode()).isId(); }//}}} } Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java 2006-07-20 18:38:42 UTC (rev 1044) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java 2006-07-20 21:55:13 UTC (rev 1045) @@ -41,6 +41,7 @@ import java.io.IOException; import java.io.Writer; import java.util.ArrayList; +import java.util.Map; import java.util.HashMap; //}}} @@ -273,9 +274,9 @@ //{{{ getDocumentType() public XMLDocumentType getDocumentType() { - DocumentType docType = m_document.getDocType(); + DocumentType docType = m_document.getDoctype(); if (docType != null) { - return (XMLDocumentType)docType.getUserData(USER_DATA_KEY); + return (XMLDocumentType)docType.getUserData(XMLNode.USER_DATA_KEY); } else { return null; } Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLElement.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLElement.java 2006-07-20 18:38:42 UTC (rev 1044) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLElement.java 2006-07-20 21:55:13 UTC (rev 1045) @@ -26,6 +26,10 @@ //{{{ Imports +//{{{ jsXe classes +import net.sourceforge.jsxe.util.MiscUtilities; +//}}} + //{{{ Swing classes import javax.swing.text.*; //}}} @@ -35,8 +39,14 @@ import org.w3c.dom.events.*; //}}} +//{{{ Java classes +import java.util.ArrayList; +import java.util.List; +import java.util.Map; //}}} +//}}} + /** * The XMLElement class represents an element in the XMLDocument tree. It allows * attibute modifications which will translate to text modifications in the @@ -103,7 +113,7 @@ * @param name the qualified name of the attribute */ public XMLAttribute getAttribute(String name) { - Element element = (org.w3c.dom.Element)getNode(); + org.w3c.dom.Element element = (org.w3c.dom.Element)getNode(); String localName = MiscUtilities.getLocalNameFromQualifiedName(name); String prefix = MiscUtilities.getNSPrefixFromQualifiedName(name); @@ -122,7 +132,7 @@ * @param value the value of the attribute */ public XMLAttribute setAttribute(String name, String value) throws DOMException { - Element element = (org.w3c.dom.Element)getNode(); + org.w3c.dom.Element element = (org.w3c.dom.Element)getNode(); String prefix = MiscUtilities.getNSPrefixFromQualifiedName(name); Attr newAttr; @@ -139,7 +149,7 @@ String uri = lookupNamespaceURI(prefix); element.setAttributeNS(uri,name,value); - newAttr = getAttributeNodeNS(uri, name, value); + newAttr = element.getAttributeNodeNS(uri, name); } else { /* setAttribute doesn't throw an error if the first character is @@ -150,13 +160,13 @@ throw new DOMException(DOMException.NAMESPACE_ERR, "An attribute name cannot have a ':' as the first character"); } element.setAttribute(name, value); - newAttr = getAttributeNode(name, value); + newAttr = element.getAttributeNode(name); } //create an XMLAttribute node for the new attribute if (newAttr != null) { - xmlAttr = new XMLAttribute(attr); - attr.setUserData(USER_DATA_KEY, xmlAttr, null); + XMLAttribute xmlAttr = new XMLAttribute(newAttr); + newAttr.setUserData(USER_DATA_KEY, xmlAttr, null); return xmlAttr; } return null; @@ -177,12 +187,13 @@ /** * @param index the index at which to remove an attribute. */ - public removeAttributeAt(int index) throws DOMException { - Element element = (org.w3c.dom.Element)getNode(); + public XMLAttribute removeAttributeAt(int index) throws DOMException { + org.w3c.dom.Element element = (org.w3c.dom.Element)getNode(); NamedNodeMap attrs = element.getAttributes(); if (attrs != null) { - removeAttribute(attrs.item(index).getNodeName()); + return removeAttribute(attrs.item(index).getNodeName()); } + return null; }//}}} //{{{ removeAttribute() @@ -190,7 +201,7 @@ * @param name The qualified name of the attribute. */ public XMLAttribute removeAttribute(String name) throws DOMException { - Element element = (org.w3c.dom.Element)getNode(); + org.w3c.dom.Element element = (org.w3c.dom.Element)getNode(); String prefix = MiscUtilities.getNSPrefixFromQualifiedName(name); String localName = MiscUtilities.getLocalNameFromQualifiedName(name); @@ -227,15 +238,22 @@ } } + XMLAttribute attr; + if (prefix != null && !prefix.equals("")) { - element.removeAttributeNS(lookupNamespaceURI(prefix),localName); + String uri = lookupNamespaceURI(prefix); + attr = (XMLAttribute)element.getAttributeNodeNS(uri, localName).getUserData(USER_DATA_KEY); + element.removeAttributeNS(uri,localName); } else { + attr = (XMLAttribute)element.getAttributeNode(localName).getUserData(USER_DATA_KEY); element.removeAttribute(localName); } + + return attr; }//}}} //{{{ getNodeType() - public int getNodeType() { + public short getNodeType() { return Node.ELEMENT_NODE; }//}}} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ian...@us...> - 2006-07-24 20:18:29
|
Revision: 1061 Author: ian_lewis Date: 2006-07-24 13:18:20 -0700 (Mon, 24 Jul 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1061&view=rev Log Message: ----------- Added XMLText and XMLComment node types Modified Paths: -------------- branches/jsxe2/RELEASE.CHECKLIST Added Paths: ----------- branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLComment.java branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLText.java Modified: branches/jsxe2/RELEASE.CHECKLIST =================================================================== --- branches/jsxe2/RELEASE.CHECKLIST 2006-07-24 20:09:47 UTC (rev 1060) +++ branches/jsxe2/RELEASE.CHECKLIST 2006-07-24 20:18:20 UTC (rev 1061) @@ -1,7 +1,36 @@ RELEASE CHECKLIST +*********Minor release********* + +* Update the Changelog file +* Update the NEWS file +* Update the README if needed +* Update the AUTHORS if needed +* Update the INSTALL file if needed +* Update the README if needed + +* Make a new tag in SVN for the release. + +* Update the jsXe website in SVN to reference the new versions +* Update the jsXe website in SVN to have the correct help and documentation. + * Run 'ant deploy-web-doc' + +Build the project + * Make sure the major.version, minor.version, beta.version, bugfix.version, + app.version, and app_version are correct in build.xml + * Build the release files using 'ant bin src' + +* Create new release on sourceforge + * Upload binary and source distribution to Sourceforge + * Add the NEWS and Changelog entries to the release. +* Update the News on the sourceforge project page. +* Update the freshmeat project with the new version and URLs. + +*********Major release********* + * Get translations finalized * Build the Java Doc and check it for omissions and errors. +* Make sure all bugs that have a priority above 5 are resolved. * Update the Changelog file * Update the NEWS file @@ -9,8 +38,11 @@ * Update the AUTHORS if needed * Update the INSTALL file if needed * Update the README if needed -* Update the jsXe website in CVS to reference the new versions -* Update the jsXe website in CVS to have the correct help and documentation. + +* Make a new tag in SVN for the release. + +* Update the jsXe website in SVN to reference the new versions +* Update the jsXe website in SVN to have the correct help and documentation. * Run 'ant deploy-web-doc' Build the project Added: branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLComment.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLComment.java (rev 0) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLComment.java 2006-07-24 20:18:20 UTC (rev 1061) @@ -0,0 +1,36 @@ +/* +XMLComment.java +:tabSize=4:indentSize=4:noTabs=true: +:folding=explicit:collapseFolds=1: + +Copyright (C) 2006 Ian Lewis (Ian...@me...) + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +Optionally, you may find a copy of the GNU General Public License +from http://www.fsf.org/copyleft/gpl.txt +*/ + +package net.sourceforge.jsxe.dom2; + +import org.w3c.dom.*; + +public class XMLComment extends XMLCharacterData { + + //{{{ XMLComment constructor + XMLComment(Comment comment) { + super(comment); + }//}}} + +} \ No newline at end of file Property changes on: branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLComment.java ___________________________________________________________________ Name: svn:executable + * Added: branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLText.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLText.java (rev 0) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLText.java 2006-07-24 20:18:20 UTC (rev 1061) @@ -0,0 +1,36 @@ +/* +XMLText.java +:tabSize=4:indentSize=4:noTabs=true: +:folding=explicit:collapseFolds=1: + +Copyright (C) 2006 Ian Lewis (Ian...@me...) + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +Optionally, you may find a copy of the GNU General Public License +from http://www.fsf.org/copyleft/gpl.txt +*/ + +package net.sourceforge.jsxe.dom2; + +import org.w3c.dom.*; + +public class XMLText extends XMLCharacterData { + + //{{{ XMLText constructor + XMLText(Text text) { + super(text); + }//}}} + +} \ No newline at end of file Property changes on: branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLText.java ___________________________________________________________________ Name: svn:executable + * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ian...@us...> - 2006-07-26 19:53:45
|
Revision: 1072 Author: ian_lewis Date: 2006-07-26 12:29:32 -0700 (Wed, 26 Jul 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1072&view=rev Log Message: ----------- added support for error nodes Modified Paths: -------------- branches/jsxe2/Changelog branches/jsxe2/messages/messages.en branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLCharacterData.java branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLElement.java branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLNode.java Modified: branches/jsxe2/Changelog =================================================================== --- branches/jsxe2/Changelog 2006-07-26 17:07:45 UTC (rev 1071) +++ branches/jsxe2/Changelog 2006-07-26 19:29:32 UTC (rev 1072) @@ -1,3 +1,11 @@ +07/26/2006 Ian Lewis <Ian...@me...> + + * Added support for error nodes in the new data model + +07/25/2006 Ian Lewis <Ian...@me...> + + * Added support for the read only attribute + 07/24/2006 Ian Lewis <Ian...@me...> * Added the XMLText, XMLComment, and XMLProcessingInstruction node Modified: branches/jsxe2/messages/messages.en =================================================================== --- branches/jsxe2/messages/messages.en 2006-07-26 17:07:45 UTC (rev 1071) +++ branches/jsxe2/messages/messages.en 2006-07-26 19:29:32 UTC (rev 1072) @@ -21,6 +21,8 @@ common.paste=Paste common.find=Find... common.findnext=Find Next +common.error=Error +common.warning=Warning #}}} @@ -123,10 +125,15 @@ No.Xerces.Error={0} not found. jsXe requires Apache {0}. No.Xerces.Error.Title={0} not found. IO.Error.Title=I/O Error + +#{{{ XML Messages +XML.Read.Only.Node=You cannot modify this node. The node is read only. #}}} #}}} +#}}} + #{{{ Dialogs #{{{ Download resource dialog Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLCharacterData.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLCharacterData.java 2006-07-26 17:07:45 UTC (rev 1071) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLCharacterData.java 2006-07-26 19:29:32 UTC (rev 1072) @@ -24,6 +24,8 @@ package net.sourceforge.jsxe.dom2; +import net.sourceforge.jsxe.gui.Messages; + import org.w3c.dom.*; public abstract class XMLCharacterData extends XMLNode { @@ -35,16 +37,25 @@ //{{{ appendData() public void append(String data) throws DOMException { + if (((XMLDocument)getDocument()).isReadOnly()) { + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, Messages.getMessage("XML.Read.Only.Node")); + } ((CharacterData)getNode()).appendData(data); }//}}} //{{{ deleteData() public void deleteData(int offset, int len) throws DOMException { + if (((XMLDocument)getDocument()).isReadOnly()) { + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, Messages.getMessage("XML.Read.Only.Node")); + } ((CharacterData)getNode()).deleteData(offset, len); }//}}} //{{{ insertData() public void insertData(int offset, String data) { + if (((XMLDocument)getDocument()).isReadOnly()) { + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, Messages.getMessage("XML.Read.Only.Node")); + } ((CharacterData)getNode()).insertData(offset, data); }//}}} Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java 2006-07-26 17:07:45 UTC (rev 1071) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java 2006-07-26 19:29:32 UTC (rev 1072) @@ -71,7 +71,7 @@ * @version $Id: XMLDocument.java 999 2006-07-07 20:59:23Z ian_lewis $ * @see XMLNode */ -public class XMLDocument /* implements javax.swing.text.Document */ { +public class XMLDocument implements javax.swing.text.Document { //{{{ XMLDocument defined properties /** @@ -160,7 +160,7 @@ Iterator propertyNames = properties.keySet().iterator(); while (propertyNames.hasNext()) { Object key = propertyNames.next(); - setProperty(key, properties.get(key)); + putProperty(key, properties.get(key)); } } @@ -419,6 +419,26 @@ return m_document.getXmlStandalone(); }//}}} + //{{{ isReadOnly() + /** + * Returns whether this document is currently read only. + */ + public boolean isReadOnly() { + return m_readOnly; + }//}}} + + //{{{ setReadOnly() + /** + * Sets this document to read only. Any attempts + * to change any attribute of this document or + * child nodes of this document will result in + * DOMExceptions being thrown. + * @param readOnly the value of the readOnly property + */ + public void setReadOnly(boolean readOnly) { + m_readOnly = readOnly; + }//}}} + //{{{ Node Factory methods //{{{ newElementNode() @@ -439,18 +459,28 @@ return new XMLAttribute(m_document.createAttributeNS("", name)); }//}}} + //{{{ newErrorNode() + /** + * Creates a new error node. + * @param message the error message + * @param warning true if the node is a warning, false if it's an error + */ + public XMLError newErrorNode(String message, boolean warning) { + return new XMLError(this, null, message, warning); + }//}}} + //}}} //{{{ Private members //{{{ setDefaultProperties() private void setDefaultProperties() { - setProperty(FORMAT_XML, "false"); - setProperty(IS_USING_SOFT_TABS, "false"); - setProperty(WS_IN_ELEMENT_CONTENT, "true"); - setProperty(ENCODING, "UTF-8"); - setProperty(INDENT, "4"); - setProperty(IS_VALIDATING, "false"); + putProperty(FORMAT_XML, "false"); + putProperty(IS_USING_SOFT_TABS, "false"); + putProperty(WS_IN_ELEMENT_CONTENT, "true"); + putProperty(ENCODING, "UTF-8"); + putProperty(INDENT, "4"); + putProperty(IS_VALIDATING, "false"); }//}}} //{{{ ContentManager class @@ -692,6 +722,8 @@ * in this document. */ private EntityResolver m_entityResolver; + + private boolean m_readOnly; //}}} } Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLElement.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLElement.java 2006-07-26 17:07:45 UTC (rev 1071) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLElement.java 2006-07-26 19:29:32 UTC (rev 1072) @@ -27,6 +27,7 @@ //{{{ Imports //{{{ jsXe classes +import net.sourceforge.jsxe.gui.Messages; import net.sourceforge.jsxe.util.MiscUtilities; //}}} @@ -175,6 +176,9 @@ //{{{ setAttribute() public XMLAttribute setAttribute(XMLAttribute attr) throws DOMException { + if (((XMLDocument)getDocument()).isReadOnly()) { + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, Messages.getMessage("XML.Read.Only.Node")); + } /* TODO: test how this works. Will I need to check for a namespace and call setAttributeNode() instead if there is none? @@ -188,6 +192,10 @@ * @param index the index at which to remove an attribute. */ public XMLAttribute removeAttributeAt(int index) throws DOMException { + if (((XMLDocument)getDocument()).isReadOnly()) { + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, Messages.getMessage("XML.Read.Only.Node")); + } + org.w3c.dom.Element element = (org.w3c.dom.Element)getNode(); NamedNodeMap attrs = element.getAttributes(); if (attrs != null) { @@ -201,6 +209,10 @@ * @param name The qualified name of the attribute. */ public XMLAttribute removeAttribute(String name) throws DOMException { + if (((XMLDocument)getDocument()).isReadOnly()) { + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, Messages.getMessage("XML.Read.Only.Node")); + } + org.w3c.dom.Element element = (org.w3c.dom.Element)getNode(); String prefix = MiscUtilities.getNSPrefixFromQualifiedName(name); Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLNode.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLNode.java 2006-07-26 17:07:45 UTC (rev 1071) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLNode.java 2006-07-26 19:29:32 UTC (rev 1072) @@ -28,6 +28,7 @@ //{{{ jsXe classes import net.sourceforge.jsxe.jsXe; +import net.sourceforge.jsxe.gui.Messages; import net.sourceforge.jsxe.util.Log; import net.sourceforge.jsxe.dom.completion.*; //}}} @@ -41,6 +42,8 @@ import javax.swing.text.*; //}}} +import java.util.ArrayList; + //}}} /** @@ -58,10 +61,55 @@ * @see XMLDocument * @since jsXe 0.5 pre2 */ -public abstract class XMLNode /* implements javax.swing.text.Element */ { +public abstract class XMLNode implements javax.swing.text.Element { protected static final String USER_DATA_KEY = "net.sourceforge.jsxe.dom.XMLNode"; + /** + * The node is an Attr. + */ + public static short ATTRIBUTE_NODE = Node.ATTRIBUTE_NODE; + /** + * The node is a CDATASection. + */ + public static short CDATA_SECTION_NODE = Node.CDATA_SECTION_NODE; + /** + * The node is a Comment. + */ + public static short COMMENT_NODE = Node.COMMENT_NODE; + /** + * The node is a DocumentType. + */ + public static short DOCUMENT_TYPE_NODE = Node.DOCUMENT_TYPE_NODE; + /** + * The node is an Element. + */ + public static short ELEMENT_NODE = Node.ELEMENT_NODE; + /** + * The node is an Entity. + */ + public static short ENTITY_NODE = Node.ENTITY_NODE; + /** + * The node is an EntityReference. + */ + public static short ENTITY_REFERENCE_NODE = Node.ENTITY_REFERENCE_NODE; + /** + * The node is a Notation. + */ + public static short NOTATION_NODE = Node.NOTATION_NODE; + /** + * The node is a ProcessingInstruction. + */ + public static short PROCESSING_INSTRUCTION_NODE = Node.PROCESSING_INSTRUCTION_NODE; + /** + * The node is a Text node. + */ + public static short TEXT_NODE = Node.TEXT_NODE; + /** + * The node is an Error node. + */ + public static short ERROR_NODE = Short.MAX_VALUE; + //{{{ Private members /** @@ -70,13 +118,21 @@ */ private Node m_domNode; + /** + * Used to keep track of children and XMLError nodes and keep them + * in the correct order. + */ + private ArrayList m_children = new ArrayList(); + //}}} //{{{ XMLNode constructor XMLNode(Node node) { m_domNode = node; //TODO: add UserDataHandler - m_domNode.setUserData(USER_DATA_KEY, this, null); + if (m_domNode != null) { + m_domNode.setUserData(USER_DATA_KEY, this, null); + } }//}}} //{{{ javax.swing.text.Element methods @@ -102,15 +158,22 @@ //{{{ getElement() public javax.swing.text.Element getElement(int index) { - return (javax.swing.text.Element)m_domNode.getChildNodes().item(index).getUserData(USER_DATA_KEY); + return (javax.swing.text.Element)m_children.get(index); }//}}} //{{{ getElementCount() public int getElementCount() { - return m_domNode.getChildNodes().getLength(); + return m_children.size(); }//}}} + //{{{ getElementIndex() + + public int getElementIndex(int offset) { + //TODO: implement offsets + return 0; + }//}}} + //{{{ getEndOffset() public int getEndOffset() { @@ -133,7 +196,7 @@ public javax.swing.text.Element getParentElement() { return (javax.swing.text.Element)m_domNode.getParentNode().getUserData(USER_DATA_KEY); - }//}}} + }//}}} //{{{ getStartOffset() @@ -163,8 +226,24 @@ //{{{ appendNode() public XMLNode appendNode(XMLNode newChild) throws DOMException { + if (((XMLDocument)getDocument()).isReadOnly()) { + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, Messages.getMessage("XML.Read.Only.Node")); + } - m_domNode.appendChild(newChild.getNode()); + if (newChild != null) { + if (!(newChild instanceof XMLError)) { + XMLNode parent = (XMLNode)newChild.getParentElement(); + if (parent != null) { + parent.removeNode(newChild); + } + ((XMLError)newChild).setParent(this); + } + + m_children.add(newChild); + if (!(newChild instanceof XMLError)) { + m_domNode.appendChild(newChild.getNode()); + } + } return newChild; }//}}} @@ -202,7 +281,24 @@ //{{{ insertNode() public XMLNode insertNode(XMLNode node, int index) throws DOMException { - m_domNode.insertBefore(node.getNode(), m_domNode.getChildNodes().item(index)); + if (((XMLDocument)getDocument()).isReadOnly()) { + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, Messages.getMessage("XML.Read.Only.Node")); + } + + if (node != null) { + if (!(node instanceof XMLError)) { + XMLNode parent = (XMLNode)node.getParentElement(); + if (parent != null) { + parent.removeNode(node); + } + ((XMLError)node).setParent(this); + } + + m_children.add(index, node); + if (!(node instanceof XMLError)) { + m_domNode.insertBefore(node.getNode(), m_domNode.getChildNodes().item(index)); + } + } return node; }//}}} @@ -215,21 +311,40 @@ //{{{ removeNode() public XMLNode removeNode(XMLNode child) throws DOMException { - Node childNode = child.getNode(); - m_domNode.removeChild(childNode); - childNode.setUserData(USER_DATA_KEY, null, null); + if (((XMLDocument)getDocument()).isReadOnly()) { + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, Messages.getMessage("XML.Read.Only.Node")); + } + + if (child != null) { + m_children.remove(child); + if (!(child instanceof XMLError)) { + Node childNode = child.getNode(); + m_domNode.removeChild(childNode); + childNode.setUserData(USER_DATA_KEY, null, null); + } else { + ((XMLError)child).setParent(null); + } + } return child; }//}}} //{{{ setValue() public void setValue(String value) throws DOMException { + if (((XMLDocument)getDocument()).isReadOnly()) { + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, Messages.getMessage("XML.Read.Only.Node")); + } + m_domNode.setNodeValue(value); }//}}} //{{{ setNSPrefix() public void setNSPrefix(String prefix) throws DOMException { + if (((XMLDocument)getDocument()).isReadOnly()) { + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, Messages.getMessage("XML.Read.Only.Node")); + } + m_domNode.setPrefix(prefix); }//}}} @@ -238,6 +353,10 @@ * @param name the qualified name of the node. */ public void setName(String name) { + if (((XMLDocument)getDocument()).isReadOnly()) { + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, Messages.getMessage("XML.Read.Only.Node")); + } + m_domNode = m_domNode.getOwnerDocument().renameNode(m_domNode, m_domNode.getNamespaceURI(), name); }//}}} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ian...@us...> - 2006-07-27 18:02:29
|
Revision: 1078 Author: ian_lewis Date: 2006-07-27 11:02:07 -0700 (Thu, 27 Jul 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1078&view=rev Log Message: ----------- added libraries Added Paths: ----------- branches/jsxe2/lib/ branches/jsxe2/lib/gnu-regexp-1.1.4.jar branches/jsxe2/lib/resolver.jar branches/jsxe2/lib/xercesImpl.jar branches/jsxe2/lib/xml-apis.jar Removed Paths: ------------- branches/jsxe2/src/gnu/ Added: branches/jsxe2/lib/gnu-regexp-1.1.4.jar =================================================================== (Binary files differ) Property changes on: branches/jsxe2/lib/gnu-regexp-1.1.4.jar ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Added: branches/jsxe2/lib/resolver.jar =================================================================== (Binary files differ) Property changes on: branches/jsxe2/lib/resolver.jar ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Added: branches/jsxe2/lib/xercesImpl.jar =================================================================== (Binary files differ) Property changes on: branches/jsxe2/lib/xercesImpl.jar ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Added: branches/jsxe2/lib/xml-apis.jar =================================================================== (Binary files differ) Property changes on: branches/jsxe2/lib/xml-apis.jar ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ian...@us...> - 2006-07-29 15:52:34
|
Revision: 1093 Author: ian_lewis Date: 2006-07-29 08:52:20 -0700 (Sat, 29 Jul 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1093&view=rev Log Message: ----------- Added some more code for multi-threaded io Modified Paths: -------------- branches/jsxe2/Changelog branches/jsxe2/messages/messages branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java branches/jsxe2/src/net/sourceforge/jsxe/dom2/ls/XMLDocumentIORequest.java branches/jsxe2/src/net/sourceforge/jsxe/gui/ErrorListDialog.java branches/jsxe2/src/net/sourceforge/jsxe/io/VFSManager.java branches/jsxe2/src/net/sourceforge/jsxe/properties Added Paths: ----------- branches/jsxe2/src/net/sourceforge/jsxe/gui/ErrorListCellRenderer.java Modified: branches/jsxe2/Changelog =================================================================== --- branches/jsxe2/Changelog 2006-07-29 06:24:45 UTC (rev 1092) +++ branches/jsxe2/Changelog 2006-07-29 15:52:20 UTC (rev 1093) @@ -1,3 +1,7 @@ +07/29/2006 Ian Lewis <Ian...@me...> + + * Added some more code for multi-threaded IO support. + 07/28/2006 Ian Lewis <Ian...@me...> * Added some multi-threaded support. Modified: branches/jsxe2/messages/messages =================================================================== --- branches/jsxe2/messages/messages 2006-07-29 06:24:45 UTC (rev 1092) +++ branches/jsxe2/messages/messages 2006-07-29 15:52:20 UTC (rev 1093) @@ -185,6 +185,8 @@ DocumentBuffer.Loaded.Message={0} Loaded DocumentBuffer.Reloaded.Message={0} Reloaded +DocumentBuffer.Loading.Message=Loading {0} + #{0} plugin name DocumentView.Not.Found=No plugin a with name of {0} exists. @@ -229,8 +231,21 @@ #{{{ Error Messages No.Xerces.Error.message={0} not found. jsXe requires Apache {0}. No.Xerces.Error.title={0} not found. + +IO.Error.caption=The following {0} I/O operations could not be completed: +IO.Error.caption-1=The following {0} I/O operation could not be completed: + +IO.Error.Encoding.Error=Cannot load with "{0}" encoding.\n\ + ({1})\n\ + Try selecting a different encoding. +IO.Error.Read.Error=Cannot load: {0} +IO.Error.Write.Error=Cannot save: {0} + IO.Error.title=I/O Error IO.Error.message=An I/O error has occurred + +Out.Of.Memory.Error=There was insufficent Java heap memory to complete\n\ + this request. Try increasing the maximum heap size. #}}} #}}} Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java 2006-07-29 06:24:45 UTC (rev 1092) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java 2006-07-29 15:52:20 UTC (rev 1093) @@ -69,6 +69,7 @@ * @author Ian Lewis (<a href="mailto:Ian...@me...">Ian...@me...</a>) * @version $Id: XMLDocument.java 999 2006-07-07 20:59:23Z ian_lewis $ * @see XMLNode + * @since jsXe 0.5 pre3 */ public class XMLDocument { Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom2/ls/XMLDocumentIORequest.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/ls/XMLDocumentIORequest.java 2006-07-29 06:24:45 UTC (rev 1092) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/ls/XMLDocumentIORequest.java 2006-07-29 15:52:20 UTC (rev 1093) @@ -38,7 +38,9 @@ /** * A document I/O request. * @author Slava Pestov + * @author Ian Lewis (<a href="mailto:Ian...@me...">Ian...@me...</a>) * @version $Id$ + * @since jsXe 0.5 pre3 */ public class XMLDocumentIORequest extends WorkRequest { @@ -192,14 +194,14 @@ setAbortable(true); if (!buffer.isTemporary()) { - setStatus(jEdit.getProperty("vfs.status.load",args)); + setStatus(Messages.getMessage("DocumentBuffer.Loading.Message",args)); setProgressValue(0); } path = vfs._canonPath(session,path,view); - VFS.DirectoryEntry entry = vfs._getDirectoryEntry( - session,path,view); + VFS.DirectoryEntry entry = vfs._getDirectoryEntry(session,path,view); + long length; if (entry != null) { length = entry.length; @@ -214,11 +216,13 @@ read(autodetect(in),length,false); buffer.setNewFile(false); + } catch(CharConversionException ch) { Log.log(Log.ERROR,this,ch); - Object[] pp = { buffer.getProperty(Buffer.ENCODING), - ch.toString() }; - VFSManager.error(view,path,"ioerror.encoding-error",pp); + + Object[] pp = { buffer.getProperty(Buffer.ENCODING), ch.toString() }; + + VFSManager.error(view,path,"IO.Error.Encoding.Error",pp); buffer.setBooleanProperty(ERROR_OCCURRED,true); @@ -226,39 +230,38 @@ Log.log(Log.ERROR,this,uu); Object[] pp = { buffer.getProperty(Buffer.ENCODING), uu.toString() }; - VFSManager.error(view,path,"ioerror.encoding-error",pp); + VFSManager.error(view,path,"IO.Error.Encoding.Error",pp); buffer.setBooleanProperty(ERROR_OCCURRED,true); } catch(IOException io) { Log.log(Log.ERROR,this,io); Object[] pp = { io.toString() }; - VFSManager.error(view,path,"ioerror.read-error",pp); + VFSManager.error(view,path,"IO.Error.Read.Error",pp); buffer.setBooleanProperty(ERROR_OCCURRED,true); } catch(OutOfMemoryError oom) { Log.log(Log.ERROR,this,oom); - VFSManager.error(view,path,"out-of-memory-error",null); + VFSManager.error(view,path,"Out.Of.Memory.Error",null); buffer.setBooleanProperty(ERROR_OCCURRED,true); } - if (jEdit.getBooleanProperty("persistentMarkers")) { - try { - String[] args = { vfs.getFileName(path) }; - if (!buffer.isTemporary()) { - setStatus(jEdit.getProperty("vfs.status.load-markers",args)); - } - setAbortable(true); - - in = vfs._createInputStream(session,markersPath,true,view); - if(in != null) - readMarkers(buffer,in); - } catch(IOException io) { - // ignore - } - } + // if (jEdit.getBooleanProperty("persistentMarkers")) { + // try { + // String[] args = { vfs.getFileName(path) }; + // if (!buffer.isTemporary()) { + // setStatus(jEdit.getProperty("vfs.status.load-markers",args)); + // } + // setAbortable(true); + // in = vfs._createInputStream(session,markersPath,true,view); + // if(in != null) + // readMarkers(buffer,in); + // } catch(IOException io) { + // // ignore + // } + // } } catch(WorkThread.Abort a) { if (in != null) { try { @@ -274,7 +277,7 @@ } catch(IOException io) { Log.log(Log.ERROR,this,io); String[] pp = { io.toString() }; - VFSManager.error(view,path,"ioerror.read-error",pp); + VFSManager.error(view,path,"IO.Error.Read.Error",pp); buffer.setBooleanProperty(ERROR_OCCURRED,true); } catch(WorkThread.Abort a) { @@ -338,8 +341,7 @@ { // do not reset the stream and just treat it // like a normal UTF-8 file. - buffer.setProperty(Buffer.ENCODING, - MiscUtilities.UTF_8_Y); + buffer.setProperty(XMLDocument.ENCODING, MiscUtilities.UTF_8_Y); encoding = "UTF-8"; } else { @@ -356,8 +358,8 @@ break; } - String xmlPI = new String(_xmlPI,0,offset, - "ASCII"); + String xmlPI = new String(_xmlPI,0,offset, "ASCII"); + if (xmlPI.startsWith("<?xml")) { int index = xmlPI.indexOf("encoding="); if (index != -1 && index + 9 != xmlPI.length()) { @@ -366,7 +368,7 @@ encoding = xmlPI.substring(index + 10,endIndex); if (MiscUtilities.isSupportedEncoding(encoding)) { - buffer.setProperty(Buffer.ENCODING,encoding); + buffer.setProperty(XMLDocument.ENCODING, encoding); } else { Log.log(Log.WARNING,this,"XML PI specifies unsupported encoding: " + encoding); } Added: branches/jsxe2/src/net/sourceforge/jsxe/gui/ErrorListCellRenderer.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/gui/ErrorListCellRenderer.java (rev 0) +++ branches/jsxe2/src/net/sourceforge/jsxe/gui/ErrorListCellRenderer.java 2006-07-29 15:52:20 UTC (rev 1093) @@ -0,0 +1,117 @@ +/* +ErrorListCellRenderer.java +:tabSize=4:indentSize=4:noTabs=true: +:folding=explicit:collapseFolds=1: + +Copyright (C) 2001 Slava Pestov +Portions Copyright (C) 2006 Ian Lewis (Ian...@me...) + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +Optionally, you may find a copy of the GNU General Public License +from http://www.fsf.org/copyleft/gpl.txt +*/ + +package net.sourceforge.jsxe.gui; + +//{{{ Imports +import javax.swing.*; +import javax.swing.border.*; +import java.awt.*; +//}}} + +/** + * @author Slava Pestov + * @author Ian Lewis (<a href="mailto:Ian...@me...">Ian...@me...</a>) + * @version $Id$ + * @since jsXe 0.5 pre3 + */ +public class ErrorListCellRenderer extends JComponent implements ListCellRenderer { + + //{{{ ErrorListCellRenderer constructor + ErrorListCellRenderer() { + // GTK look and feel issues + plainFont = new JLabel().getFont(); + //UIManager.getFont("Label.font"); + boldFont = new Font(plainFont.getName(),Font.BOLD,plainFont.getSize()); + plainFM = getFontMetrics(plainFont); + boldFM = getFontMetrics(boldFont); + + setBorder(new EmptyBorder(2,2,2,2)); + } //}}} + + //{{{ getListCellRendererComponent() method + public Component getListCellRendererComponent(JList list, Object value, + int index, boolean isSelected, boolean cellHasFocus) + { + if (value instanceof ErrorListDialog.ErrorEntry) { + ErrorListDialog.ErrorEntry entry = (ErrorListDialog.ErrorEntry)value; + this.path = entry.path + ":"; + this.messages = entry.messages; + } else { + this.path = null; + this.messages = new String[] { value.toString() }; + } + + + return this; + } //}}} + + //{{{ getPreferredSize() method + public Dimension getPreferredSize() { + + int width = 0; + if (path != null) { + width = boldFM.stringWidth(path); + } + int height = boldFM.getHeight(); + for (int i = 0; i < messages.length; i++) { + width = Math.max(plainFM.stringWidth(messages[i]),width); + height += plainFM.getHeight(); + } + + Insets insets = getBorder().getBorderInsets(this); + width += insets.left + insets.right; + height += insets.top + insets.bottom; + + return new Dimension(width,height); + } //}}} + + //{{{ paintComponent() method + public void paintComponent(Graphics g) { + + Insets insets = getBorder().getBorderInsets(this); + int y = insets.top; + if (path != null) { + g.setFont(boldFont); + g.drawString(path,insets.left,insets.top + boldFM.getAscent()); + y = insets.top + boldFM.getHeight() + 2; + } + + g.setFont(plainFont); + for (int i = 0; i < messages.length; i++) { + g.drawString(messages[i],insets.left,y + plainFM.getAscent()); + y += plainFM.getHeight(); + } + } //}}} + + //{{{ Instance variables + private String path; + private String[] messages; + private Font plainFont; + private Font boldFont; + private FontMetrics plainFM; + private FontMetrics boldFM; + //}}} +} Modified: branches/jsxe2/src/net/sourceforge/jsxe/gui/ErrorListDialog.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/gui/ErrorListDialog.java 2006-07-29 06:24:45 UTC (rev 1092) +++ branches/jsxe2/src/net/sourceforge/jsxe/gui/ErrorListDialog.java 2006-07-29 15:52:20 UTC (rev 1093) @@ -44,79 +44,126 @@ */ public class ErrorListDialog extends EnhancedDialog { - //{{{ ErrorListDialog constructor - /** - * Creates a new ErrorListDialog. - * @param frame the parent component of this dialog - * @param title the title of the dialog - * @param caption the caption displayed on the dialog. - * @param messages a Vector containing objects used as error messages - * @param modal whether the dialog is modal - */ - public ErrorListDialog(Frame frame, String title, String caption, Vector messages, boolean modal) { - super(frame,title,modal); + //{{{ ErrorEntry class + public static class ErrorEntry { + + String path; + String[] messages; - JPanel content = new JPanel(new BorderLayout(12,12)); - content.setBorder(new EmptyBorder(12,12,12,12)); - setContentPane(content); + public ErrorEntry(String path, String messageProp, Object[] args) { + + this.path = path; - Box iconBox = new Box(BoxLayout.Y_AXIS); - iconBox.add(new JLabel(UIManager.getIcon("OptionPane.errorIcon"))); - iconBox.add(Box.createGlue()); - content.add(BorderLayout.WEST,iconBox); + String message = Messages.getMessage(messageProp,args); + if (message == null) { + message = "Undefined property: " + messageProp; + } - JPanel centerPanel = new JPanel(new BorderLayout()); + Log.log(Log.ERROR,this,path + ":"); + Log.log(Log.ERROR,this,message); - JLabel label = new JLabel(caption); - label.setBorder(new EmptyBorder(0,0,6,0)); - centerPanel.add(BorderLayout.NORTH,label); + Vector tokenizedMessage = new Vector(); + int lastIndex = -1; + for (int i = 0; i < message.length(); i++) { + + if (message.charAt(i) == '\n') { + tokenizedMessage.addElement(message.substring(lastIndex + 1,i)); + lastIndex = i; + } + } - JList errors = new JList(messages); - // errors.setCellRenderer(new ErrorListCellRenderer()); - errors.setVisibleRowCount(Math.min(Math.max(messages.size(),4),10)); + if (lastIndex != message.length()) { + tokenizedMessage.addElement(message.substring( + lastIndex + 1)); + } - // need this bullshit scroll bar policy for the preferred size - // hack to work - JScrollPane scrollPane = new JScrollPane(errors, - JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, - JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); - Dimension size = scrollPane.getPreferredSize(); - size.width = Math.max(size.width,400); - scrollPane.setPreferredSize(size); + messages = new String[tokenizedMessage.size()]; + tokenizedMessage.copyInto(messages); + } - centerPanel.add(BorderLayout.CENTER,scrollPane); + public boolean equals(Object o) { + if (o instanceof ErrorEntry) { + ErrorEntry e = (ErrorEntry)o; + return e.path.equals(path); + } else { + return false; + } + } + } //}}} + + //{{{ ErrorListDialog constructor + /** + * Creates a new ErrorListDialog. + * @param frame the parent component of this dialog + * @param title the title of the dialog + * @param caption the caption displayed on the dialog. + * @param messages a Vector containing ErrorEntry objects used as error messages + * @param modal whether the dialog is modal + */ + public ErrorListDialog(Frame frame, String title, String caption, Vector messages, boolean modal) { + super(frame,title,modal); - content.add(BorderLayout.CENTER,centerPanel); + JPanel content = new JPanel(new BorderLayout(12,12)); + content.setBorder(new EmptyBorder(12,12,12,12)); + setContentPane(content); - Box buttons = new Box(BoxLayout.X_AXIS); - buttons.add(Box.createGlue()); + Box iconBox = new Box(BoxLayout.Y_AXIS); + iconBox.add(new JLabel(UIManager.getIcon("OptionPane.errorIcon"))); + iconBox.add(Box.createGlue()); + content.add(BorderLayout.WEST,iconBox); - ok = new JButton("OK"); - ok.addActionListener(new ActionHandler()); + JPanel centerPanel = new JPanel(new BorderLayout()); - buttons.add(ok); + JLabel label = new JLabel(caption); + label.setBorder(new EmptyBorder(0,0,6,0)); + centerPanel.add(BorderLayout.NORTH,label); - buttons.add(Box.createGlue()); - content.add(BorderLayout.SOUTH,buttons); + JList errors = new JList(messages); + errors.setCellRenderer(new ErrorListCellRenderer()); + errors.setVisibleRowCount(Math.min(Math.max(messages.size(),4),10)); - getRootPane().setDefaultButton(ok); + // need this bullshit scroll bar policy for the preferred size + // hack to work + JScrollPane scrollPane = new JScrollPane(errors, + JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); + Dimension size = scrollPane.getPreferredSize(); + size.width = Math.max(size.width,400); + scrollPane.setPreferredSize(size); - pack(); - setLocationRelativeTo(frame); - setVisible(true); - } //}}} + centerPanel.add(BorderLayout.CENTER,scrollPane); - //{{{ ok() method - public void ok() { - dispose(); - } //}}} + content.add(BorderLayout.CENTER,centerPanel); - //{{{ cancel() method - public void cancel(){ - dispose(); - } //}}} + Box buttons = new Box(BoxLayout.X_AXIS); + buttons.add(Box.createGlue()); - //{{{ Private members + ok = new JButton("OK"); + ok.addActionListener(new ActionHandler()); + + buttons.add(ok); + + buttons.add(Box.createGlue()); + content.add(BorderLayout.SOUTH,buttons); + + getRootPane().setDefaultButton(ok); + + pack(); + setLocationRelativeTo(frame); + setVisible(true); + } //}}} + + //{{{ ok() method + public void ok() { + dispose(); + } //}}} + + //{{{ cancel() method + public void cancel(){ + dispose(); + } //}}} + + //{{{ Private members private JButton ok; //{{{ ActionHandler class Modified: branches/jsxe2/src/net/sourceforge/jsxe/io/VFSManager.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/io/VFSManager.java 2006-07-29 06:24:45 UTC (rev 1092) +++ branches/jsxe2/src/net/sourceforge/jsxe/io/VFSManager.java 2006-07-29 15:52:20 UTC (rev 1093) @@ -4,7 +4,7 @@ :folding=explicit:collapseFolds=1: Copyright (C) 2000, 2003 Slava Pestov -Portions Copyright (C) 2004 Ian Lewis (Ian...@me...) +Portions Copyright (C) 2006 Ian Lewis (Ian...@me...) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -58,6 +58,7 @@ * @author Slava Pestov * @author Ian Lewis (<a href="mailto:Ian...@me...">Ian...@me...</a>) * @version $Id$ + * @since jsXe 0.5 pre3 */ public class VFSManager { /** @@ -69,13 +70,11 @@ /** * Do not call. */ - public static void init() - { - int count = jEdit.getIntegerProperty("ioThreadCount",4); - ioThreadPool = new WorkThreadPool("jEdit I/O",count); + public static void init() { + int count = jsXe.getIntegerProperty("ioThreadCount", 4); + ioThreadPool = new WorkThreadPool("jsXe I/O",count); JARClassLoader classLoader = new JARClassLoader(); - for(int i = 0; i < ioThreadPool.getThreadCount(); i++) - { + for (int i = 0; i < ioThreadPool.getThreadCount(); i++) { ioThreadPool.getThread(i).setContextClassLoader( classLoader); } @@ -85,8 +84,7 @@ /** * Do not call. */ - public static void start() - { + public static void start() { ioThreadPool.start(); } //}}} @@ -96,8 +94,7 @@ /** * Returns the local filesystem VFS. */ - public static VFS getFileVFS() - { + public static VFS getFileVFS() { return fileVFS; } //}}} @@ -105,8 +102,7 @@ /** * Returns the URL VFS. */ - public static VFS getUrlVFS() - { + public static VFS getUrlVFS() { return urlVFS; } //}}} @@ -269,41 +265,6 @@ //{{{ error() method /** - * @deprecated Call the other <code>error()</code> method instead. - */ - public static void error(final Component comp, final String error, final Object[] args) - { - // if we are already in the AWT thread, take a shortcut - if(SwingUtilities.isEventDispatchThread()) - { - GUIUtilities.error(comp,error,args); - return; - } - - // the 'error' chicanery ensures that stuff like: - // VFSManager.waitForRequests() - // if(VFSManager.errorOccurred()) - // ... - // will work (because the below runnable will only be - // executed in the next event) - VFSManager.error = true; - - runInAWTThread(new Runnable() - { - public void run() - { - VFSManager.error = false; - - if(comp == null || !comp.isShowing()) - GUIUtilities.error(null,error,args); - else - GUIUtilities.error(comp,error,args); - } - }); - } //}}} - - //{{{ error() method - /** * Reports an I/O error. * * @param comp The component @@ -318,31 +279,27 @@ { final Frame frame = JOptionPane.getFrameForComponent(comp); - synchronized(errorLock) - { + synchronized(errorLock) { + error = true; - errors.addElement(new ErrorListDialog.ErrorEntry( - path,messageProp,args)); + errors.addElement(new ErrorListDialog.ErrorEntry(path, messageProp, args)); - if(errors.size() == 1) - { + if (errors.size() == 1) { - VFSManager.runInAWTThread(new Runnable() - { - public void run() - { - String caption = jEdit.getProperty( - "ioerror.caption" + (errors.size() == 1 - ? "-1" : ""),new Integer[] { - new Integer(errors.size()) }); + VFSManager.runInAWTThread(new Runnable() { + public void run() { + String caption = Messages.getMessage("IO.Error.caption" + (errors.size() == 1 ? "-1" : ""), + new Integer[] { new Integer(errors.size()) }); + new ErrorListDialog( frame.isShowing() ? frame - : jEdit.getFirstView(), - jEdit.getProperty("ioerror.title"), + : jsXe.getActiveView(), + Messages.getMessage("IO.Error.title"), caption,errors,false); + errors.removeAllElements(); error = false; } Modified: branches/jsxe2/src/net/sourceforge/jsxe/properties =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/properties 2006-07-29 06:24:45 UTC (rev 1092) +++ branches/jsxe2/src/net/sourceforge/jsxe/properties 2006-07-29 15:52:20 UTC (rev 1093) @@ -13,6 +13,8 @@ # Resource Cache xml.cache=true +ioThreadCount=4 + #{{{ Plugin Manager Default Dimensions #pluginmgr.x=100 #pluginmgr.y=100 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ian...@us...> - 2006-07-27 19:00:15
|
Revision: 1079 Author: ian_lewis Date: 2006-07-27 11:59:59 -0700 (Thu, 27 Jul 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1079&view=rev Log Message: ----------- Added classes for IO. Though they are ignored by the build atm Modified Paths: -------------- branches/jsxe2/build.xml Added Paths: ----------- branches/jsxe2/src/net/sourceforge/jsxe/dom2/ls/XMLDocumentIORequest.java branches/jsxe2/src/net/sourceforge/jsxe/io/ branches/jsxe2/src/net/sourceforge/jsxe/io/FileRootsVFS.java branches/jsxe2/src/net/sourceforge/jsxe/io/FileVFS.java branches/jsxe2/src/net/sourceforge/jsxe/io/UrlVFS.java branches/jsxe2/src/net/sourceforge/jsxe/io/VFS.java branches/jsxe2/src/net/sourceforge/jsxe/io/VFSManager.java branches/jsxe2/src/net/sourceforge/jsxe/io/package.html Modified: branches/jsxe2/build.xml =================================================================== --- branches/jsxe2/build.xml 2006-07-27 18:02:07 UTC (rev 1078) +++ branches/jsxe2/build.xml 2006-07-27 18:59:59 UTC (rev 1079) @@ -118,6 +118,10 @@ <!--<include name="**/*.dtd"/>--> <include name="**/*.jpg"/> <include name="**/*.png"/> + + <!-- files in the source directory to ignore --> + <exclude name="net/sourceforge/jsxe/dom2/ls/XMLDocumentIORequest.java"/> + <exclude name="net/sourceforge/jsxe/io/**/*"/> </fileset> </copy> <mkdir dir="${build.messages}"/> Added: branches/jsxe2/src/net/sourceforge/jsxe/dom2/ls/XMLDocumentIORequest.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/ls/XMLDocumentIORequest.java (rev 0) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/ls/XMLDocumentIORequest.java 2006-07-27 18:59:59 UTC (rev 1079) @@ -0,0 +1,1036 @@ +/* +XMLDocumentIORequest.java +:tabSize=4:indentSize=4:noTabs=true: +:folding=explicit:collapseFolds=1: + +Copyright (C) 2000, 2003 Slava Pestov +Copyright (C) 2006 Ian Lewis (Ian...@me...) + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +Optionally, you may find a copy of the GNU General Public License +from http://www.fsf.org/copyleft/gpl.txt +*/ + +package org.gjt.sp.jedit.buffer; + +//{{{ Imports +import javax.swing.text.Segment; +import java.io.*; +import java.util.zip.*; +import java.util.Vector; +import org.gjt.sp.jedit.io.*; +import org.gjt.sp.jedit.*; +import org.gjt.sp.util.*; +//}}} + +/** + * A document I/O request. + * @author Slava Pestov + * @version $Id: BufferIORequest.java,v 1.28 2004/08/29 02:58:43 spestov Exp $ + */ +public class XMLDocumentIORequest extends WorkRequest { + + //{{{ Constants + /** + * Size of I/O buffers. + */ + public static final int IOBUFSIZE = 32768; + + /** + * Number of lines per progress increment. + */ + public static final int PROGRESS_INTERVAL = 300; + + public static final String LOAD_DATA = "BufferIORequest__loadData"; + public static final String END_OFFSETS = "BufferIORequest__endOffsets"; + public static final String NEW_PATH = "BufferIORequest__newPath"; + + /** + * Buffer boolean property set when an error occurs. + */ + public static final String ERROR_OCCURRED = "BufferIORequest__error"; + + /** + * A file load request. + */ + public static final int LOAD = 0; + + /** + * A file save request. + */ + public static final int SAVE = 1; + + /** + * An autosave request. Only supported for local files. + */ + public static final int AUTOSAVE = 2; + + /** + * An insert file request. + */ + public static final int INSERT = 3; + + /** + * Magic numbers used for auto-detecting Unicode and GZIP files. + */ + public static final int GZIP_MAGIC_1 = 0x1f; + public static final int GZIP_MAGIC_2 = 0x8b; + public static final int UNICODE_MAGIC_1 = 0xfe; + public static final int UNICODE_MAGIC_2 = 0xff; + public static final int UTF8_MAGIC_1 = 0xef; + public static final int UTF8_MAGIC_2 = 0xbb; + public static final int UTF8_MAGIC_3 = 0xbf; + + /** + * Length of longest XML PI used for encoding detection.<p> + * <?xml version="1.0" encoding="................"?> + */ + public static final int XML_PI_LENGTH = 50; + //}}} + + //{{{ XMLDocumentIORequest constructor + /** + * Creates a new buffer I/O request. + * @param type The request type + * @param view The view + * @param buffer The buffer + * @param session The VFS session + * @param vfs The VFS + * @param path The path + */ + public XMLDocumentIORequest(int type, View view, Buffer buffer, + Object session, VFS vfs, String path) + { + this.type = type; + this.view = view; + this.buffer = buffer; + this.session = session; + this.vfs = vfs; + this.path = path; + + markersPath = vfs.getParentOfPath(path) + + '.' + vfs.getFileName(path) + + ".marks"; + } //}}} + + //{{{ run() method + public void run() + { + switch(type) + { + case LOAD: + load(); + break; + case SAVE: + save(); + break; + case AUTOSAVE: + autosave(); + break; + case INSERT: + insert(); + break; + default: + throw new InternalError(); + } + } //}}} + + //{{{ toString() method + public String toString() + { + String typeString; + switch(type) + { + case LOAD: + typeString = "LOAD"; + break; + case SAVE: + typeString = "SAVE"; + break; + case AUTOSAVE: + typeString = "AUTOSAVE"; + break; + default: + typeString = "UNKNOWN!!!"; + } + + return getClass().getName() + "[type=" + typeString + + ",buffer=" + buffer + "]"; + } //}}} + + //{{{ Private members + + //{{{ Instance variables + private int type; + private View view; + private Buffer buffer; + private Object session; + private VFS vfs; + private String path; + private String markersPath; + //}}} + + //{{{ load() method + private void load() + { + InputStream in = null; + + try + { + try + { + String[] args = { vfs.getFileName(path) }; + setAbortable(true); + if(!buffer.isTemporary()) + { + setStatus(jEdit.getProperty("vfs.status.load",args)); + setProgressValue(0); + } + + path = vfs._canonPath(session,path,view); + + VFS.DirectoryEntry entry = vfs._getDirectoryEntry( + session,path,view); + long length; + if(entry != null) + length = entry.length; + else + length = 0L; + + in = vfs._createInputStream(session,path, + false,view); + if(in == null) + return; + + read(autodetect(in),length,false); + buffer.setNewFile(false); + } + catch(CharConversionException ch) + { + Log.log(Log.ERROR,this,ch); + Object[] pp = { buffer.getProperty(Buffer.ENCODING), + ch.toString() }; + VFSManager.error(view,path,"ioerror.encoding-error",pp); + + buffer.setBooleanProperty(ERROR_OCCURRED,true); + } + catch(UnsupportedEncodingException uu) + { + Log.log(Log.ERROR,this,uu); + Object[] pp = { buffer.getProperty(Buffer.ENCODING), + uu.toString() }; + VFSManager.error(view,path,"ioerror.encoding-error",pp); + + buffer.setBooleanProperty(ERROR_OCCURRED,true); + } + catch(IOException io) + { + Log.log(Log.ERROR,this,io); + Object[] pp = { io.toString() }; + VFSManager.error(view,path,"ioerror.read-error",pp); + + buffer.setBooleanProperty(ERROR_OCCURRED,true); + } + catch(OutOfMemoryError oom) + { + Log.log(Log.ERROR,this,oom); + VFSManager.error(view,path,"out-of-memory-error",null); + + buffer.setBooleanProperty(ERROR_OCCURRED,true); + } + + if(jEdit.getBooleanProperty("persistentMarkers")) + { + try + { + String[] args = { vfs.getFileName(path) }; + if(!buffer.isTemporary()) + setStatus(jEdit.getProperty("vfs.status.load-markers",args)); + setAbortable(true); + + in = vfs._createInputStream(session,markersPath,true,view); + if(in != null) + readMarkers(buffer,in); + } + catch(IOException io) + { + // ignore + } + } + } + catch(WorkThread.Abort a) + { + if(in != null) + { + try + { + in.close(); + } + catch(IOException io) + { + } + } + + buffer.setBooleanProperty(ERROR_OCCURRED,true); + } + finally + { + try + { + vfs._endVFSSession(session,view); + } + catch(IOException io) + { + Log.log(Log.ERROR,this,io); + String[] pp = { io.toString() }; + VFSManager.error(view,path,"ioerror.read-error",pp); + + buffer.setBooleanProperty(ERROR_OCCURRED,true); + } + catch(WorkThread.Abort a) + { + buffer.setBooleanProperty(ERROR_OCCURRED,true); + } + } + } //}}} + + //{{{ autodetect() method + /** + * Tries to detect if the stream is gzipped, and if it has an encoding + * specified with an XML PI. + */ + private Reader autodetect(InputStream in) throws IOException + { + in = new BufferedInputStream(in); + + String encoding = buffer.getStringProperty(Buffer.ENCODING); + if(!in.markSupported()) + Log.log(Log.WARNING,this,"Mark not supported: " + in); + else if(buffer.getBooleanProperty(Buffer.ENCODING_AUTODETECT)) + { + in.mark(XML_PI_LENGTH); + int b1 = in.read(); + int b2 = in.read(); + int b3 = in.read(); + + if(encoding.equals(MiscUtilities.UTF_8_Y)) + { + // Java does not support this encoding so + // we have to handle it manually. + if(b1 != UTF8_MAGIC_1 || b2 != UTF8_MAGIC_2 + || b3 != UTF8_MAGIC_3) + { + // file does not begin with UTF-8-Y + // signature. reset stream, read as + // UTF-8. + in.reset(); + } + else + { + // file begins with UTF-8-Y signature. + // discard the signature, and read + // the remainder as UTF-8. + } + + encoding = "UTF-8"; + } + else if(b1 == GZIP_MAGIC_1 && b2 == GZIP_MAGIC_2) + { + in.reset(); + in = new GZIPInputStream(in); + buffer.setBooleanProperty(Buffer.GZIPPED,true); + // auto-detect encoding within the gzip stream. + return autodetect(in); + } + else if((b1 == UNICODE_MAGIC_1 + && b2 == UNICODE_MAGIC_2) + || (b1 == UNICODE_MAGIC_2 + && b2 == UNICODE_MAGIC_1)) + { + in.reset(); + encoding = "UTF-16"; + buffer.setProperty(Buffer.ENCODING,encoding); + } + else if(b1 == UTF8_MAGIC_1 && b2 == UTF8_MAGIC_2 + && b3 == UTF8_MAGIC_3) + { + // do not reset the stream and just treat it + // like a normal UTF-8 file. + buffer.setProperty(Buffer.ENCODING, + MiscUtilities.UTF_8_Y); + + encoding = "UTF-8"; + } + else + { + in.reset(); + + byte[] _xmlPI = new byte[XML_PI_LENGTH]; + int offset = 0; + int count; + while((count = in.read(_xmlPI,offset, + XML_PI_LENGTH - offset)) != -1) + { + offset += count; + if(offset == XML_PI_LENGTH) + break; + } + + String xmlPI = new String(_xmlPI,0,offset, + "ASCII"); + if(xmlPI.startsWith("<?xml")) + { + int index = xmlPI.indexOf("encoding="); + if(index != -1 + && index + 9 != xmlPI.length()) + { + char ch = xmlPI.charAt(index + + 9); + int endIndex = xmlPI.indexOf(ch, + index + 10); + encoding = xmlPI.substring( + index + 10,endIndex); + + if(MiscUtilities.isSupportedEncoding(encoding)) + { + buffer.setProperty(Buffer.ENCODING,encoding); + } + else + { + Log.log(Log.WARNING,this,"XML PI specifies unsupported encoding: " + encoding); + } + } + } + + in.reset(); + } + } + + return new InputStreamReader(in,encoding); + } //}}} + + //{{{ read() method + private SegmentBuffer read(Reader in, long length, + boolean insert) throws IOException + { + /* we guess an initial size for the array */ + IntegerArray endOffsets = new IntegerArray( + Math.max(1,(int)(length / 50))); + + // only true if the file size is known + boolean trackProgress = (!buffer.isTemporary() && length != 0); + + if(trackProgress) + { + setProgressValue(0); + setProgressMaximum((int)length); + } + + // if the file size is not known, start with a resonable + // default buffer size + if(length == 0) + length = IOBUFSIZE; + + SegmentBuffer seg = new SegmentBuffer((int)length + 1); + + char[] buf = new char[IOBUFSIZE]; + + // Number of characters in 'buf' array. + // InputStream.read() doesn't always fill the + // array (eg, the file size is not a multiple of + // IOBUFSIZE, or it is a GZipped file, etc) + int len; + + // True if a \n was read after a \r. Usually + // means this is a DOS/Windows file + boolean CRLF = false; + + // A \r was read, hence a MacOS file + boolean CROnly = false; + + // Was the previous read character a \r? + // If we read a \n and this is true, we assume + // we have a DOS/Windows file + boolean lastWasCR = false; + + // Number of lines read. Every 100 lines, we update the + // progress bar + int lineCount = 0; + + while((len = in.read(buf,0,buf.length)) != -1) + { + // Offset of previous line, relative to + // the start of the I/O buffer (NOT + // relative to the start of the document) + int lastLine = 0; + + for(int i = 0; i < len; i++) + { + // Look for line endings. + switch(buf[i]) + { + case '\r': + // If we read a \r and + // lastWasCR is also true, + // it is probably a Mac file + // (\r\r in stream) + if(lastWasCR) + { + CROnly = true; + CRLF = false; + } + // Otherwise set a flag, + // so that \n knows that last + // was a \r + else + { + lastWasCR = true; + } + + // Insert a line + seg.append(buf,lastLine,i - + lastLine); + seg.append('\n'); + endOffsets.add(seg.count); + if(trackProgress && lineCount++ % PROGRESS_INTERVAL == 0) + setProgressValue(seg.count); + + // This is i+1 to take the + // trailing \n into account + lastLine = i + 1; + break; + case '\n': + // If lastWasCR is true, + // we just read a \r followed + // by a \n. We specify that + // this is a Windows file, + // but take no further + // action and just ignore + // the \r. + if(lastWasCR) + { + CROnly = false; + CRLF = true; + lastWasCR = false; + // Bump lastLine so + // that the next line + // doesn't erronously + // pick up the \r + lastLine = i + 1; + } + // Otherwise, we found a \n + // that follows some other + // character, hence we have + // a Unix file + else + { + CROnly = false; + CRLF = false; + seg.append(buf,lastLine, + i - lastLine); + seg.append('\n'); + endOffsets.add(seg.count); + if(trackProgress && lineCount++ % PROGRESS_INTERVAL == 0) + setProgressValue(seg.count); + lastLine = i + 1; + } + break; + default: + // If we find some other + // character that follows + // a \r, so it is not a + // Windows file, and probably + // a Mac file + if(lastWasCR) + { + CROnly = true; + CRLF = false; + lastWasCR = false; + } + break; + } + } + + if(trackProgress) + setProgressValue(seg.count); + + // Add remaining stuff from buffer + seg.append(buf,lastLine,len - lastLine); + } + + setAbortable(false); + + String lineSeparator; + if(seg.count == 0) + { + // fix for "[ 865589 ] 0-byte files should open using + // the default line seperator" + lineSeparator = jEdit.getProperty( + "buffer.lineSeparator", + System.getProperty("line.separator")); + } + else if(CRLF) + lineSeparator = "\r\n"; + else if(CROnly) + lineSeparator = "\r"; + else + lineSeparator = "\n"; + + in.close(); + + // Chop trailing newline and/or ^Z (if any) + int bufferLength = seg.count; + if(bufferLength != 0) + { + char ch = seg.array[bufferLength - 1]; + if(ch == 0x1a /* DOS ^Z */) + seg.count--; + } + + buffer.setBooleanProperty(Buffer.TRAILING_EOL,false); + if(bufferLength != 0 && jEdit.getBooleanProperty("stripTrailingEOL")) + { + char ch = seg.array[bufferLength - 1]; + if(ch == '\n') + { + buffer.setBooleanProperty(Buffer.TRAILING_EOL,true); + seg.count--; + endOffsets.setSize(endOffsets.getSize() - 1); + } + } + + // add a line marker at the end for proper offset manager + // operation + endOffsets.add(seg.count + 1); + + // to avoid having to deal with read/write locks and such, + // we insert the loaded data into the buffer in the + // post-load cleanup runnable, which runs in the AWT thread. + if(!insert) + { + buffer.setProperty(LOAD_DATA,seg); + buffer.setProperty(END_OFFSETS,endOffsets); + buffer.setProperty(NEW_PATH,path); + if(lineSeparator != null) + buffer.setProperty(Buffer.LINESEP,lineSeparator); + } + + // used in insert() + return seg; + } //}}} + + //{{{ readMarkers() method + private void readMarkers(Buffer buffer, InputStream _in) + throws IOException + { + // For `reload' command + buffer.removeAllMarkers(); + + BufferedReader in = new BufferedReader(new InputStreamReader(_in)); + + try + { + String line; + while((line = in.readLine()) != null) + { + // compatibility kludge for jEdit 3.1 and earlier + if(!line.startsWith("!")) + continue; + + char shortcut = line.charAt(1); + int start = line.indexOf(';'); + int end = line.indexOf(';',start + 1); + int position = Integer.parseInt(line.substring(start + 1,end)); + buffer.addMarker(shortcut,position); + } + } + finally + { + in.close(); + } + } //}}} + + //{{{ save() method + private void save() + { + OutputStream out = null; + + try + { + String[] args = { vfs.getFileName(path) }; + setStatus(jEdit.getProperty("vfs.status.save",args)); + + // the entire save operation can be aborted... + setAbortable(true); + + path = vfs._canonPath(session,path,view); if(!MiscUtilities.isURL(path)) + path = MiscUtilities.resolveSymlinks(path); + + // Only backup once per session + if(buffer.getProperty(Buffer.BACKED_UP) == null + || jEdit.getBooleanProperty("backupEverySave")) + { + vfs._backup(session,path,view); + buffer.setBooleanProperty(Buffer.BACKED_UP,true); + } + + /* if the VFS supports renaming files, we first + * save to #<filename>#save#, then rename that + * to <filename>, so that if the save fails, + * data will not be lost. + * + * as of 4.1pre7 we now call vfs.getTwoStageSaveName() + * instead of constructing the path directly + * since some VFS's might not allow # in filenames. + */ + String savePath; + + boolean twoStageSave = (vfs.getCapabilities() & VFS.RENAME_CAP) != 0 + && jEdit.getBooleanProperty("twoStageSave"); + if(twoStageSave) + savePath = vfs.getTwoStageSaveName(path); + else + savePath = path; + + out = vfs._createOutputStream(session,savePath,view); + + try + { + // this must be after the stream is created or + // we deadlock with SSHTools. + buffer.readLock(); + if(out != null) + { + // Can't use buffer.getName() here because + // it is not changed until the save is + // complete + if(savePath.endsWith(".gz")) + buffer.setBooleanProperty(Buffer.GZIPPED,true); + + if(buffer.getBooleanProperty(Buffer.GZIPPED)) + out = new GZIPOutputStream(out); + + write(buffer,out); + + if(twoStageSave) + { + if(!vfs._rename(session,savePath,path,view)) + throw new IOException("Rename failed: " + savePath); + } + + // We only save markers to VFS's that support deletion. + // Otherwise, we will accumilate stale marks files. + if((vfs.getCapabilities() & VFS.DELETE_CAP) != 0) + { + if(jEdit.getBooleanProperty("persistentMarkers") + && buffer.getMarkers().size() != 0) + { + setStatus(jEdit.getProperty("vfs.status.save-markers",args)); + setProgressValue(0); + out = vfs._createOutputStream(session,markersPath,view); + if(out != null) + writeMarkers(buffer,out); + } + else + vfs._delete(session,markersPath,view); + } + } + else + buffer.setBooleanProperty(ERROR_OCCURRED,true); + + if(!twoStageSave) + VFSManager.sendVFSUpdate(vfs,path,true); + } + finally + { + buffer.readUnlock(); + } + } + catch(IOException io) + { + Log.log(Log.ERROR,this,io); + String[] pp = { io.toString() }; + VFSManager.error(view,path,"ioerror.write-error",pp); + + buffer.setBooleanProperty(ERROR_OCCURRED,true); + } + catch(WorkThread.Abort a) + { + if(out != null) + { + try + { + out.close(); + } + catch(IOException io) + { + } + } + + buffer.setBooleanProperty(ERROR_OCCURRED,true); + } + finally + { + try + { + vfs._saveComplete(session,buffer,path,view); + vfs._endVFSSession(session,view); + } + catch(IOException io) + { + Log.log(Log.ERROR,this,io); + String[] pp = { io.toString() }; + VFSManager.error(view,path,"ioerror.write-error",pp); + + buffer.setBooleanProperty(ERROR_OCCURRED,true); + } + catch(WorkThread.Abort a) + { + buffer.setBooleanProperty(ERROR_OCCURRED,true); + } + } + } //}}} + + //{{{ autosave() method + private void autosave() + { + OutputStream out = null; + + try + { + String[] args = { vfs.getFileName(path) }; + setStatus(jEdit.getProperty("vfs.status.autosave",args)); + + // the entire save operation can be aborted... + setAbortable(true); + + try + { + //buffer.readLock(); + + if(!buffer.isDirty()) + { + // buffer has been saved while we + // were waiting. + return; + } + + out = vfs._createOutputStream(session,path,view); + if(out == null) + return; + + write(buffer,out); + } + catch(Exception e) + { + } + finally + { + //buffer.readUnlock(); + } + } + catch(WorkThread.Abort a) + { + if(out != null) + { + try + { + out.close(); + } + catch(IOException io) + { + } + } + } + } //}}} + + //{{{ write() method + private void write(Buffer buffer, OutputStream _out) + throws IOException + { + BufferedWriter out = null; + + try + { + String encoding = buffer.getStringProperty(Buffer.ENCODING); + if(encoding.equals(MiscUtilities.UTF_8_Y)) + { + // not supported by Java... + _out.write(UTF8_MAGIC_1); + _out.write(UTF8_MAGIC_2); + _out.write(UTF8_MAGIC_3); + _out.flush(); + encoding = "UTF-8"; + } + + out = new BufferedWriter( + new OutputStreamWriter(_out,encoding), + IOBUFSIZE); + + Segment lineSegment = new Segment(); + String newline = buffer.getStringProperty(Buffer.LINESEP); + if(newline == null) + newline = System.getProperty("line.separator"); + + setProgressMaximum(buffer.getLineCount() / PROGRESS_INTERVAL); + setProgressValue(0); + + int i = 0; + while(i < buffer.getLineCount()) + { + buffer.getLineText(i,lineSegment); + out.write(lineSegment.array,lineSegment.offset, + lineSegment.count); + + if(i != buffer.getLineCount() - 1) + { + out.write(newline); + } + + if(++i % PROGRESS_INTERVAL == 0) + setProgressValue(i / PROGRESS_INTERVAL); + } + + if(jEdit.getBooleanProperty("stripTrailingEOL") + && buffer.getBooleanProperty(Buffer.TRAILING_EOL)) + { + out.write(newline); + } + } + finally + { + if(out != null) + out.close(); + else + _out.close(); + } + } //}}} + + //{{{ writeMarkers() method + private void writeMarkers(Buffer buffer, OutputStream out) + throws IOException + { + Writer o = new BufferedWriter(new OutputStreamWriter(out)); + try + { + Vector markers = buffer.getMarkers(); + for(int i = 0; i < markers.size(); i++) + { + Marker marker = (Marker)markers.elementAt(i); + o.write('!'); + o.write(marker.getShortcut()); + o.write(';'); + + String pos = String.valueOf(marker.getPosition()); + o.write(pos); + o.write(';'); + o.write(pos); + o.write('\n'); + } + } + finally + { + o.close(); + } + } //}}} + + //{{{ insert() method + private void insert() + { + InputStream in = null; + + try + { + try + { + String[] args = { vfs.getFileName(path) }; + setStatus(jEdit.getProperty("vfs.status.load",args)); + setAbortable(true); + + path = vfs._canonPath(session,path,view); + + VFS.DirectoryEntry entry = vfs._getDirectoryEntry( + session,path,view); + long length; + if(entry != null) + length = entry.length; + else + length = 0L; + + in = vfs._createInputStream(session,path,false,view); + if(in == null) + return; + + final SegmentBuffer seg = read( + autodetect(in),length,true); + + /* we don't do this in Buffer.insert() so that + we can insert multiple files at once */ + VFSManager.runInAWTThread(new Runnable() + { + public void run() + { + view.getTextArea().setSelectedText( + seg.toString()); + } + }); + } + catch(IOException io) + { + Log.log(Log.ERROR,this,io); + String[] pp = { io.toString() }; + VFSManager.error(view,path,"ioerror.read-error",pp); + + buffer.setBooleanProperty(ERROR_OCCURRED,true); + } + } + catch(WorkThread.Abort a) + { + if(in != null) + { + try + { + in.close(); + } + catch(IOException io) + { + } + } + + buffer.setBooleanProperty(ERROR_OCCURRED,true); + } + finally + { + try + { + vfs._endVFSSession(session,view); + } + catch(IOException io) + { + Log.log(Log.ERROR,this,io); + String[] pp = { io.toString() }; + VFSManager.error(view,path,"ioerror.read-error",pp); + + buffer.setBooleanProperty(ERROR_OCCURRED,true); + } + catch(WorkThread.Abort a) + { + buffer.setBooleanProperty(ERROR_OCCURRED,true); + } + } + } //}}} + + //}}} +} Property changes on: branches/jsxe2/src/net/sourceforge/jsxe/dom2/ls/XMLDocumentIORequest.java ___________________________________________________________________ Name: svn:executable + * Added: branches/jsxe2/src/net/sourceforge/jsxe/io/FileRootsVFS.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/io/FileRootsVFS.java (rev 0) +++ branches/jsxe2/src/net/sourceforge/jsxe/io/FileRootsVFS.java 2006-07-27 18:59:59 UTC (rev 1079) @@ -0,0 +1,256 @@ +/* +FileVFS.java +:tabSize=4:indentSize=4:noTabs=true: +:folding=explicit:collapseFolds=1: + +Copyright (C) 2000, 2003 Slava Pestov +Portions copyright (C) 2002 Kris Kopicki +Portions copyright (C) 2002 Carmine Lucarelli +Portions Copyright (C) 2004 Ian Lewis (Ian...@me...) + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +Optionally, you may find a copy of the GNU General Public License +from http://www.fsf.org/copyleft/gpl.txt +*/ + +package org.gjt.sp.jedit.io; + +//{{{ Imports +import javax.swing.filechooser.FileSystemView; +import java.awt.Component; +import java.lang.reflect.*; +import java.io.File; +import java.util.LinkedList; +import net.sourceforge.jsxe.util.MiscUtilities; +import net.sourceforge.jsxe.OperatingSystem; +import net.sourceforge.jsxe.util.Log; +//}}} + +/** + * A VFS that lists local root filesystems. + * @author Slava Pestov + * @author Kris Kopicki + * @author Carmine Lucarelli + * @author Ian Lewis (<a href="mailto:Ian...@me...">Ian...@me...</a>) + * @version $Id$ + * @since jsXe 0.5 pre3 + */ +public class FileRootsVFS extends VFS { + + public static final String PROTOCOL = "roots"; + + //{{{ FileRootsVFS constructor + public FileRootsVFS() { + + super("roots",LOW_LATENCY_CAP,new String[] { + EA_TYPE }); + + try { + getSystemDisplayName = FileSystemView.class.getMethod("getSystemDisplayName", + new Class[] { java.io.File.class }); + getRoots = FileSystemView.class.getMethod("getRoots", + new Class[0]); + isFileSystemRoot = FileSystemView.class.getMethod("isFileSystemRoot", + new Class[] { java.io.File.class }); + isFloppyDrive = FileSystemView.class.getMethod("isFloppyDrive", + new Class[] { java.io.File.class }); + isDrive = FileSystemView.class.getMethod("isDrive", + new Class[] { java.io.File.class }); + fsView = FileSystemView.getFileSystemView(); + Log.log(Log.DEBUG,this,"Java 1.4 FileSystemView detected"); + } + catch(Exception e) + { + Log.log(Log.DEBUG,this,"Java 1.4 FileSystemView not detected"); + } + } //}}} + + //{{{ getParentOfPath() method + public String getParentOfPath(String path) { + return PROTOCOL + ":"; + } //}}} + + //{{{ _listDirectory() method + public VFS.DirectoryEntry[] _listDirectory(Object session, String url, + Component comp) + { + File[] roots = listRoots(); + + if (roots == null) { + return null; + } + + VFS.DirectoryEntry[] rootDE = new VFS.DirectoryEntry[roots.length]; + for (int i = 0; i < roots.length; i++) { + rootDE[i] = new RootsEntry(roots[i]); + } + + return rootDE; + } //}}} + + //{{{ _getDirectoryEntry() method + public DirectoryEntry _getDirectoryEntry(Object session, String path, + Component comp) + { + return new RootsEntry(new File(path)); + } //}}} + + //{{{ Private members + private static FileSystemView fsView; + private static Method getSystemDisplayName; + private static Method getRoots; + private static Method isFileSystemRoot; + private static Method isFloppyDrive; + private static Method isDrive; + + //{{{ listRoots() method + private static File[] listRoots() { + + if (OperatingSystem.isMacOS()) { + // Nasty hardcoded values + File[] volumes = new File("/Volumes").listFiles(); + LinkedList roots = new LinkedList(); + + roots.add(new File("/")); + + for (int i=0; i<volumes.length; i++) { + // Make sure people don't do stupid things like putting files in /Volumes + if (volumes[i].isDirectory()) + roots.add(volumes[i]); + } + + return (File[])roots.toArray(new File[0]); + } else { + File[] roots = File.listRoots(); + File[] desktop = null; + + if (getRoots != null) { + try { + desktop = (File[])getRoots.invoke(fsView, + new Object[0]); + } catch(Exception e) { + Log.log(Log.ERROR, FileRootsVFS.class, "Error getting Desktop: " + e.getMessage()); + desktop = null; + } + } + + if (desktop == null) { + return roots; + } + + File[] rootsPlus = new File[roots.length + desktop.length]; + System.arraycopy(desktop, 0, rootsPlus, 0, desktop.length); + System.arraycopy(roots, 0, rootsPlus, 1, roots.length); + return rootsPlus; + } + } //}}} + + //}}} + + //{{{ RootsEntry class + static class RootsEntry extends VFS.DirectoryEntry { + + RootsEntry(File file) { + // REMIND: calling isDirectory() on a floppy drive + // displays stupid I/O error dialog box on Windows + + this.path = this.deletePath = this.symlinkPath = file.getPath(); + + if (isFloppy(file)) { + type = VFS.DirectoryEntry.FILESYSTEM; + name = path; + } else { + if(isDrive(file)) { + + type = VFS.DirectoryEntry.FILESYSTEM; + + if (getSystemDisplayName != null) { + try { + name = path + " " + (String)getSystemDisplayName + .invoke(fsView,new Object[] { file }); + } catch(Exception e) { + Log.log(Log.ERROR,this,e); + name = path; + } + } + } else { + if (file.isDirectory()) { + + type = VFS.DirectoryEntry.FILESYSTEM; + + if (isFileSystemRoot != null) { + try { + if (Boolean.FALSE.equals(isFileSystemRoot + .invoke(fsView,new Object[] { file }))) + { + type = VFS.DirectoryEntry.DIRECTORY; + } + } + catch(Exception e) {} + } + + if (OperatingSystem.isMacOS()) { + name = MiscUtilities.getFileName(path); + } else { + name = path; + } + } else { + type = VFS.DirectoryEntry.FILE; + } + } + } + } + + public String getExtendedAttribute(String name) { + if (name.equals(EA_TYPE)) { + return super.getExtendedAttribute(name); + } else { + // don't want it to show "0 bytes" for size, + // etc. + return null; + } + } + + private boolean isFloppy(File file) { + // to prevent windows looking for a disk in the floppy drive + if (isFloppyDrive != null) { + try { + return Boolean.TRUE.equals(isFloppyDrive. + invoke(fsView, new Object[] { file })); + } catch(Exception e) { + Log.log(Log.ERROR,this,e); + return false; + } + } else { + return path.startsWith("A:") || path.startsWith("B:"); + } + } + + private boolean isDrive(File file) { + // so an empty cd drive is not reported as a file + if (isDrive != null) { + try { + return Boolean.TRUE.equals(isDrive. + invoke(fsView, new Object[] { file })); + } catch(Exception e) { + Log.log(Log.ERROR,this,e); + return false; + } + } else { + return true; + } + } + } //}}} +} Property changes on: branches/jsxe2/src/net/sourceforge/jsxe/io/FileRootsVFS.java ___________________________________________________________________ Name: svn:executable + * Added: branches/jsxe2/src/net/sourceforge/jsxe/io/FileVFS.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/io/FileVFS.java (rev 0) +++ branches/jsxe2/src/net/sourceforge/jsxe/io/FileVFS.java 2006-07-27 18:59:59 UTC (rev 1079) @@ -0,0 +1,483 @@ +/* +FileVFS.java +:tabSize=4:indentSize=4:noTabs=true: +:folding=explicit:collapseFolds=1: + +Copyright (C) 1998, 1999, 2000, 2001, 2002 Slava Pestov +Portions Copyright (C) 2004 Ian Lewis (Ian...@me...) + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +Optionally, you may find a copy of the GNU General Public License +from http://www.fsf.org/copyleft/gpl.txt +*/ + +package net.sourceforge.jsxe.io; + +//{{{ Imports +import java.awt.Component; +import java.io.*; +import java.text.*; +import java.util.Date; +import net.sourceforge.jsxe.util.Log; +//}}} + +/** + * Local filesystem VFS. + * @author Slava Pestov + * @author Ian Lewis (<a href="mailto:Ian...@me...">Ian...@me...</a>) + * @since jsXe 0.5 pre3 + * @version $Id: FileVFS.java,v 1.47 2004/06/09 16:48:40 spestov Exp $ + */ +public class FileVFS extends VFS { + + public static final String PERMISSIONS_PROPERTY = "FileVFS__perms"; + + //{{{ FileVFS method + public FileVFS() + { + super("file",READ_CAP | WRITE_CAP | DELETE_CAP + | RENAME_CAP | MKDIR_CAP | LOW_LATENCY_CAP + | ((OperatingSystem.isMacOS() + || OperatingSystem.isDOSDerived()) + ? CASE_INSENSITIVE_CAP : 0), + new String[] { EA_TYPE, EA_SIZE, EA_STATUS, + EA_MODIFIED }); + } //}}} + + //{{{ getParentOfPath() method + public String getParentOfPath(String path) + { + if(OperatingSystem.isDOSDerived()) + { + if(path.length() == 2 && path.charAt(1) == ':') + return FileRootsVFS.PROTOCOL + ":"; + else if(path.length() == 3 && path.endsWith(":\\")) + return FileRootsVFS.PROTOCOL + ":"; + else if(path.startsWith("\\\\") && path.indexOf('\\',2) == -1) + return path; + } + + return super.getParentOfPath(path); + } //}}} + + //{{{ constructPath() method + public String constructPath(String parent, String path) + { + if(parent.endsWith(File.separator) + || parent.endsWith("/")) + return parent + path; + else + return parent + File.separator + path; + } //}}} + + //{{{ getFileSeparator() method + public char getFileSeparator() + { + return File.separatorChar; + } //}}} + + //{{{ save() method + public boolean save(View view, Buffer buffer, String path) + { + if(OperatingSystem.isUnix()) + { + int permissions = getPermissions(buffer.getPath()); + Log.log(Log.DEBUG,this,buffer.getPath() + " has permissions 0" + + Integer.toString(permissions,8)); + buffer.setIntegerProperty(PERMISSIONS_PROPERTY,permissions); + } + + return super.save(view,buffer,path); + } //}}} + + //{{{ insert() method + public boolean insert(View view, Buffer buffer, String path) + { + File file = new File(path); + + //{{{ Check if file is valid + if(!file.exists()) + return false; + + if(file.isDirectory()) + { + VFSManager.error(view,file.getPath(), + "ioerror.open-directory",null); + return false; + } + + if(!file.canRead()) + { + VFSManager.error(view,file.getPath(), + "ioerror.no-read",null); + return false; + } //}}} + + return super.insert(view,buffer,path); + } //}}} + + //{{{ _canonPath() method + /** + * Returns the canonical form if the specified path name. For example, + * <code>~</code> might be expanded to the user's home directory. + * @param session The session + * @param path The path + * @param comp The component that will parent error dialog boxes + * @exception IOException if an I/O error occurred + */ + public String _canonPath(Object session, String path, Component comp) + throws IOException + { + return MiscUtilities.canonPath(path); + } //}}} + + //{{{ LocalDirectoryEntry class + public static class LocalDirectoryEntry extends VFS.DirectoryEntry + { + // use system default short format + public static DateFormat DATE_FORMAT + = DateFormat.getInstance(); + + public long modified; + + public LocalDirectoryEntry(File file) + { + super(file.getName(),file.getPath(), + file.getPath(),file.isDirectory() ? DIRECTORY : FILE,file.length(),file.isHidden()); + this.modified = file.lastModified(); + this.canRead = file.canRead(); + this.canWrite = file.canWrite(); + this.symlinkPath = MiscUtilities.resolveSymlinks(path); + } + + public String getExtendedAttribute(String name) + { + if(name.equals(EA_MODIFIED)) + return DATE_FORMAT.format(new Date(modified)); + else + return super.getExtendedAttribute(name); + } + } //}}} + + //{{{ _listDirectory() method + public VFS.DirectoryEntry[] _listDirectory(Object session, String path, + Component comp) + { + //{{{ Windows work around + /* On Windows, paths of the form X: list the last *working + * directory* on that drive. To list the root of the drive, + * you must use X:\. + * + * However, the VFS browser and friends strip off trailing + * path separators, for various reasons. So to work around + * that, we add a '\' to drive letter paths on Windows. + */ + if(OperatingSystem.isWindows()) + { + if(path.length() == 2 && path.charAt(1) == ':') + path = path.concat(File.separator); + } //}}} + + File directory = new File(path); + File[] list = directory.listFiles(); + if(list == null) + { + VFSManager.error(comp,path,"ioerror.directory-error-nomsg",null); + return null; + } + + VFS.DirectoryEntry[] list2 = new VFS.DirectoryEntry[list.length]; + for(int i = 0; i < list.length; i++) + list2[i] = new LocalDirectoryEntry(list[i]); + + return list2; + } //}}} + + //{{{ _getDirectoryEntry() method + public DirectoryEntry _getDirectoryEntry(Object session, String path, + Component comp) + { + if(path.equals("/") && OperatingSystem.isUnix()) + { + return new VFS.DirectoryEntry(path,path,path, + VFS.DirectoryEntry.DIRECTORY,0L,false); + } + + File file = new File(path); + if(!file.exists()) + return null; + + return new LocalDirectoryEntry(file); + } //}}} + + //{{{ _delete() method + public boolean _delete(Object session, String path, Component comp) + { + File file = new File(path); + // do some platforms throw exceptions if the file does not exist + // when we ask for the canonical path? + String canonPath; + try + { + canonPath = file.getCanonicalPath(); + } + catch(IOException io) + { + canonPath = path; + } + + boolean retVal = file.delete(); + if(retVal) + VFSManager.sendVFSUpdate(this,canonPath,true); + return retVal; + } //}}} + + //{{{ _rename() method + public boolean _rename(Object session, String from, String to, + Component comp) + { + File _to = new File(to); + + String toCanonPath; + try + { + toCanonPath = _to.getCanonicalPath(); + } + catch(IOException io) + { + toCanonPath = to; + } + + // this is needed because on OS X renaming to a non-existent + // directory causes problems + File parent = new File(_to.getParent()); + if(parent.exists()) + { + if(!parent.isDirectory()) + return false; + } + else + { + parent.mkdirs(); + if(!parent.exists()) + return false; + } + + File _from = new File(from); + + String fromCanonPath; + try + { + fromCanonPath = _from.getCanonicalPath(); + } + catch(IOException io) + { + fromCanonPath = from; + } + + // Case-insensitive fs workaround + if(!fromCanonPath.equalsIgnoreCase(toCanonPath)) + _to.delete(); + + boolean retVal = _from.renameTo(_to); + VFSManager.sendVFSUpdate(this,fromCanonPath,true); + VFSManager.sendVFSUpdate(this,toCanonPath,true); + return retVal; + } //}}} + + //{{{ _mkdir() method + public boolean _mkdir(Object session, String directory, Component comp) + { + String parent = getParentOfPath(directory); + if(!new File(parent).exists()) + { + if(!_mkdir(session,parent,comp)) + return false; + } + + File file = new File(directory); + + boolean retVal = file.mkdir(); + String canonPath; + try + { + canonPath = file.getCanonicalPath(); + } + catch(IOException io) + { + canonPath = directory; + } + VFSManager.sendVFSUpdate(this,canonPath,true); + return retVal; + } //}}} + + //{{{ _backup() method + public void _backup(Object session, String path, Component comp) + throws IOException + { + // Fetch properties + int backups = jEdit.getIntegerProperty("backups",1); + + if(backups == 0) + return; + + String backupPrefix = jEdit.getProperty("backup.prefix"); + String backupSuffix = jEdit.getProperty("backup.suffix"); + + String backupDirectory = jEdit.getProperty("backup.directory"); + + int backupTimeDistance = jEdit.getIntegerProperty("backup.minTime",0); + File file = new File(path); + + // Check for backup.directory, and create that + // directory if it doesn't exist + if(backupDirectory == null || backupDirectory.length() == 0) + backupDirectory = file.getParent(); + else + { + backupDirectory = MiscUtilities.constructPath( + System.getProperty("user.home"),backupDirectory); + + // Perhaps here we would want to guard with + // a property for parallel backups or not. + backupDirectory = MiscUtilities.concatPath( + backupDirectory,file.getParent()); + + File dir = new File(backupDirectory); + + if (!dir.exists()) + dir.mkdirs(); + } + + MiscUtilities.saveBackup(file,backups,backupPrefix, + backupSuffix,backupDirectory,backupTimeDistance); + } //}}} + + //{{{ _createInputStream() method + public InputStream _createInputStream(Object session, String path, + boolean ignoreErrors, Component comp) throws IOException + { + try + { + return new FileInputStream(path); + } + catch(IOException io) + { + if(ignoreErrors) + return null; + else + throw io; + } + } //}}} + + //{{{ _createOutputStream() method + public OutputStream _createOutputStream(Object session, String path, + Component comp) throws IOException + { + return new FileOutputStream(path); + } //}}} + + //{{{ _saveComplete() method + public void _saveComplete(Object session, Buffer buffer, String path, + Component comp) + { + int permissions = buffer.getIntegerProperty(PERMISSIONS_PROPERTY,0); + setPermissions(path,permissions); + } //}}} + + //{{{ Permission preservation code + + /** Code borrowed from j text editor (http://www.armedbear.org) */ + /** I made some changes to make it support suid, sgid and sticky files */ + + //{{{ getPermissions() method + /** + * Returns numeric permissions of a file. On non-Unix systems, always + * returns zero. + */ + public static int getPermissions(String path) { + int permissions = 0; + + if (jEdit.getBooleanProperty("chmodDisabled")) { + return permissions; + } + + if (OperatingSystem.isUnix()) { + String[] cmdarray = { "ls", "-ld", path }; + + try { + Process process = Runtime.getRuntime().exec(cmdarray); + + BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); + + String output = reader.readLine(); + + if (output != null) { + String s = output.substring(1, 10); + + permissions = MiscUtilities.parsePermissions(s); + } + } + + // Feb 4 2000 5:30 PM + // Catch Throwable here rather than Exception. + // Kaffe's implementation of Runtime.exec throws java.lang.InternalError. + catch (Throwable t) + { + } + } + + return permissions; + } //}}} + + //{{{ setPermissions() method + /** + * Sets numeric permissions of a file. On non-Unix platforms, + * does nothing. + */ + public static void setPermissions(String path, int permissions) { + if (jEdit.getBooleanProperty("chmodDisabled")) + return; + + if (permissions != 0) { + if (OperatingSystem.isUnix()) { + + String[] cmdarray = { "chmod", Integer.toString(permissions, 8), path }; + + try { + Process process = Runtime.getRuntime().exec(cmdarray); + process.getInputStream().close(); + process.getOutputStream().close(); + process.getErrorStream().close(); + // Jun 9 2004 12:40 PM + // waitFor() hangs on some Java + // implementations. + /* int exitCode = process.waitFor(); + if(exitCode != 0) + Log.log(Log.NOTICE,FileVFS.class,"chmod exited with code " + exitCode); */ + } + + // Feb 4 2000 5:30 PM + // Catch Throwable here rather than Exception. + // Kaffe's implementation of Runtime.exec throws java.lang.InternalError. + catch (Throwable t) + { + } + } + } + } //}}} + + //}}} +} Property changes on: branches/jsxe2/src/net/sourceforge/jsxe/io/FileVFS.java ___________________________________________________________________ Name: svn:executable + * Added: branches/jsxe2/src/net/sourceforge/jsxe/io/UrlVFS.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/io/UrlVFS.java (rev 0) +++ branches/jsxe2/src/net/sourceforge/jsxe/io/UrlVFS.java 2006-07-27 18:59:59 UTC (rev 1079) @@ -0,0 +... [truncated message content] |
From: <ian...@us...> - 2006-07-29 04:41:20
|
Revision: 1087 Author: ian_lewis Date: 2006-07-28 21:40:06 -0700 (Fri, 28 Jul 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1087&view=rev Log Message: ----------- Merge from trunk/jsxe of revision 1086 ViewCVS Links: ------------- http://svn.sourceforge.net/jsxe/?rev=1086&view=rev Modified Paths: -------------- branches/jsxe2/Changelog branches/jsxe2/INSTALL branches/jsxe2/NEWS branches/jsxe2/RELEASE.CHECKLIST branches/jsxe2/build.xml branches/jsxe2/messages/messages.de branches/jsxe2/messages/messages.sv branches/jsxe2/src/net/sourceforge/jsxe/ActionPlugin.java branches/jsxe2/src/net/sourceforge/jsxe/ActionSet.java branches/jsxe2/src/net/sourceforge/jsxe/CatalogManager.java branches/jsxe2/src/net/sourceforge/jsxe/CustomFileFilter.java branches/jsxe2/src/net/sourceforge/jsxe/DocumentBuffer.java branches/jsxe2/src/net/sourceforge/jsxe/DocumentBufferListener.java branches/jsxe2/src/net/sourceforge/jsxe/JARClassLoader.java branches/jsxe2/src/net/sourceforge/jsxe/OperatingSystem.java branches/jsxe2/src/net/sourceforge/jsxe/PluginDependencyException.java branches/jsxe2/src/net/sourceforge/jsxe/PluginLoadException.java branches/jsxe2/src/net/sourceforge/jsxe/UnrecognizedPluginException.java branches/jsxe2/src/net/sourceforge/jsxe/action/ActivityLogAction.java branches/jsxe2/src/net/sourceforge/jsxe/action/FileCloseAction.java branches/jsxe2/src/net/sourceforge/jsxe/action/FileCloseAllAction.java branches/jsxe2/src/net/sourceforge/jsxe/action/FileExitAction.java branches/jsxe2/src/net/sourceforge/jsxe/action/FileNewAction.java branches/jsxe2/src/net/sourceforge/jsxe/action/FileOpenAction.java branches/jsxe2/src/net/sourceforge/jsxe/action/FileReloadAction.java branches/jsxe2/src/net/sourceforge/jsxe/action/FileSaveAction.java branches/jsxe2/src/net/sourceforge/jsxe/action/FileSaveAsAction.java branches/jsxe2/src/net/sourceforge/jsxe/action/OpenRecentFileAction.java branches/jsxe2/src/net/sourceforge/jsxe/action/ToolsOptionsAction.java branches/jsxe2/src/net/sourceforge/jsxe/action/ToolsPluginManagerAction.java branches/jsxe2/src/net/sourceforge/jsxe/action/ValidationErrorsAction.java branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLDocument.java branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLDocumentListener.java branches/jsxe2/src/net/sourceforge/jsxe/gui/ActivityLogDialog.java branches/jsxe2/src/net/sourceforge/jsxe/gui/DirtyFilesDialog.java branches/jsxe2/src/net/sourceforge/jsxe/gui/EnhancedDialog.java branches/jsxe2/src/net/sourceforge/jsxe/gui/ErrorListDialog.java branches/jsxe2/src/net/sourceforge/jsxe/gui/GlobalOptionsDialog.java branches/jsxe2/src/net/sourceforge/jsxe/gui/Messages.java branches/jsxe2/src/net/sourceforge/jsxe/gui/OptionsDialog.java branches/jsxe2/src/net/sourceforge/jsxe/gui/OptionsPanel.java branches/jsxe2/src/net/sourceforge/jsxe/gui/PluginManagerDialog.java branches/jsxe2/src/net/sourceforge/jsxe/gui/StatusBar.java branches/jsxe2/src/net/sourceforge/jsxe/gui/TabbedView.java branches/jsxe2/src/net/sourceforge/jsxe/gui/jsxeAboutDialog.java branches/jsxe2/src/net/sourceforge/jsxe/gui/jsxeFileDialog.java branches/jsxe2/src/net/sourceforge/jsxe/jsXe.java branches/jsxe2/src/net/sourceforge/jsxe/options/OptionPane.java branches/jsxe2/src/net/sourceforge/jsxe/properties branches/jsxe2/src/net/sourceforge/jsxe/util/Log.java branches/jsxe2/src/net/sourceforge/jsxe/util/MiscUtilities.java Added Paths: ----------- branches/jsxe2/buildlib/ branches/jsxe2/buildlib/jsmoothgen-ant.jar branches/jsxe2/buildlib/skeletons/ branches/jsxe2/buildlib/skeletons/windowed-wrapper/ branches/jsxe2/buildlib/skeletons/windowed-wrapper/description.skel branches/jsxe2/buildlib/skeletons/windowed-wrapper/jwrap.exe branches/jsxe2/jsXe.jsmooth branches/jsxe2/messages/messages branches/jsxe2/messages/messages.ja branches/jsxe2/src/net/sourceforge/jsxe/ActionManager.java branches/jsxe2/src/net/sourceforge/jsxe/EBListener.java branches/jsxe2/src/net/sourceforge/jsxe/EBMessage.java branches/jsxe2/src/net/sourceforge/jsxe/EditBus.java branches/jsxe2/src/net/sourceforge/jsxe/LocalizedAction.java branches/jsxe2/src/net/sourceforge/jsxe/action/CopyAction.java branches/jsxe2/src/net/sourceforge/jsxe/action/CutAction.java branches/jsxe2/src/net/sourceforge/jsxe/action/DocumentOptionsAction.java branches/jsxe2/src/net/sourceforge/jsxe/action/FindAction.java branches/jsxe2/src/net/sourceforge/jsxe/action/FindNextAction.java branches/jsxe2/src/net/sourceforge/jsxe/action/PasteAction.java branches/jsxe2/src/net/sourceforge/jsxe/gui/DocumentOptionsDialog.java branches/jsxe2/src/net/sourceforge/jsxe/gui/GUIUtilities.java branches/jsxe2/src/net/sourceforge/jsxe/gui/GrabKeyDialog.java branches/jsxe2/src/net/sourceforge/jsxe/gui/GridPanel.java branches/jsxe2/src/net/sourceforge/jsxe/gui/KeyEventTranslator.java branches/jsxe2/src/net/sourceforge/jsxe/gui/KeyEventWorkaround.java branches/jsxe2/src/net/sourceforge/jsxe/gui/VariableGridLayout.java branches/jsxe2/src/net/sourceforge/jsxe/gui/menu/ branches/jsxe2/src/net/sourceforge/jsxe/gui/menu/WrappingMenu.java branches/jsxe2/src/net/sourceforge/jsxe/msg/ branches/jsxe2/src/net/sourceforge/jsxe/msg/DocumentBufferUpdate.java branches/jsxe2/src/net/sourceforge/jsxe/msg/PropertyChanged.java branches/jsxe2/src/net/sourceforge/jsxe/options/AbstractOptionPane.java branches/jsxe2/src/net/sourceforge/jsxe/options/GeneralOptionPane.java branches/jsxe2/src/net/sourceforge/jsxe/options/ShortcutsOptionPane.java Removed Paths: ------------- branches/jsxe2/buildlib/jsmoothgen-ant.jar branches/jsxe2/buildlib/skeletons/ branches/jsxe2/buildlib/skeletons/windowed-wrapper/ branches/jsxe2/buildlib/skeletons/windowed-wrapper/description.skel branches/jsxe2/buildlib/skeletons/windowed-wrapper/jwrap.exe branches/jsxe2/messages/messages.en branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLDocumentEvent.java branches/jsxe2/src/net/sourceforge/jsxe/dom/event/ branches/jsxe2/src/net/sourceforge/jsxe/gui/EnhancedMenu.java branches/jsxe2/src/net/sourceforge/jsxe/gui/menu/WrappingMenu.java branches/jsxe2/src/net/sourceforge/jsxe/msg/DocumentBufferUpdate.java branches/jsxe2/src/net/sourceforge/jsxe/msg/PropertyChanged.java Modified: branches/jsxe2/Changelog =================================================================== --- branches/jsxe2/Changelog 2006-07-29 01:44:34 UTC (rev 1086) +++ branches/jsxe2/Changelog 2006-07-29 04:40:06 UTC (rev 1087) @@ -1,6 +1,14 @@ +07/28/2006 Ian Lewis <Ian...@me...> + + * Added some multi-threaded support. + 07/26/2006 Ian Lewis <Ian...@me...> * Added support for error nodes in the new data model + * Updated the find and findnext actions to use proper messages + labels. + * Fixed a bug where the shortcuts for Built-In commands were not being + honored. 07/25/2006 Ian Lewis <Ian...@me...> @@ -12,12 +20,90 @@ types. * Added some support for the URIs and standalone properties in XMLDocument. + * Fixed a bug with the source view for new users that caused a + NullPointerException to be thrown when opening the source view. + * Added a wrapper exe for windows users using jSmooth +07/21/2006 Ian Lewis <Ian...@me...> + + * Fixed bug 1509575. Files that are reloaded should always be loaded in a + view that can accep the reloaded file. + 07/20/2006 Ian Lewis <Ian...@me...> * Xerces needs to be installed in the java endorsed directory now to make use of DOM3 classes. + * Released 0.5pre1 + * Keyboard shortcuts are now fully supported. + * Added Japanese translation +07/12/2006 Ian Lewis <Ian...@me...> + + * Added functionality to save keyboard shortcuts. The shortcuts themselves + work but the shortcut labels for menu items are not updated when the + action is updated. This is a bug that is fixed in the beta for Java 6 + but obviously it can't wait that long. + * Renamed EnhancedMenu to WrappingMenu. I think it's more descriptive. + * Updated messages to load the messages files in UTF-8 + +07/10/2006 Ian Lewis <Ian...@me...> + + * Added the Shortcuts option pane. However, it currently it doesn't work. + It only displays the built in options and the combo box. + * Updated the shortcuts option pane so that it shows the select shortcut + dialog. + +07/06/2006 Ian Lewis <Ian...@me...> + + * Rewrote the Messages class. Now it loads messages on demand and only + loads the messages that it needs but allows the Locale to be changed at + any time. It also now supports different countries and variants. + +06/27/2006 Ian Lewis <Ian...@me...> + + * Added the GUIUtilities class for handling utility functions in jsXe. + * Added the GrabKeyDialog which will be used to assign shortcuts. + * Updated many classes for supporting shortcuts. + +06/23/2006 Ian Lewis <Ian...@me...> + + * Added back rudimentary key bindings using Swing Actions so they get + dispached by Swing and are displayed in menus. But infrastructure is + in place to allow jsXe to catch key bindings itself. + +06/21/2006 Ian Lewis <Ian...@me...> + + * Moved EnhancedMenu to it's own package. I will be creating a new menu + class that is specially designed for jsXe's LocalizedActions + * Created a new option for how many items can be in menus before they spill + over. + +06/20/2006 Ian Lewis <Ian...@me...> + + * Updated actions in jsXe so that actions can be easily localized and + so that they can be assigned shortcuts. Future actions that are registered + with jsXe will extend this class. The ActionManager now manages ActionSets + and key bindings within jsXe. + +06/15/2006 Ian Lewis <Ian...@me...> + + * Added a new Status column to the Plugin Manager dialog + * Added new plugin properties for the plugin author and release date + +06/14/2006 Ian Lewis <Ian...@me...> + + * Added the EditAction class for future actions in jsXe. + The messages, menu mnemonics, and tooltips will be able to be + localized and the shortcuts will be able to be set via the + InputManager. + +06/13/2006 Ian Lewis <Ian...@me...> + + * Added the InputManager for maintaining the key bindings for actions in + jsXe. + * Updated the param string for PropertyChanged messages. + * Moved the general options pane to it's own file. + 06/08/2006 Ian Lewis <Ian...@me...> * XMLAttribute was added to the new data model. @@ -28,7 +114,28 @@ * Added a new XMLDocumentType class * Added factory methods for XMLElements and XMLAttributes to the XMLDocument class. + * Added a PropertyChanged event for when one of jsXe's properties changes. + * Updated lots of javadoc + * jsXe's global options now implements AbstractOptionPane +06/07/2006 Ian Lewis <Ian...@me...> + + * Updated the document options to use abstract classes to lay out the + dialog. OptionsPanel is now deprecated in favor of using the OptionPane + and AbstractOptionPane classes. + * Updated dialogs to use setVisible() instead of show() + +06/06/2006 Ian Lewis <Ian...@me...> + + * Added a new Document Options Dialog which handles settings on a per + document basis. + * Updated the Global Options so that they don't include the per document + options anymore. + * Updated the DirtyFilesDialog so that it selects the first entry by + default. + * Updated EnhancedDialogs to be resizable by default. + * Updated the file dialog to use localized messages in the title + 06/04/2006 Ian Lewis <Ian...@me...> * XMLElement was added to model element nodes @@ -43,6 +150,11 @@ * Added insertUpdate and removeUpdate methods to the XMLDocumentListener * Updated XMLDocument to notify listeners on insert and remove events. +05/31/2006 Ian Lewis <Ian...@me...> + + * All plugins now implement EBListener and are added to the EditBus + * Updated the use of EditBus messages + 05/24/2006 Ian Lewis <Ian...@me...> * Updated the minimum version of xerces needed to run jsXe to 2.8. Modified: branches/jsxe2/INSTALL =================================================================== --- branches/jsxe2/INSTALL 2006-07-29 01:44:34 UTC (rev 1086) +++ branches/jsxe2/INSTALL 2006-07-29 04:40:06 UTC (rev 1087) @@ -25,10 +25,12 @@ BUILDING jsXe FROM SOURCE This is pretty simple. You will need jakarta ANT and a Sun's javac compiler -(others might work, I just haven't tested them). Also, in order for jsXe to -compile properly you will need Apache Xerces installed. +(others might work, I just haven't tested them). You will need the optional +ant tasks installed as well. On some Linux distributions this may be a separate +package. Also, in order for jsXe to compile properly you will need Apache +Xerces installed. -You should have 1.4.2 or better of java and you will need version 2.8.0 of +You will need version 1.4.2 or better of java and you will need version 2.8.0 of Xerces (A Xerces 2.8.0 binary distribution is not included in the CVS source tree. You can aquire it at at http://xml.apache.org/) The jar files xercesImpl.jar, xml-apis.jar, and resolver.jar from the 2.8.0 distribution are @@ -36,7 +38,7 @@ (where you installed jsXe's source) or in the jre/lib/ext or lib/ext in your JVM. These jar files will be included with jsXe distributions for convenience. -Simply typing 'ant' or 'ant -p' in jsXe's root directory will give you the +Simply typing 'ant' in jsXe's root directory will give you the available targets to use with ant. To just simply compile jsXe and the default views to a jar file you can type 'ant compile'. To build a binary distribution you will need to run the 'bin' target in the build.xml file. I do this by simply @@ -51,23 +53,19 @@ RUNNING jsXe You should have 1.4.2 or better of java and you need 2.6.2 of Xerces. -To run jsXe you should just run the java interpreter on the jsXe.jar file. There -is a shell script or batch file included in the source tree for this purpose. - ./bin/jsXe.sh +*Windows* -or +Just run jsXe using the jsXe.exe in the install directory. The exe will +detect your version of Java and run jsXe using that version. - ./bin/jsXe.bat +*Unix* -The batch program should be run in with the jsXe root directory of as the -working directory. So you can create a shortcut to run jsXe by specifying the -batch file as the program to run and jsXe's root directory as the working -directory. +To run jsXe you should just run the java interpreter on the jsXe.jar file. There +is a shell script or batch file included in the source tree for this purpose. -Ex. -Target: "C:\Program Files\jsXe\bin\jsXe.bat" -Start in: "C:\Program Files\jsXe\" +./bin/jsXe.sh -You can also edit the JSXEDIR variable in the batch program to be the directory -where you installed jsXe and then the 'Start in' directory can be anywhere. +The shell script should be run in with the jsXe root directory of as the +working directory. You can also edit the JSXEDIR variable in the shell script +to be the directory where you installed jsXe. Modified: branches/jsxe2/NEWS =================================================================== --- branches/jsxe2/NEWS 2006-07-29 01:44:34 UTC (rev 1086) +++ branches/jsxe2/NEWS 2006-07-29 04:40:06 UTC (rev 1087) @@ -1,3 +1,24 @@ +07/24/2006 version 0.5 pre2 + + * Fixed a bug with the source view for new users that caused a + NullPointerException to be thrown when opening the source view. + * Added a wrapper exe for windows users using jSmooth + * Fixed bug 1509575. Files that are reloaded should always be loaded in a + view that can accep the reloaded file. + +07/20/2006 version 0.5 pre1 + + * Added support for keyboard shortcuts that can be set by the user via + the Global Options Dialog. + * Split the options into two dialogs. The Global Options, which are + editor-wide options, and the Document Options, which are set for each + document. + * Added a Japanese translation. + * Added a British-English translation. + * Fixed translation files so that non-ASCII characters will be displayed + properly. + * Added a status bar to display messages to the user. + 04/25/2006 version 0.4 beta * Updated to work with xerces 2.8.0 (jsXe now requires xerces 2.8.0) Modified: branches/jsxe2/RELEASE.CHECKLIST =================================================================== --- branches/jsxe2/RELEASE.CHECKLIST 2006-07-29 01:44:34 UTC (rev 1086) +++ branches/jsxe2/RELEASE.CHECKLIST 2006-07-29 04:40:06 UTC (rev 1087) @@ -1,48 +1,17 @@ RELEASE CHECKLIST -*********Minor release********* +* Make sure all bugs that are priority 5 or higher are resolved. -* Update the Changelog file -* Update the NEWS file -* Update the README if needed -* Update the AUTHORS if needed -* Update the INSTALL file if needed -* Update the README if needed - -* Make a new tag in SVN for the release. - -* Update the jsXe website in SVN to reference the new versions -* Update the jsXe website in SVN to have the correct help and documentation. - * Run 'ant deploy-web-doc' - -Build the project - * Make sure the major.version, minor.version, beta.version, bugfix.version, - app.version, and app_version are correct in build.xml - * Build the release files using 'ant bin src' - -* Create new release on sourceforge - * Upload binary and source distribution to Sourceforge - * Add the NEWS and Changelog entries to the release. -* Update the News on the sourceforge project page. -* Update the freshmeat project with the new version and URLs. - -*********Major release********* - * Get translations finalized * Build the Java Doc and check it for omissions and errors. -* Make sure all bugs that have a priority above 5 are resolved. * Update the Changelog file * Update the NEWS file * Update the README if needed * Update the AUTHORS if needed * Update the INSTALL file if needed -* Update the README if needed - -* Make a new tag in SVN for the release. - -* Update the jsXe website in SVN to reference the new versions -* Update the jsXe website in SVN to have the correct help and documentation. +* Update the jsXe website in CVS to reference the new versions +* Update the jsXe website in CVS to have the correct help and documentation. * Run 'ant deploy-web-doc' Build the project Modified: branches/jsxe2/build.xml =================================================================== --- branches/jsxe2/build.xml 2006-07-29 01:44:34 UTC (rev 1086) +++ branches/jsxe2/build.xml 2006-07-29 04:40:06 UTC (rev 1087) @@ -9,161 +9,196 @@ You should check out jsxe to make a structure like this. This ensures that when compiling jsXe the other views will be compiled as well. - jsxe module => jsxe/ - treeview module => jsxe/jars/treeview - sourceview module => jsxe/jars/sourceview - jsxe web module => web/ + jsxe module => jsxe/ + treeview module (optional) => jsxe/jars/treeview + sourceview module (optional) => jsxe/jars/sourceview + jsxe web module (optional) => web/ + jsmooth ant task (optional) => buildlib/ + --> <project basedir="." default="usage" name="jsXe"> - + <description>jsXe - Java Simple XML Editor</description> <!-- {{{ ============ Initializes properties and variables ============= --> - <target name="init"> - <tstamp/> - <property name="app.name" value="jsXe"/> - <property name="root.dir" value="."/> + <target name="init"> + <tstamp/> + <property name="app.name" value="jsXe"/> + <property name="root.dir" value="."/> <property name="build.dir" value="${root.dir}/build"/> - <property name="src.dir" value="${root.dir}/src"/> - <property name="lib.dir" value="${root.dir}/lib"/> - <property name="bin.dir" value="${root.dir}/bin"/> - <property name="messages.dir" value="${root.dir}/messages"/> + <property name="src.dir" value="${root.dir}/src"/> + <property name="lib.dir" value="${root.dir}/lib"/> + <property name="bin.dir" value="${root.dir}/bin"/> + <property name="messages.dir" value="${root.dir}/messages"/> <property name="build.messages" value="${build.dir}/messages"/> <property name="docs.dir" value="${src.dir}/doc"/> <property name="plugin.dir" value="${root.dir}/jars"/> - <property name="build.src" value="${build.dir}/src"/> - <property name="build.dest" value="${build.dir}/classes"/> - <property name="build.docs" value="${build.dir}/doc"/> - <property name="build.lib" value="${build.dir}/lib"/> - <property name="build.bin" value="${build.dir}/bin"/> - <property name="build.bin" value="${build.dir}/bin"/> + <property name="build.plugin" value="${build.dir}/jars"/> + <property name="build.src" value="${build.dir}/src"/> + <property name="build.dest" value="${build.dir}/classes"/> + <property name="build.docs" value="${build.dir}/doc"/> + <property name="build.lib" value="${build.dir}/lib"/> + <property name="build.bin" value="${build.dir}/bin"/> <property name="date.format" value="MM.dd.yyyy HH:mm:ss z"/> - <property name="build.javadocs" value="${build.docs}/api"/> - <property name="build.help" value="${build.docs}/help"/> + <property name="build.javadocs" value="${build.docs}/api"/> + <property name="build.help" value="${build.docs}/help"/> <property name="javac.debug" value="on"/> - <property name="javac.optimize" value="off"/> - <property name="javac.deprecation" value="on"/> + <property name="javac.optimize" value="off"/> + <property name="javac.deprecation" value="on"/> <property name="javac.include.runtime" value="no"/> <property name="javac.source" value="1.3"/> - <property name="javadoc.link" value="http://java.sun.com/j2se/1.3/docs/api/"/> + <property name="java.javadoc.link" value="http://java.sun.com/j2se/1.3/docs/api/"/> + <property name="xerces.javadoc.link" value="http://xerces.apache.org/xerces2-j/javadocs/api/"/> <property name="main.class" value="net.sourceforge.jsxe.jsXe"/> - <property name="major.version" value="0"/> - <property name="minor.version" value="5"/> - <property name="beta.version" value="1"/> + <property name="major.version" value="0"/> + <property name="minor.version" value="5"/> + <property name="beta.version" value="3"/> <property name="bugfix.version" value="0"/> <!-- Human Readable --> - <property name="app.version" value="0.5 pre1"/> + <property name="app.version" value="0.5 pre3"/> <!-- Used in filenames --> - <property name="app_version" value="05_pre1"/> - <!--<property name="app.version" value="${major.version}.${minor.version} beta"/>--> - <!--<property name="app_version" value="${major.version}_${minor.version}beta"/>--> - <property name="distbin.dir" value="${build.dir}/${app.name}-${app_version}-bin"/> - <property name="distsrc.dir" value="${build.dir}/${app.name}-${app_version}-src"/> + <property name="app_version" value="05_pre3"/> + <property name="buildlib.dir" value="${root.dir}/buildlib"/> + <property name="jsmooth.project" value="${root.dir}/jsXe.jsmooth"/> + <property name="jsmooth.jar" value="${buildlib.dir}/jsmoothgen-ant.jar"/> + + <condition property="windows.build"> + <and> + <os family="windows"/> + <available file="${jsmooth.jar}" property="jsmooth.avail"/> + </and> + </condition> + + <property name="distbin.dir" value="${build.dir}/${app.name}-${app_version}-bin"/> + <property name="distsrc.dir" value="${build.dir}/${app.name}-${app_version}-src"/> <path id="classpath"> - <pathelement location="."/> - <pathelement location="${build.dest}"/> - <pathelement location="${build.src}"/> - <pathelement location="${src.dir}"/> - <fileset dir="${lib.dir}"> - <include name="**/*.jar"/> - </fileset> - </path> + <pathelement location="."/> + <pathelement location="${build.dest}"/> + <pathelement location="${build.src}"/> + <pathelement location="${src.dir}"/> + <fileset dir="${lib.dir}"> + <include name="**/*.jar"/> + </fileset> + </path> + <path id="run-classpath"> + <pathelement location="${build.dir}/${app.name}.jar"/> + <fileset dir="${lib.dir}"> + <include name="**/*.jar"/> + </fileset> + </path> + <!-- set whether we have the source for the default views --> <available file="${plugin.dir}/treeview/build.xml" property="treeview.avail"/> <available file="${plugin.dir}/sourceview/build.xml" property="sourceview.avail"/> <available file="${root.dir}/../web" property="web.avail"/> + <available file="${plugin.dir}" property="plugin.avail"/> - <echo message="${app.name} ${app.version}"/> - <echo message="----------------------------------------------------------"/> - </target> - <!-- }}} --> - <!-- {{{ ============ Prints the available targets ===================== --> - <target depends="init" name="usage" description="Prints available targets"> - <echo message=" available targets are:"/> - <echo message=""/> - <echo message=" compile --> generates the ${app.name}.jar file."/> + + <echo message="${app.name} ${app.version}"/> + <echo message="----------------------------------------------------------"/> + </target> + <!-- }}} --> + <!-- {{{ ============ Prints the available targets ===================== --> + <target depends="init" name="usage" description="Prints available targets"> + <echo message=" available targets are:"/> + <echo message=""/> + <echo message=" compile --> generates the ${app.name}.jar file."/> <echo message=" also generates the jars for the tree view"/> <echo message=" and source view plugins if available."/> - <echo message=" bin --> generates a binary distribution"/> - <echo message=" src --> generates a source distribution"/> - <echo message=" doc --> generates all documentation"/> + <echo message=" bin --> generates a binary distribution"/> + <echo message=" src --> generates a source distribution"/> + <echo message=" doc --> generates all documentation"/> <echo message=" also updates the web api if the web module"/> <echo message=" is available."/> - <echo message=" clean --> cleans everything up"/> - </target> - <!-- }}} --> - <!-- {{{ ============ Prepares for any type of build =================== --> - <target depends="init" name="prepare"> - <mkdir dir="${build.dir}"/> - </target> - <!-- }}} --> - <!-- {{{ ============ Prepares the documentation ======================= --> - <target depends="prepare" name="prepare-doc"> - <mkdir dir="${build.docs}"/> - </target> - <!-- }}} --> - <!-- {{{ ============ Prepares the source distribution ================= --> - <target depends="prepare" name="prepare-src"> - <mkdir dir="${build.src}"/> - <copy todir="${build.src}"> - <fileset dir="${src.dir}"> - <include name="**/*.java"/> - <include name="**/*.props"/> - <include name="**/*.properties"/> - <include name="**/properties"/> + <echo message=" clean --> cleans everything up"/> + </target> + <!-- }}} --> + <!-- {{{ ============ Prepares for any type of build =================== --> + <target depends="init" name="prepare"> + <mkdir dir="${build.dir}"/> + </target> + <!-- }}} --> + <!-- {{{ ============ Prepares the documentation ======================= --> + <target depends="prepare" name="prepare-doc"> + <mkdir dir="${build.docs}"/> + </target> + <!-- }}} --> + <!-- {{{ ============ Prepares the source distribution ================= --> + <target depends="prepare" name="prepare-src"> + <mkdir dir="${build.src}"/> + <copy todir="${build.src}"> + <fileset dir="${src.dir}"> + <include name="**/*.java"/> + <include name="**/*.props"/> + <include name="**/*.properties"/> + <include name="**/properties"/> <include name="**/*.xml"/> <!-- internal xml docs are not validated --> <!--<include name="**/*.dtd"/>--> - <include name="**/*.jpg"/> - <include name="**/*.png"/> + <include name="**/*.jpg"/> + <include name="**/*.png"/> <!-- files in the source directory to ignore --> - <exclude name="net/sourceforge/jsxe/dom2/ls/XMLDocumentIORequest.java"/> + <exclude name="net/sourceforge/jsxe/dom2/**/*"/> <exclude name="net/sourceforge/jsxe/io/**/*"/> - </fileset> - </copy> + </fileset> + </copy> + <mkdir dir="${build.plugin}"/> + + <antcall target="prepare-plugins"/> + <mkdir dir="${build.messages}"/> - <copy todir="${build.messages}"> + <!--<copy todir="${build.messages}"> <fileset dir="${messages.dir}"> <include name="**/messages.*"/> </fileset> + </copy>--> + + <!-- run native2ascii on these files --> + <native2ascii encoding="UTF-8" src="${messages.dir}" dest="${build.messages}" includes="messages*"/> + </target> + <target name="prepare-plugins" if="plugin.avail"> + <copy todir="${build.plugin}"> + <fileset dir="${plugin.dir}"> + <include name="**/*"/> + </fileset> </copy> - </target> - <!-- }}} --> - <!-- {{{ ============ Compiles the program ============================= --> - <target depends="prepare-src" name="compile" description="compile jsXe"> - <mkdir dir="${build.dest}"/> - <javac debug="${javac.debug}" deprecation="${javac.deprecation}" includeJavaRuntime="${javac.include.runtime}" optimize="${javac.optimize}" source="${javac.source}" destdir="${build.dest}" srcdir="${build.src}"> - <classpath refid="classpath"/> + </target> + <!-- }}} --> + <!-- {{{ ============ Compiles the program ============================= --> + <target depends="prepare-src" name="compile" description="compile jsXe"> + <mkdir dir="${build.dest}"/> + <javac debug="${javac.debug}" deprecation="${javac.deprecation}" includeJavaRuntime="${javac.include.runtime}" optimize="${javac.optimize}" source="${javac.source}" destdir="${build.dest}" srcdir="${build.src}"> + <classpath refid="classpath"/> <include name="**/*.java"/> - </javac> - <copy todir="${build.dest}"> - <fileset dir="${build.src}"> - <include name="**/*.props"/> - <include name="**/*.properties"/> - <include name="**/properties"/> + </javac> + <copy todir="${build.dest}"> + <fileset dir="${build.src}"> + <include name="**/*.props"/> + <include name="**/*.properties"/> + <include name="**/properties"/> <include name="**/*.xml"/> <!-- internal xml docs are not validated --> <!--<include name="**/*.dtd"/>--> - <include name="**/*.jpg"/> - <include name="**/*.png"/> - </fileset> - </copy> - + <include name="**/*.jpg"/> + <include name="**/*.png"/> + </fileset> + </copy> + <!-- set the build properties --> <propertyfile comment="${app.name}'s build properties" file="${build.dest}/net/sourceforge/jsxe/build.properties"> - <entry key="application.name" value="${app.name}"/> - <entry key="build.time" pattern="${date.format}" type="date" value="now"/> + <entry key="application.name" value="${app.name}"/> + <entry key="build.time" pattern="${date.format}" type="date" value="now"/> <entry key="major.version" value="${major.version}"/> - <entry key="minor.version" value="${minor.version}"/> - <entry key="beta.version" value="${beta.version}"/> + <entry key="minor.version" value="${minor.version}"/> + <entry key="beta.version" value="${beta.version}"/> <entry key="build.version" value="${bugfix.version}"/> - </propertyfile> + </propertyfile> <!-- create jar manifest --> - <manifest file="${root.dir}/${app.name}.manifest"> + <manifest file="${build.dir}/${app.name}.manifest"> <attribute name="Built-By" value="${user.name}"/> <attribute name="Main-Class" value="${main.class}"/> <section name="common"> @@ -172,161 +207,214 @@ </section> </manifest> - <jar jarfile="${root.dir}/${app.name}.jar" manifest="${app.name}.manifest"> - <fileset dir="${build.dest}"> - <include name="**/*.class"/> - <include name="**/properties"/> - <include name="**/*.props"/> - <include name="**/*.properties"/> + <jar jarfile="${build.dir}/${app.name}.jar" manifest="${build.dir}/${app.name}.manifest"> + <fileset dir="${build.dest}"> + <include name="**/*.class"/> + <include name="**/properties"/> + <include name="**/*.props"/> + <include name="**/*.properties"/> <include name="**/*.xml"/> <!-- internal xml docs are not validated --> <!--<include name="**/*.dtd"/>--> - <include name="**/*.jpg"/> - <include name="**/*.png"/> - </fileset> - </jar> + <include name="**/*.jpg"/> + <include name="**/*.png"/> + </fileset> + </jar> <!-- compile default views --> <antcall target="build-treeview"/> <antcall target="build-sourceview"/> - </target> + </target> <target name="build-treeview" if="treeview.avail"> - <ant inheritAll="false" dir="${plugin.dir}/treeview/" target="compile"/> + <ant inheritAll="false" dir="${build.plugin}/treeview/" target="compile"/> </target> <target name="build-sourceview" if="sourceview.avail"> - <ant inheritAll="false" dir="${plugin.dir}/sourceview/" target="compile"/> + <ant inheritAll="false" dir="${build.plugin}/sourceview/" target="compile"/> </target> - <!-- }}} --> - <!-- {{{ ============ Prepares for a build ============================= --> - <target depends="init" name="prepare-build"> - <!-- lib --> - <mkdir dir="${build.dir}/lib"/> - <copy todir="${build.dir}/lib"> - <fileset dir="${lib.dir}"> - <include name="**/*"/> - </fileset> - </copy> - <!-- bin --> - <mkdir dir="${build.dir}/bin"/> - <copy todir="${build.dir}/bin"> - <fileset dir="${bin.dir}"> - <include name="**/*"/> - </fileset> - </copy> - </target> - <!-- }}} --> - <!-- {{{ ============ Generates the documentation ====================== --> - <target depends="prepare-doc, prepare-src" name="doc" description="Build documentation"> - <copy file="COPYING" tofile="${build.docs}/COPYING"/> - <copy file="README" tofile="${build.docs}/README"/> - <copy file="AUTHORS" tofile="${build.docs}/AUTHORS"/> - <copy file="ISSUES" tofile="${build.docs}/ISSUES"/> - <copy file="Changelog" tofile="${build.docs}/Changelog"/> - <copy file="INSTALL" tofile="${build.docs}/INSTALL"/> - <copy file="THANKS" tofile="${build.docs}/THANKS"/> - <copy file="NEWS" tofile="${build.docs}/NEWS"/> - <javadoc author="true" destdir="${build.javadocs}" doctitle="${app.name} ${app.version} API" link="${javadoc.link}" locale="en_US" packagenames="*" sourcepath="${build.src}" version="true" windowtitle="${app.name} ${app.version} API"/> + <!-- }}} --> + <!-- {{{ ============ Run the program ================================== --> + <target depends="compile" name="run" description="run jsXe"> + <java fork="true" classname="${main.class}"> + <classpath refid="run-classpath"/> + </java> + </target> + <!-- }}} --> + <!-- {{{ ============ Run the program in debug mode ==================== --> + <target depends="compile" name="debug" description="run jsXe in debug mode"> + <java fork="true" classname="${main.class}"> + <classpath refid="run-classpath"/> + <arg value="--debug"/> + </java> + </target> + <!-- }}} --> + <!-- {{{ ============ Prepares for a build ============================= --> + <target depends="init" name="prepare-build"> + <!-- lib --> + <mkdir dir="${build.dir}/lib"/> + <copy todir="${build.dir}/lib"> + <fileset dir="${lib.dir}"> + <include name="**/*"/> + </fileset> + </copy> + <!-- bin --> + <mkdir dir="${build.dir}/bin"/> + <copy todir="${build.dir}/bin"> + <fileset dir="${bin.dir}"> + <include name="**/*"/> + </fileset> + </copy> + </target> + <!-- }}} --> + <!-- {{{ ============ Generates the documentation ====================== --> + <target depends="prepare-doc, prepare-src" name="doc" description="Build documentation"> + <copy file="${root.dir}/COPYING" tofile="${build.docs}/COPYING"/> + <copy file="${root.dir}/README" tofile="${build.docs}/README"/> + <copy file="${root.dir}/AUTHORS" tofile="${build.docs}/AUTHORS"/> + <copy file="${root.dir}/ISSUES" tofile="${build.docs}/ISSUES"/> + <copy file="${root.dir}/Changelog" tofile="${build.docs}/Changelog"/> + <copy file="${root.dir}/INSTALL" tofile="${build.docs}/INSTALL"/> + <copy file="${root.dir}/THANKS" tofile="${build.docs}/THANKS"/> + <copy file="${root.dir}/NEWS" tofile="${build.docs}/NEWS"/> + + <javadoc author="true" destdir="${build.javadocs}" doctitle="${app.name} ${app.version} API" locale="en_US" packagenames="*" sourcepath="${build.src}" version="true" windowtitle="${app.name} ${app.version} API"> + <link href="${java.javadoc.link}"/> + <link href="${xerces.javadoc.link}"/> + </javadoc> + <zip basedir="${build.docs}" includes="api/**" zipfile="${build.dir}/${app.name}-${app_version}-api.zip"/> + </target> - <!-- }}} --> - <!-- {{{ ============ Generates the binary distribution ================ --> - <target depends="compile, prepare-build, doc" name="bin" description="Build binary distribution"> - + <!-- }}} --> + <!-- {{{ ============ Generates the binary distribution ================ --> + <target depends="compile, prepare-build, doc" name="bin" description="Build binary distribution"> + <!-- plugins --> <mkdir dir="${distbin.dir}/jars"/> <copy todir="${distbin.dir}/jars"> - <fileset dir="${plugin.dir}"> + <fileset dir="${build.plugin}"> <include name="*.jar"/> </fileset> </copy> <!-- doc --> - <mkdir dir="${distbin.dir}/doc"/> - <copy todir="${distbin.dir}/doc"> - <fileset dir="${build.docs}"> - <include name="**/*"/> - </fileset> - </copy> - <!-- bin --> - <mkdir dir="${distbin.dir}/bin"/> - <copy todir="${distbin.dir}/bin"> - <fileset dir="${build.bin}"> - <include name="**/*"/> - </fileset> - </copy> + <mkdir dir="${distbin.dir}/doc"/> + <copy todir="${distbin.dir}/doc"> + <fileset dir="${build.docs}"> + <include name="**/*"/> + </fileset> + </copy> + <!-- bin --> + <mkdir dir="${distbin.dir}/bin"/> + <copy todir="${distbin.dir}/bin"> + <fileset dir="${build.bin}"> + <include name="**/*"/> + </fileset> + </copy> <!-- messages --> <mkdir dir="${distbin.dir}/messages"/> - <copy todir="${distbin.dir}/messages"> - <fileset dir="${build.messages}"> - <include name="**/messages.*"/> - </fileset> - </copy> + <copy todir="${distbin.dir}/messages"> + <fileset dir="${build.messages}"> + <include name="**/messages*"/> + </fileset> + </copy> - <copy file="${app.name}.jar" tofile="${distbin.dir}/${app.name}.jar"/> - <!-- lib --> - <mkdir dir="${distbin.dir}/lib"/> - <copy todir="${distbin.dir}/lib"> - <fileset dir="${build.lib}"> - <include name="**/*"/> - </fileset> - </copy> - <zip basedir="${build.dir}" excludes="*.class" includes="${app.name}-${app_version}-bin/**" zipfile="${build.dir}/${app.name}-${app_version}-bin.zip"/> - </target> - <!-- }}} --> - <!-- {{{ ============ Generates the source distribution ================ --> - <target depends="prepare-build, prepare-src, doc" name="src" description="Build source distribution"> - + <copy file="${build.dir}/${app.name}.jar" tofile="${distbin.dir}/${app.name}.jar"/> + <!-- lib --> + <mkdir dir="${distbin.dir}/lib"/> + <copy todir="${distbin.dir}/lib"> + <fileset dir="${build.lib}"> + <include name="**/*"/> + </fileset> + </copy> + + <!-- build the windows executable --> + <antcall target="build-exe"/> + + <zip basedir="${build.dir}" excludes="*.class" includes="${app.name}-${app_version}-bin/**" zipfile="${build.dir}/${app.name}-${app_version}-bin.zip"/> + </target> + <target name="build-exe" if="windows.build"> + <taskdef name="jsmoothgen" + classname="net.charabia.jsmoothgen.ant.JSmoothGen" + classpath="${jsmooth.jar}"/> + + <jsmoothgen project="${jsmooth.project}" skeletonroot="${buildlib.dir}/skeletons"/> + <copy todir="${distbin.dir}" file="${build.dir}/jsXe.exe"/> + </target> + <!-- }}} --> + <!-- {{{ ============ Generates the source distribution ================ --> + <target depends="prepare-build, prepare-src, doc" name="src" description="Build source distribution"> + <antcall target="copy-treeview-source"/> <antcall target="copy-sourceview-source"/> <!-- doc --> - <mkdir dir="${distsrc.dir}/doc"/> - <copy todir="${distsrc.dir}/doc"> - <fileset dir="${build.docs}"> - <include name="**/*"/> - </fileset> - </copy> + <mkdir dir="${distsrc.dir}/doc"/> + <copy todir="${distsrc.dir}/doc"> + <fileset dir="${build.docs}"> + <include name="**/*"/> + </fileset> + </copy> + + <!-- move these files to the root dir of the src distribution --> + <move file="${distsrc.dir}/doc/COPYING" tofile="${distsrc.dir}/COPYING"/> + <move file="${distsrc.dir}/doc/README" tofile="${distsrc.dir}/README"/> + <move file="${distsrc.dir}/doc/AUTHORS" tofile="${distsrc.dir}/AUTHORS"/> + <move file="${distsrc.dir}/doc/ISSUES" tofile="${distsrc.dir}/ISSUES"/> + <move file="${distsrc.dir}/doc/Changelog" tofile="${distsrc.dir}/Changelog"/> + <move file="${distsrc.dir}/doc/INSTALL" tofile="${distsrc.dir}/INSTALL"/> + <move file="${distsrc.dir}/doc/THANKS" tofile="${distsrc.dir}/THANKS"/> + <move file="${distsrc.dir}/doc/NEWS" tofile="${distsrc.dir}/NEWS"/> + <!-- build files --> <copy todir="${distsrc.dir}"> <fileset dir="${root.dir}"> <include name="build.xml"/> </fileset> </copy> - <!-- bin --> - <mkdir dir="${distsrc.dir}/bin"/> - <copy todir="${distsrc.dir}/bin"> - <fileset dir="${build.bin}"> - <include name="**/*"/> - </fileset> - </copy> - <!-- src --> - <mkdir dir="${distsrc.dir}/src"/> - <copy todir="${distsrc.dir}/src"> - <fileset dir="${build.src}"> - <include name="**/*"/> - </fileset> - </copy> - <!-- lib --> - <mkdir dir="${distsrc.dir}/lib"/> - <copy todir="${distsrc.dir}/lib"> - <fileset dir="${build.lib}"> - <include name="**/*"/> - </fileset> - </copy> - <!-- messages --> + <!-- bin --> + <mkdir dir="${distsrc.dir}/bin"/> + <copy todir="${distsrc.dir}/bin"> + <fileset dir="${build.bin}"> + <include name="**/*"/> + </fileset> + </copy> + <!-- src --> + <mkdir dir="${distsrc.dir}/src"/> + <copy todir="${distsrc.dir}/src"> + <fileset dir="${build.src}"> + <include name="**/*"/> + </fileset> + </copy> + <!-- lib --> + <mkdir dir="${distsrc.dir}/lib"/> + <copy todir="${distsrc.dir}/lib"> + <fileset dir="${build.lib}"> + <include name="**/*"/> + </fileset> + </copy> + <!-- buildlib --> + <mkdir dir="${distsrc.dir}/buildlib"/> + <copy todir="${distsrc.dir}/buildlib"> + <fileset dir="${buildlib.dir}"> + <include name="**/*"/> + </fileset> + </copy> + <copy todir="${distsrc.dir}" file="${jsmooth.project}"/> + + <!-- messages --> <mkdir dir="${distsrc.dir}/messages"/> - <copy todir="${distsrc.dir}/messages"> - <fileset dir="${build.messages}"> - <include name="**/messages.*"/> - </fileset> - </copy> + <copy todir="${distsrc.dir}/messages"> + <fileset dir="${build.messages}"> + <include name="**/messages*"/> + </fileset> + </copy> - <zip basedir="${build.dir}" excludes="*.class" includes="${app.name}-${app_version}-src/**" zipfile="${build.dir}/${app.name}-${app_version}-src.zip"/> - </target> + <zip basedir="${build.dir}" excludes="*.class" includes="${app.name}-${app_version}-src/**" zipfile="${build.dir}/${app.name}-${app_version}-src.zip"/> + </target> <target name="copy-treeview-source" if="treeview.avail"> <copy todir="${distsrc.dir}/jars"> - <fileset dir="${root.dir}/jars/"> + <fileset dir="${build.dir}/jars/"> <include name="treeview/**/*"/> <exclude name="treeview/build"/> <exclude name="treeview/build/**/*"/> @@ -336,7 +424,7 @@ </target> <target name="copy-sourceview-source" if="sourceview.avail"> <copy todir="${distsrc.dir}/jars"> - <fileset dir="${root.dir}/jars/"> + <fileset dir="${build.dir}/jars/"> <include name="sourceview/**/*"/> <exclude name="sourceview/build"/> <exclude name="sourceview/build/**/*"/> @@ -344,35 +432,33 @@ </fileset> </copy> </target> - <!-- }}} --> - <!-- {{{ ============ Deploys documentation to the web module ========== --> + <!-- }}} --> + <!-- {{{ ============ Deploys documentation to the web module ========== --> <target depends="doc" name="deploy-web-doc" if="web.avail" description="Deploy documentation to the web module"> <copy file="${build.dir}/${app.name}-${app_version}-api.zip" tofile="${root.dir}/../web/api.zip"/> </target> <!-- }}} --> <!-- {{{ ============ Cleans everything up ============================= --> - <target depends="init" name="clean" description="Clean up distribution tree"> - <delete dir="${build.dir}"/> - <delete> - <fileset dir="." includes="${app.name}.jar"/> - <fileset dir="." includes="${app.name}.manifest"/> - <fileset dir="." includes="**/*.class"/> - <fileset dir="." includes="**/*.rej"/> - <fileset dir="." includes="**/*.orig"/> - <fileset dir="." includes="**/.*.swp"/> - <fileset dir="." includes="**/.#*"/> - <fileset dir="." includes="**/.new*"/> - <fileset dir="." includes="**/.directory"/> - <fileset dir="." includes="**/.xvpics"/> - </delete> - <antcall target="clean-treeview"/> - <antcall target="clean-sourceview"/> - </target> - <target name="clean-treeview" if="treeview.avail"> + <target depends="init" name="clean" description="Clean up distribution tree"> + <delete dir="${build.dir}"/> + <delete> + <fileset dir="." includes="**/*.class"/> + <fileset dir="." includes="**/*.rej"/> + <fileset dir="." includes="**/*.orig"/> + <fileset dir="." includes="**/.*.swp"/> + <fileset dir="." includes="**/.#*"/> + <fileset dir="." includes="**/.new*"/> + <fileset dir="." includes="**/.directory"/> + <fileset dir="." includes="**/.xvpics"/> + </delete> + <!--<antcall target="clean-treeview"/>--> + <!--<antcall target="clean-sourceview"/>--> + </target> + <!--<target name="clean-treeview" if="treeview.avail"> <ant inheritAll="false" dir="${plugin.dir}/treeview/" target="clean"/> </target> <target name="clean-sourceview" if="sourceview.avail"> <ant inheritAll="false" dir="${plugin.dir}/sourceview/" target="clean"/> - </target> - <!-- }}} --> -</project> + </target>--> + <!-- }}} --> +</project> \ No newline at end of file Copied: branches/jsxe2/buildlib (from rev 1084, trunk/jsxe/buildlib) Deleted: branches/jsxe2/buildlib/jsmoothgen-ant.jar =================================================================== (Binary files differ) Copied: branches/jsxe2/buildlib/jsmoothgen-ant.jar (from rev 1084, trunk/jsxe/buildlib/jsmoothgen-ant.jar) =================================================================== (Binary files differ) Copied: branches/jsxe2/buildlib/skeletons (from rev 1084, trunk/jsxe/buildlib/skeletons) Copied: branches/jsxe2/buildlib/skeletons/windowed-wrapper (from rev 1084, trunk/jsxe/buildlib/skeletons/windowed-wrapper) Deleted: branches/jsxe2/buildlib/skeletons/windowed-wrapper/description.skel =================================================================== --- trunk/jsxe/buildlib/skeletons/windowed-wrapper/description.skel 2006-07-29 00:09:39 UTC (rev 1084) +++ branches/jsxe2/buildlib/skeletons/windowed-wrapper/description.skel 2006-07-29 04:40:06 UTC (rev 1087) @@ -1,44 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<jsmoothskeleton> -<debug>false</debug> -<description><![CDATA[ -This skeleton wraps <b>GUI applications</b>.<ul> -<li>No console I/O is displayed -<li>If no Java VM is found, it is able to display a configurable URL (typically to a java download page). -</ul> -Arguments can be passed to the application (either use the JSmooth default argument mechanism, or create a shortcut with arguments).]]> -</description> -<executableName>jwrap.exe</executableName> -<resourceCategory>JAVA</resourceCategory> -<resourceJarId>102</resourceJarId> -<resourcePropsId>103</resourcePropsId> -<shortName>Windowed Wrapper</shortName> -<skeletonProperties> -<description>When no JVM is found in the target computer, the user is prompted with the message defined below. Then, the default browser is launched with the URL defined here.</description> -<idName>Message</idName> -<label>Message</label> -<type>textarea</type> -<value>Java has not been found on your computer. Do you want to download it?</value> -</skeletonProperties> -<skeletonProperties> -<description>If the user selects YES to the message prompted above, the default web browser is launched with this URL.</description> -<idName>URL</idName> -<label>URL</label> -<type>string</type> -<value>http://www.java.com</value> -</skeletonProperties> -<skeletonProperties> -<description>The default behaviour is to launch the java application in a different (detached) process. If you want to force the wrapper to launch the Java application in the same process than the exe, than select this option.</description> -<idName>SingleProcess</idName> -<label>Launch java app in the exe process</label> -<type>boolean</type> -<value>0</value> -</skeletonProperties> -<skeletonProperties> -<description>Enable the jsmooth debug console.</description> -<idName>Debug</idName> -<label>Debug console</label> -<type>boolean</type> -<value>0</value> -</skeletonProperties> -</jsmoothskeleton> Copied: branches/jsxe2/buildlib/skeletons/windowed-wrapper/description.skel (from rev 1084, trunk/jsxe/buildlib/skeletons/windowed-wrapper/description.skel) =================================================================== --- branches/jsxe2/buildlib/skeletons/windowed-wrapper/description.skel (rev 0) +++ branches/jsxe2/buildlib/skeletons/windowed-wrapper/description.skel 2006-07-29 04:40:06 UTC (rev 1087) @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<jsmoothskeleton> +<debug>false</debug> +<description><![CDATA[ +This skeleton wraps <b>GUI applications</b>.<ul> +<li>No console I/O is displayed +<li>If no Java VM is found, it is able to display a configurable URL (typically to a java download page). +</ul> +Arguments can be passed to the application (either use the JSmooth default argument mechanism, or create a shortcut with arguments).]]> +</description> +<executableName>jwrap.exe</executableName> +<resourceCategory>JAVA</resourceCategory> +<resourceJarId>102</resourceJarId> +<resourcePropsId>103</resourcePropsId> +<shortName>Windowed Wrapper</shortName> +<skeletonProperties> +<description>When no JVM is found in the target computer, the user is prompted with the message defined below. Then, the default browser is launched with the URL defined here.</description> +<idName>Message</idName> +<label>Message</label> +<type>textarea</type> +<value>Java has not been found on your computer. Do you want to download it?</value> +</skeletonProperties> +<skeletonProperties> +<description>If the user selects YES to the message prompted above, the default web browser is launched with this URL.</description> +<idName>URL</idName> +<label>URL</label> +<type>string</type> +<value>http://www.java.com</value> +</skeletonProperties> +<skeletonProperties> +<description>The default behaviour is to launch the java application in a different (detached) process. If you want to force the wrapper to launch the Java application in the same process than the exe, than select this option.</description> +<idName>SingleProcess</idName> +<label>Launch java app in the exe process</label> +<type>boolean</type> +<value>0</value> +</skeletonProperties> +<skeletonProperties> +<description>Enable the jsmooth debug console.</description> +<idName>Debug</idName> +<label>Debug console</label> +<type>boolean</type> +<value>0</value> +</skeletonProperties> +</jsmoothskeleton> Deleted: branches/jsxe2/buildlib/skeletons/windowed-wrapper/jwrap.exe =================================================================== (Binary files differ) Copied: branches/jsxe2/buildlib/skeletons/windowed-wrapper/jwrap.exe (from rev 1084, trunk/jsxe/buildlib/skeletons/windowed-wrapper/jwrap.exe) =================================================================== (Binary files differ) Copied: branches/jsxe2/jsXe.jsmooth (from rev 1084, trunk/jsxe/jsXe.jsmooth) =================================================================== --- branches/jsxe2/jsXe.jsmooth (rev 0) +++ branches/jsxe2/jsXe.jsmooth 2006-07-29 04:40:06 UTC (rev 1087) @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<jsmoothproject> +<JVMSearchPath>registry</JVMSearchPath> +<JVMSearchPath>javahome</JVMSearchPath> +<JVMSearchPath>jrepath</JVMSearchPath> +<JVMSearchPath>jdkpath</JVMSearchPath> +<JVMSearchPath>exepath</JVMSearchPath> +<JVMSearchPath>jview</JVMSearchPath> +<classPath>build\jsXe.jar</classPath> +<embeddedJar>false</embeddedJar> +<executableName>build\jsXe.exe</executableName> +<iconLocation>src\net\sourceforge\jsxe\icons\jsxe.jpg</iconLocation> +<initialMemoryHeap>16777216</initialMemoryHeap> +<javaProperties> +<name>java.endorsed.dirs</name> +<value>lib</value> +</javaProperties> +<mainClassName>net.sourceforge.jsxe.jsXe</mainClassName> +<maximumMemoryHeap>67108864</maximumMemoryHeap> +<maximumVersion></maximumVersion> +<minimumVersion>1.4.2</minimumVersion> +<skeletonName>Windowed Wrapper</skeletonName> +<skeletonProperties> +<key>Message</key> +<value>Java has not been found on your computer. Do you want to download it?</value> +</skeletonProperties> +<skeletonProperties> +<key>URL</key> +<value>http://www.java.com</value> +</skeletonProperties> +<skeletonProperties> +<key>SingleProcess</key> +<value>0</value> +</skeletonProperties> +<skeletonProperties> +<key>Debug</key> +<value>0</value> +</skeletonProperties> +</jsmoothproject> Copied: branches/jsxe2/messages/messages (from rev 1084, trunk/jsxe/messages/messages) =================================================================== --- branches/jsxe2/messages/messages (rev 0) +++ branches/jsxe2/messages/messages 2006-07-29 04:40:06 UTC (rev 1087) @@ -0,0 +1,294 @@ +# JSXE English properties file +# $Id$ +# Maintained by Ian Lewis +#:mode=properties: +#:tabSize=4:indentSize=4:noTabs=true: +#:folding=explicit:collapseFolds=1: + +#{{{ common properties + +common.ok=OK +common.cancel=Cancel +common.open=Open +common.save=Save +common.save.as=Save As +common.close=Close +common.apply=Apply +common.more=More +common.insert=Insert +common.add=Add +common.remove=Remove +common.moveUp=Move Up +common.moveDown=Move Down +common.cut=Cut +common.copy=Copy +common.paste=Paste +common.find=Find +common.findnext=Find Next + +common.ctrl=Ctrl +common.alt=Alt +common.shift=Shift +common.meta=Meta + +#}}} + +#{{{ XML Terminology + +#{{{ XML Node Types +xml.element=Element +xml.processing.instruction=Processing Instruction +xml.cdata=CDATA Section +xml.text=Text +xml.entity.reference=Entity Reference +xml.declaration=Element Declaration +xml.notation=Notation +xml.entity=Entity Declaration +xml.comment=Comment +xml.attribute=Attribute +xml.doctype=Document Type +#}}} + +xml.attribute.value.short=Value +xml.attribute.value=Attribute Value +xml.document=XML Document +xml.namespace=Namespace +xml.namespace.prefix=Namespace Prefix +xml.namespace.prefix.short=Prefix +xml.namespace.decl=Namespace Declaration +xml.doctypedef=Document Type Definition +xml.doctype.name=Name +xml.doctype.public=Public Id +xml.doctype.system=System Id +xml.schema=XML Schema +#}}} + +#{{{ Global Options +Global.Options.Dialog.Title=Global Options +Global.Options.Title=General +Global.Options.Max.Recent.Files=Recent files to remember: +Global.Options.Max.Recent.Files.ToolTip=The maximum number of files that jsXe remembers in the recent files menu. +Global.Options.network-off=Always cache without asking +Global.Options.network-cache=Ask first, then cache remote files +Global.Options.network-always=Always download without asking +Global.Options.network=DTD and schema downloading: +Global.Options.Menu.Spill.Over=Number of items before menus spill over + +Shortcuts.Options.Title=Shortcuts +Shortcuts.Options.Select.Label=Edit Shortcuts: +Shortcuts.Options.Shortcut=Shortcut +Shortcuts.Options.Command=Command + +Grab.Key.title=Specify Shortcut +Grab.Key.caption=Press the desired shortcut for "{0}", then click OK. +Grab.Key.keyboard-test=Input the key strokes that are causing problems. +Grab.Key.assigned-to=Currently assigned to: {0} +Grab.Key.assigned-to.none=<none> +Grab.Key.clear=Clear +Grab.Key.remove=Remove Current + +Grab.Key.remove-ask.title=Remove Shortcut? +Grab.Key.remove-ask.message=\ + You didn't specify a new shortcut.\n\ + Do you want to remove the current shortcut? + +Grab.Key.duplicate-alt-shortcut.title=Duplicate Shortcut +Grab.Key.duplicate-alt-shortcut.message=\ + The shortcut you selected duplicates the other\n\ + shortcut for this item. Please choose another. + +Grab.Key.duplicate-shortcut.title=Duplicate Shortcut +Grab.Key.duplicate-shortcut.message=\ + This shortcut is already assigned to\n\ + "{0}".\n\ + \n\ + Do you want to override this assignment? +#}}} + +#{{{ Document Options +Document.Options.Title=XML Document Options +Document.Options.Message=This dialog changes settings for the current\n document only. To change settings on an\n editor-wide basis, see the\n Tools->Global Options dialog box. +Document.Options.Line.Separator=Line Separator: +Document.Options.Line.Separator.ToolTip=The line separator. Usually you'll pick the line separator used by your operating system. +Document.Options.Encoding=Encoding: +Document.Options.Encoding.ToolTip=The encoding that jsXe uses to write the file. +Document.Options.Indent.Width=Indent width: +Document.Options.Indent.Width.ToolTip=The width used when formatting and displaying tab characters. +Document.Options.Format.XML=Format XML output +Document.Options.Format.XML.ToolTip=If this box is checked then XML will be formatted automatically. +Document.Options.Validate=Validate if DTD or Schema Available +Document.Options.Validate.ToolTip=If this box is checked jsXe will validate the XML document. +Document.Options.Soft.Tabs=Soft tabs (emulated with spaces) +Document.Options.Soft.Tabs.ToolTip=If this box is checked then tab characters are replaced by spaces. +#}}} + +#{{{ Plugin Manager +Plugin.Manager.Title=Plugin Manager +Plugin.Manager.Name.Column.Header=Name +Plugin.Manager.Version.Column.Header=Version +Plugin.Manager.Status.Column.Header=Status +Plugin.Manager.Loaded.Status=Loaded +Plugin.Manager.Not.Loaded.Status=Not Loaded +Plugin.Manager.Broken.Status=Error +#}}} + +#{{{ Menu Items + +File.Menu=File +Edit.Menu=Edit +View.Menu=View +Tools.Menu=Tools +Help.Menu=Help + + +#}}} + +#{{{ Action Labels +new-file.label=New +open-file.label=Open... +File.Recent=Recent Files +File.Recent.None=No Recent Files +save-file.label=Save +save-as.label=Save As... +reload-file.label=Reload +File.Recent=Recent Files +close-file.label=Close +close-all.label=Close All +exit.label=Exit + +find.label=Find... +findnext.lab... [truncated message content] |
From: <ian...@us...> - 2006-08-07 19:50:59
|
Revision: 1107 Author: ian_lewis Date: 2006-08-07 12:50:51 -0700 (Mon, 07 Aug 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1107&view=rev Log Message: ----------- Removed the get and setStringProperty methods since they aren't needed Modified Paths: -------------- branches/jsxe2/Changelog branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java Modified: branches/jsxe2/Changelog =================================================================== --- branches/jsxe2/Changelog 2006-08-05 21:41:13 UTC (rev 1106) +++ branches/jsxe2/Changelog 2006-08-07 19:50:51 UTC (rev 1107) @@ -1,3 +1,8 @@ +08/07/2006 Ian Lewis <Ian...@me...> + + * Removed get/setStringProperty methods from XMLDocument since they aren't + needed + 08/03/2006 Ian Lewis <Ian...@me...> * More porting of jEdit's VFS classes to jsXe Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java 2006-08-05 21:41:13 UTC (rev 1106) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java 2006-08-07 19:50:51 UTC (rev 1107) @@ -375,30 +375,6 @@ } }//}}} - //{{{ getStringProperty() method - /** - * Returns the value of a string property. This method is thread-safe. - * @param name The property name - */ - public String getStringProperty(String name) { - Object obj = getProperty(name); - if (obj != null) { - return obj.toString(); - } else { - return null; - } - } //}}} - - //{{{ setStringProperty() method - /** - * Sets a string property. - * @param name The property name - * @param value The value - */ - public void setStringProperty(String name, String value) { - setProperty(name,value); - } //}}} - //{{{ getBooleanProperty() method /** * Returns the value of a boolean property. This method is thread-safe. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ian...@us...> - 2006-08-27 20:09:22
|
Revision: 1174 Author: ian_lewis Date: 2006-08-27 13:09:13 -0700 (Sun, 27 Aug 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1174&view=rev Log Message: ----------- Added a PropertyChangeEvent class for when properties change in the XMLDocument Modified Paths: -------------- branches/jsxe2/build.xml branches/jsxe2/src/net/sourceforge/jsxe/dom2/event/XMLDocumentEvent.java branches/jsxe2/src/net/sourceforge/jsxe/dom2/event/XMLDocumentListener.java Added Paths: ----------- branches/jsxe2/src/net/sourceforge/jsxe/dom2/event/PropertyChangeEvent.java Modified: branches/jsxe2/build.xml =================================================================== --- branches/jsxe2/build.xml 2006-08-27 18:55:21 UTC (rev 1173) +++ branches/jsxe2/build.xml 2006-08-27 20:09:13 UTC (rev 1174) @@ -141,8 +141,8 @@ <include name="**/*.png"/> <!-- files in the source directory to ignore --> - <exclude name="net/sourceforge/jsxe/dom2/**/*"/> - <exclude name="net/sourceforge/jsxe/io/**/*"/> + <!--<exclude name="net/sourceforge/jsxe/dom2/**/*"/> + <exclude name="net/sourceforge/jsxe/io/**/*"/>--> </fileset> </copy> <mkdir dir="${build.plugin}"/> Added: branches/jsxe2/src/net/sourceforge/jsxe/dom2/event/PropertyChangeEvent.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/event/PropertyChangeEvent.java (rev 0) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/event/PropertyChangeEvent.java 2006-08-27 20:09:13 UTC (rev 1174) @@ -0,0 +1,88 @@ +/* +PropertyChangedEvent.java +:tabSize=4:indentSize=4:noTabs=true: +:folding=explicit:collapseFolds=1: + +Copyright (C) 2006 Ian Lewis (Ian...@me...) + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version.e + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +Optionally, you may find a copy of the GNU General Public License +from http://www.fsf.org/copyleft/gpl.txt +*/ + +package net.sourceforge.jsxe.dom2.event; + +import net.sourceforge.jsxe.dom2.*; +import java.util.EventObject; + +/** + * PropertyChangedEvents occur when a property in the XMLDocument is changed. + * + * @author Ian Lewis (<a href="mailto:Ian...@me...">Ian...@me...</a>) + * @version $Id$ + * @see XMLDocument + * @since jsXe XX.XX + */ +public class PropertyChangeEvent extends EventObject { + + private XMLDocument m_document; + private String m_oldValue; + private String m_newValue; + private String m_key; + + //{{{ PropertyChangeEvent constructor + /** + * Creates a new PropertyChangeEvent. + */ + public PropertyChangeEvent(XMLDocument doc, String name, String oldValue, String newValue) { + super(doc); + m_key = name; + m_oldValue = oldValue; + m_newValue = newValue; + }//}}} + + //{{{ getDocument() + /** + * Gets the document that was updated. + */ + public XMLDocument getDocument() { + return (XMLDocument)getSource(); + }//}}} + + //{{{ getOldValue() + /** + * Gets the old value of the property. + */ + public String getOldValue() { + return m_oldValue; + }//}}} + + //{{{ getNewValue() + /** + * Gets the new value of the property. + */ + public String getNewValue() { + return m_newValue; + }//}}} + + //{{{ getName() + /** + * Gets the name of the property that was changed. + */ + public String getName() { + return m_key; + }//}}} + +} \ No newline at end of file Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom2/event/XMLDocumentEvent.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/event/XMLDocumentEvent.java 2006-08-27 18:55:21 UTC (rev 1173) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/event/XMLDocumentEvent.java 2006-08-27 20:09:13 UTC (rev 1174) @@ -34,7 +34,7 @@ * @author Ian Lewis (<a href="mailto:Ian...@me...">Ian...@me...</a>) * @version $Id$ * @see XMLDocument - * @since jsXe 0.5 pre3 + * @since jsXe XX.XX */ public class XMLDocumentEvent extends EventObject { Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom2/event/XMLDocumentListener.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/event/XMLDocumentListener.java 2006-08-27 18:55:21 UTC (rev 1173) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/event/XMLDocumentListener.java 2006-08-27 20:09:13 UTC (rev 1174) @@ -27,9 +27,19 @@ import net.sourceforge.jsxe.dom2.*; import java.util.EventListener; +/** + * An XMLDocumentListener listens for changes to an XMLDocument. Components + * that need to recieve notification when the document changes should implement + * this interface. + * + * @author Ian Lewis (<a href="mailto:Ian...@me...">Ian...@me...</a>) + * @version $Id$ + * @see XMLDocument + * @since jsXe XX.XX + */ public interface XMLDocumentListener extends EventListener { - public void propertyChanged(PropertyChangedEvent event); + public void propertyChanged(PropertyChangeEvent event); public void insertUpdate(XMLDocumentEvent event); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ian...@us...> - 2006-09-06 23:22:20
|
Revision: 1242 http://svn.sourceforge.net/jsxe/?rev=1242&view=rev Author: ian_lewis Date: 2006-09-06 16:22:12 -0700 (Wed, 06 Sep 2006) Log Message: ----------- Made XMLDocument thread safe Modified Paths: -------------- branches/jsxe2/Changelog branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLDocument.java branches/jsxe2/src/net/sourceforge/jsxe/util/ReadWriteLock.java Modified: branches/jsxe2/Changelog =================================================================== --- branches/jsxe2/Changelog 2006-09-06 19:34:32 UTC (rev 1241) +++ branches/jsxe2/Changelog 2006-09-06 23:22:12 UTC (rev 1242) @@ -1,3 +1,9 @@ +09/06/2006 Ian Lewis <Ian...@me...> + + * Added threading support to XMLDocument. Multi-threaded support is not + complete yet however. Currently jsXe only runs in the AWT thread. + * AdapterNode now uses the DOM3 renameNode() method to rename element nodes. + 08/31/2006 Ian Lewis <Ian...@me...> * Added new ContextSpecificActions to replace ViewSpecificActions. Now Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLDocument.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLDocument.java 2006-09-06 19:34:32 UTC (rev 1241) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLDocument.java 2006-09-06 23:22:12 UTC (rev 1242) @@ -33,6 +33,7 @@ import net.sourceforge.jsxe.msg.UndoEvent; import net.sourceforge.jsxe.util.Log; import net.sourceforge.jsxe.util.MiscUtilities; +import net.sourceforge.jsxe.util.ReadWriteLock; import net.sourceforge.jsxe.dom.completion.*; import net.sourceforge.jsxe.dom.undo.*; import net.sourceforge.jsxe.dom.ls.*; @@ -340,54 +341,63 @@ * @return the old value of the property */ public String setProperty(String key, String value) { - String oldValue = getProperty(key); - if (oldValue == null || !oldValue.equals(value)) { - // do this first so NullPointerExceptions are thrown - oldValue = (String)props.setProperty(key, value); + synchronized(propertyLock) { + String oldValue = getProperty(key); - if (key.equals(ENCODING)) { - m_syncedWithContent = false; - } - if (key.equals(FORMAT_XML)) { - m_syncedWithContent = false; - if (Boolean.valueOf(value).booleanValue()) { - setProperty(WS_IN_ELEMENT_CONTENT, "false"); + if (oldValue == null || !oldValue.equals(value)) { + // do this first so NullPointerExceptions are thrown + oldValue = (String)props.setProperty(key, value); + + if (key.equals(ENCODING)) { + m_syncedWithContent = false; } - } - if (key.equals(WS_IN_ELEMENT_CONTENT)) { - m_syncedWithContent = false; - if (Boolean.valueOf(value).booleanValue()) { - setProperty(FORMAT_XML, "false"); + if (key.equals(FORMAT_XML)) { + m_syncedWithContent = false; + if (Boolean.valueOf(value).booleanValue()) { + setProperty(WS_IN_ELEMENT_CONTENT, "false"); + } } - } - if (key.equals(IS_USING_SOFT_TABS)) { - m_syncedWithContent = false; - } - if (key.equals(IS_VALIDATING)) { - //This is ugly. Need to rethink how this should happen. - if (Boolean.valueOf(value).booleanValue()) { - //syncContentWithDOM could change m_parsedMode - syncContentWithDOM(); - } else { - /* - If we are turning off validation then just clear the errors list. - No need to reparse or serialize. - */ - m_parseErrors = new ArrayList(); - m_parseFatalErrors = new ArrayList(); + if (key.equals(WS_IN_ELEMENT_CONTENT)) { + m_syncedWithContent = false; + if (Boolean.valueOf(value).booleanValue()) { + setProperty(FORMAT_XML, "false"); + } } - } - if (key.equals(INDENT)) { - if (MiscUtilities.isTrue(getProperty(FORMAT_XML)) - && MiscUtilities.isTrue(getProperty(IS_USING_SOFT_TABS))) - { + if (key.equals(IS_USING_SOFT_TABS)) { m_syncedWithContent = false; } + if (key.equals(IS_VALIDATING)) { + //This is ugly. Need to rethink how this should happen. + if (Boolean.valueOf(value).booleanValue()) { + //syncContentWithDOM could change m_parsedMode + try { + writeLock(); + + syncContentWithDOM(); + } finally { + writeUnlock(); + } + } else { + /* + If we are turning off validation then just clear the errors list. + No need to reparse or serialize. + */ + m_parseErrors = new ArrayList(); + m_parseFatalErrors = new ArrayList(); + } + } + if (key.equals(INDENT)) { + if (MiscUtilities.isTrue(getProperty(FORMAT_XML)) + && MiscUtilities.isTrue(getProperty(IS_USING_SOFT_TABS))) + { + m_syncedWithContent = false; + } + } + firePropertyChanged(key, oldValue); } - firePropertyChanged(key, oldValue); + return oldValue; } - return oldValue; }//}}} //{{{ getBooleanProperty() method @@ -461,14 +471,21 @@ */ public String getText(int start, int length) throws IOException { - if (start < 0 || length < 0 || start + length > m_content.getLength()) { - throw new ArrayIndexOutOfBoundsException(start + ":" + length); + try { + + writeLock(); + + if (start < 0 || length < 0 || start + length > m_content.getLength()) { + throw new ArrayIndexOutOfBoundsException(start + ":" + length); + } + + //if the document is well formed we go by the DOM + //if it's not we go by the source text. + syncContentWithDOM(); + return m_content.getText(start,length); + } finally { + writeUnlock(); } - - //if the document is well formed we go by the DOM - //if it's not we go by the source text. - syncContentWithDOM(); - return m_content.getText(start,length); }//}}} //{{{ getSegment() @@ -482,19 +499,25 @@ * @return the segment representing the text requested */ public Segment getSegment(int start, int length) throws IOException { - - if (start < 0 || length < 0 || start + length > m_content.getLength()) { - throw new ArrayIndexOutOfBoundsException(start + ":" + length); + try { + + writeLock(); + + if (start < 0 || length < 0 || start + length > m_content.getLength()) { + throw new ArrayIndexOutOfBoundsException(start + ":" + length); + } + + //if the document is well formed we go by the DOM + //if it's not we go by the source text. + if (m_parsedMode) { + syncContentWithDOM(); + } + Segment seg = new Segment(); + m_content.getText(start, length, seg); + return seg; + } finally { + writeUnlock(); } - - //if the document is well formed we go by the DOM - //if it's not we go by the source text. - if (m_parsedMode) { - syncContentWithDOM(); - } - Segment seg = new Segment(); - m_content.getText(start, length, seg); - return seg; }//}}} //{{{ getLength() @@ -503,10 +526,17 @@ * @return the length of the document */ public int getLength() { - - syncContentWithDOM(); - - return m_content.getLength(); + try { + writeLock(); + + syncContentWithDOM(); + + // no need to lock since this just returns a value and that's it + return m_content.getLength(); + } finally { + Log.log(Log.DEBUG, this, "writeUnlock()"); + writeUnlock(); + } }//}}} //{{{ insertText() @@ -517,16 +547,27 @@ * @throws IOException if the text could not be inserted */ public void insertText(int offset, String text) throws IOException { - if (text.length() > 0) { - Log.log(Log.DEBUG, this, "insertText: "+offset+": "+text); - syncContentWithDOM(); - m_content.insert(offset, text); - m_parsedMode = false; - m_adapterNode = null; - if (!getFlag(UNDO_IN_PROGRESS)) { - addUndoableEdit(new InsertEdit(this, offset, text)); + + try { + writeLock(); + + if (offset < 0 || offset > m_content.getLength()) { + throw new ArrayIndexOutOfBoundsException(offset); } - fireStructureChanged(null); + + if (text.length() > 0) { + // Log.log(Log.DEBUG, this, "insertText: "+offset+": "+text); + syncContentWithDOM(); + m_content.insert(offset, text); + m_parsedMode = false; + m_adapterNode = null; + if (!getFlag(UNDO_IN_PROGRESS)) { + addUndoableEdit(new InsertEdit(this, offset, text)); + } + fireStructureChanged(null); + } + } finally { + writeUnlock(); } }//}}} @@ -538,21 +579,35 @@ * @throws IOException if the text could not be removed */ public void removeText(int offset, int length) throws IOException { - if (length > 0) { - String text = getText(offset,length); - Log.log(Log.DEBUG, this, "removeText: "+offset+": "+text); - m_content.remove(offset, length); - m_parsedMode = false; - m_adapterNode = null; - if (!getFlag(UNDO_IN_PROGRESS)) { - addUndoableEdit(new RemoveEdit(this, offset, text)); + + try { + + writeLock(); + + if (offset < 0 || length < 0 || offset + length > m_content.getLength()) { + throw new ArrayIndexOutOfBoundsException(offset + ":" + length); } - fireStructureChanged(null); + + if (length > 0) { + String text = getText(offset,length); + Log.log(Log.DEBUG, this, "removeText: "+offset+": "+text); + m_content.remove(offset, length); + m_parsedMode = false; + m_adapterNode = null; + if (!getFlag(UNDO_IN_PROGRESS)) { + addUndoableEdit(new RemoveEdit(this, offset, text)); + } + fireStructureChanged(null); + } + } finally { + writeUnlock(); } }//}}} //}}} + //{{{ XML Document Methods + //{{{ checkWellFormedness() /** * Checks the wellformedness of the document and throws appropriate @@ -564,14 +619,18 @@ * @throws IOException if there was a problem reading the document */ public boolean checkWellFormedness() throws SAXParseException, SAXException, ParserConfigurationException, IOException { - if (!m_parsedMode) { - parseDocument(); - m_adapterNode = new AdapterNode(this, m_document); - // m_adapterNode.addAdapterNodeListener(docAdapterListener); - // m_syncedWithContent = true; - m_parsedMode=true; + try { + readLock(); + + if (!m_parsedMode) { + parseDocument(); + m_adapterNode = new AdapterNode(this, m_document); + m_parsedMode=true; + } + return m_parsedMode; + } finally { + readUnlock(); } - return m_parsedMode; }//}}} //{{{ getDocType() @@ -700,9 +759,14 @@ * @since jsXe 0.4 pre3 */ public List getErrors() { - syncContentWithDOM(); - parseWithoutUpdate(); - return m_parseErrors; + try { + writeLock(); + syncContentWithDOM(); + parseWithoutUpdate(); + return m_parseErrors; + } finally { + writeUnlock(); + } }//}}} //{{{ isWellFormed() @@ -735,16 +799,21 @@ */ public boolean isValid() throws IOException { if (Boolean.valueOf(getProperty(IS_VALIDATING)).booleanValue()) { - /* - This needs to be done every time we check for validity even - if this document hasn't changed since the DTD or Schema document - we are validating against may have changed in the meantime. - */ - - syncContentWithDOM(); - parseWithoutUpdate(); - - return (m_parseErrors.size() == 0 && m_parseFatalErrors.size() == 0); + try { + writeLock(); + /* + This needs to be done every time we check for validity even + if this document hasn't changed since the DTD or Schema document + we are validating against may have changed in the meantime. + */ + + syncContentWithDOM(); + parseWithoutUpdate(); + + return (m_parseErrors.size() == 0 && m_parseFatalErrors.size() == 0); + } finally { + writeUnlock(); + } } else { return false; } @@ -813,6 +882,20 @@ return getNoNamespaceCompletionInfo().getEntities(); }//}}} + //{{{ setEntityResolver() + /** + * Sets the EntityResolver object that is used when resolving external + * entities. + * @param resolver the entity resolver + */ + public void setEntityResolver(EntityResolver resolver) { + m_entityResolver = resolver; + }//}}} + + //}}} + + //{{{ I/O Methods + //{{{ serialize() /** * Writes the XML document to the output stream specified. @@ -823,79 +906,86 @@ */ public void serialize(OutputStream out) throws IOException, UnsupportedEncodingException { - boolean parsedBeforeSerialization = m_parsedMode; - - String newLine = getProperty(LINE_SEPARATOR); - - syncContentWithDOM(); - - String encoding = getProperty(ENCODING); - if (encoding.equals(MiscUtilities.UTF_8_Y)) { - // not supported by Java... - out.write(UTF8_MAGIC_1); - out.write(UTF8_MAGIC_2); - out.write(UTF8_MAGIC_3); - out.flush(); - encoding = "UTF-8"; - } - - //now just write out the text. - int length = m_content.getLength(); - int index = 0; - BufferedWriter outbuf = new BufferedWriter(new OutputStreamWriter(out, encoding), IO_BUFFER_SIZE); - Segment seg = new Segment(); - - while (index < length) { - int size = WRITE_SIZE; - try { - size = Math.min(length - index, WRITE_SIZE); - } catch(NumberFormatException nf) { - Log.log(Log.ERROR, this, nf); + try { + + writeLock(); + + boolean parsedBeforeSerialization = m_parsedMode; + + String newLine = getProperty(LINE_SEPARATOR); + + syncContentWithDOM(); + + String encoding = getProperty(ENCODING); + if (encoding.equals(MiscUtilities.UTF_8_Y)) { + // not supported by Java... + out.write(UTF8_MAGIC_1); + out.write(UTF8_MAGIC_2); + out.write(UTF8_MAGIC_3); + out.flush(); + encoding = "UTF-8"; } - // out.write(m_content.getText(index, size).getBytes(getProperty(ENCODING)), index, size); - m_content.getText(index, size, seg); + //now just write out the text. + int length = m_content.getLength(); + int index = 0; + BufferedWriter outbuf = new BufferedWriter(new OutputStreamWriter(out, encoding), IO_BUFFER_SIZE); + Segment seg = new Segment(); - int startOffset = seg.offset; - int endOffset = size + seg.offset; - - for (int i=startOffset; i<endOffset; i++) { - if (seg.array[i]=='\n') { - outbuf.write(seg.array, seg.offset, i - seg.offset); - outbuf.write(newLine.toCharArray(), 0, newLine.length()); - - //add 1 because of \n character, - seg.count -= i-seg.offset+1; - seg.offset += i-seg.offset+1; + while (index < length) { + int size = WRITE_SIZE; + try { + size = Math.min(length - index, WRITE_SIZE); + } catch(NumberFormatException nf) { + Log.log(Log.ERROR, this, nf); } + + // out.write(m_content.getText(index, size).getBytes(getProperty(ENCODING)), index, size); + m_content.getText(index, size, seg); + + int startOffset = seg.offset; + int endOffset = size + seg.offset; + + for (int i=startOffset; i<endOffset; i++) { + if (seg.array[i]=='\n') { + outbuf.write(seg.array, seg.offset, i - seg.offset); + outbuf.write(newLine.toCharArray(), 0, newLine.length()); + + //add 1 because of \n character, + seg.count -= i-seg.offset+1; + seg.offset += i-seg.offset+1; + } + } + + //write the rest + outbuf.write(seg.array, seg.offset, seg.count); + index += size; } - //write the rest - outbuf.write(seg.array, seg.offset, seg.count); - index += size; - } - - outbuf.close(); - - //if something changed in the structure while serializing - //basically we don't want serialize() to cause the XMLDocument - //to go from parsed mode to non-parsed mode - if (!m_parsedMode && parsedBeforeSerialization) { - try { - checkWellFormedness(); - } catch (SAXException saxe) { - throw new IOException(saxe.getMessage()); - } catch (ParserConfigurationException pce) { - throw new IOException(pce.getMessage()); - } finally { - /* - if there is an error parsing we want to be in parsed mode - using the old DOM before serializing. - if there is no error, we want to be in parsed mode with the - new DOM. - */ - m_parsedMode = true; + outbuf.close(); + + //if something changed in the structure while serializing + //basically we don't want serialize() to cause the XMLDocument + //to go from parsed mode to non-parsed mode + if (!m_parsedMode && parsedBeforeSerialization) { + try { + checkWellFormedness(); + } catch (SAXException saxe) { + throw new IOException(saxe.getMessage()); + } catch (ParserConfigurationException pce) { + throw new IOException(pce.getMessage()); + } finally { + /* + if there is an error parsing we want to be in parsed mode + using the old DOM before serializing. + if there is no error, we want to be in parsed mode with the + new DOM. + */ + m_parsedMode = true; + } } + } finally { + writeUnlock(); } }//}}} @@ -916,36 +1006,6 @@ return value; }//}}} - //{{{ setEntityResolver() - /** - * Sets the EntityResolver object that is used when resolving external - * entities. - * @param resolver the entity resolver - */ - public void setEntityResolver(EntityResolver resolver) { - m_entityResolver = resolver; - }//}}} - - //{{{ setURI() - /** - * Sets the URI for the location of this document. - * @param uri the uri specifying the location of this document. Can be null. - * @since jsXe 0.4 pre4 - */ - public void setURI(URI uri) { - m_uri = uri; - }//}}} - - //{{{ getURI() - /** - * Gets the URI for the location of this document. - * @return the uri specifying the location of this document. Can be null. - * @since jsXe 0.4 pre4 - */ - public URI getURI() { - return m_uri; - }//}}} - //{{{ setModel() /** * Sets up the XMLDocument given a Reader. The existing content is @@ -1115,6 +1175,68 @@ // } }//}}} + //}}} + + //{{{ Thread safety + + //{{{ readLock() method + /** + * The buffer is guaranteed not to change between calls to + * {@link #readLock()} and {@link #readUnlock()}. + */ + public void readLock() { + lock.readLock(); + } //}}} + + //{{{ readUnlock() method + /** + * The buffer is guaranteed not to change between calls to + * {@link #readLock()} and {@link #readUnlock()}. + */ + public void readUnlock() { + lock.readUnlock(); + } //}}} + + //{{{ writeLock() method + /** + * Attempting to obtain read lock will block between calls to + * {@link #writeLock()} and {@link #writeUnlock()}. + */ + public void writeLock() { + lock.writeLock(); + } //}}} + + //{{{ writeUnlock() method + /** + * Attempting to obtain read lock will block between calls to + * {@link #writeLock()} and {@link #writeUnlock()}. + */ + public void writeUnlock() { + lock.writeUnlock(); + } //}}} + + //}}} + + //{{{ setURI() + /** + * Sets the URI for the location of this document. + * @param uri the uri specifying the location of this document. Can be null. + * @since jsXe 0.4 pre4 + */ + public void setURI(URI uri) { + m_uri = uri; + }//}}} + + //{{{ getURI() + /** + * Gets the URI for the location of this document. + * @return the uri specifying the location of this document. Can be null. + * @since jsXe 0.4 pre4 + */ + public URI getURI() { + return m_uri; + }//}}} + //{{{ addXMLDocumentListener() /** * Registers a change listener with the XMLDocument @@ -1222,11 +1344,13 @@ //{{{ syncContentWithDOM() /** * Write the DOM to the content manager given the current serialization and - * formatting options. + * formatting options. This method is not thread safe. You should call + * writeLock() before and writeUnlock() after calling this method. */ private void syncContentWithDOM() { if (m_parsedMode) { if (!m_syncedWithContent) { + try { Log.log(Log.MESSAGE, this, "Serializing document"); //since we are in parsed mode let's serialize to the content @@ -1256,6 +1380,9 @@ m_parsedMode = false; try { + + readLock(); + parseDocument(); //Why was this set to false? why would we want to //serialize the document again since nothing's changed? @@ -1267,6 +1394,8 @@ } catch (Exception e) { //If an error occurs then we're in trouble jsXe.exiterror(this, e, 1); + } finally { + readUnlock(); } fireStructureChanged(null); } @@ -1302,7 +1431,8 @@ //{{{ parseDocument() /** * Parses the document with the current options. After this is called - * m_adapterNode and m_parsedMode must be updated. + * m_adapterNode and m_parsedMode must be updated. The document text content + * should be up to date compared to the document structure. * @since jsXe 0.4 pre1 */ public void parseDocument() throws SAXParseException, SAXException, ParserConfigurationException, IOException { @@ -1330,9 +1460,7 @@ builder.setEntityResolver(m_entityResolver); } - //Temporary fix to allow parsing of documnts with multi-byte characters - // Document doc = builder.parse(new ContentManagerInputStream(m_content)); - String text = getText(0, getLength()); + String text = m_content.getText(0,m_content.getLength()); Document doc = builder.parse(new InputSource(new StringReader(text))); doc.getDocumentElement().normalize(); //}}} @@ -1352,7 +1480,8 @@ //{{{ parseWithoutUpdate() /** * Parses the document without updating the DOM. This method does, however, - * update completion info and parse errors. + * update completion info and parse errors. The document text content should + * be up to date compared to the document structure. */ public void parseWithoutUpdate() { Log.log(Log.MESSAGE, this, (m_uri != null ? "Validating Document: "+m_uri.toString() : "Validating Document")); @@ -1387,7 +1516,7 @@ try { //Temporary fix to allow parsing of documnts with multi-byte characters // reader.parse(new InputSource(new ContentManagerInputStream(m_content))); - String text = getText(0, getLength()); + String text = m_content.getText(0,m_content.getLength()); reader.parse(new InputSource(new StringReader(text))); } catch(SAXException se) { //validation errors @@ -2092,6 +2221,12 @@ private boolean m_addedToCompoundEdits = false; private int m_compoundEditCount = 0; + /** + * I/O lock. + */ + private ReadWriteLock lock = new ReadWriteLock(); + private Object propertyLock = new Object(); + // private XMLDocAdapterListener docAdapterListener = new XMLDocAdapterListener(); //}}} Modified: branches/jsxe2/src/net/sourceforge/jsxe/util/ReadWriteLock.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/util/ReadWriteLock.java 2006-09-06 19:34:32 UTC (rev 1241) +++ branches/jsxe2/src/net/sourceforge/jsxe/util/ReadWriteLock.java 2006-09-06 23:22:12 UTC (rev 1242) @@ -56,28 +56,22 @@ * write unlock * write unlock */ -public class ReadWriteLock -{ +public class ReadWriteLock { + //{{{ readLock() method - public synchronized void readLock() - { + public synchronized void readLock() { // this seems to make nested readLock() calls work okay. // but I have no idea if it actually fixes things or not. - if (activeReaders != 0 || allowRead()) - { - ++activeReaders; - //readers.addElement(Thread.currentThread()); - return; + if (activeReaders != 0 || allowRead()) { + // ++activeReaders; + // //readers.addElement(Thread.currentThread()); + // return; } ++waitingReaders; - while (!allowRead()) - { - try - { + while (!allowRead()) { + try { wait(); - } - catch (InterruptedException e) - { + } catch (InterruptedException e) { --waitingReaders; // Roll back state. Log.log(Log.ERROR,this,e); return; @@ -89,10 +83,11 @@ } //}}} //{{{ readUnlock() method - public synchronized void readUnlock() - { - if(activeReaders == 0) + public synchronized void readUnlock() { + + if (activeReaders == 0) { throw new InternalError("Unbalanced readLock()/readUnlock() calls"); + } --activeReaders; //readers.removeElement(Thread.currentThread()); @@ -100,33 +95,27 @@ } //}}} //{{{ writeLock() method - public synchronized void writeLock() - { - if (writerThread != null) - { + public synchronized void writeLock() { + + if (writerThread != null) { // Write in progress. - if (Thread.currentThread() == writerThread) - { - // Same thread. - ++lockCount; - return; - } + // if (Thread.currentThread() == writerThread) + // { + // // Same thread. + // ++lockCount; + // return; + // } } - if (allowWrite()) - { + if (allowWrite()) { claimWriteLock(); return; } ++waitingWriters; - while (!allowWrite()) - { - try - { + while (!allowWrite()) { + try { wait(); - } - catch (InterruptedException e) - { + } catch (InterruptedException e) { --waitingWriters; Log.log(Log.ERROR,this,e); return; @@ -137,16 +126,17 @@ } //}}} //{{{ writeUnlock() method - public synchronized void writeUnlock() - { - if(activeWriters != 1 || lockCount <= 0) + public synchronized void writeUnlock() { + + if (activeWriters != 1 || lockCount <= 0) { throw new InternalError("Unbalanced writeLock()/writeUnlock() calls"); + } - if(Thread.currentThread() != writerThread) + if (Thread.currentThread() != writerThread) { throw new InternalError("writeUnlock() from wrong thread"); + } - if (--lockCount == 0) - { + if (--lockCount == 0) { --activeWriters; writerThread = null; notifyAll(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ian...@us...> - 2006-07-08 15:58:02
|
Revision: 1002 Author: ian_lewis Date: 2006-07-08 08:57:53 -0700 (Sat, 08 Jul 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1002&view=rev Log Message: ----------- Updated the new data model. Added the new XMLAttribute class Added support for editing attributes to the XMLElement class. Added new DOM support to XMLNode Modified Paths: -------------- branches/jsxe2/Changelog branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLElement.java branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLNode.java Added Paths: ----------- branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLAttribute.java Modified: branches/jsxe2/Changelog =================================================================== --- branches/jsxe2/Changelog 2006-07-08 00:31:35 UTC (rev 1001) +++ branches/jsxe2/Changelog 2006-07-08 15:57:53 UTC (rev 1002) @@ -1,3 +1,11 @@ +06/08/2006 Ian Lewis <Ian...@me...> + + * XMLAttribute was added to the new data model. + * Added support for editing attributes to the XMLElement class. + * Created an new XMLDocument class. + * Made use of the DOM events model to allow users to register DOM event + listeners. + 06/04/2006 Ian Lewis <Ian...@me...> * XMLElement was added to model element nodes Added: branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLAttribute.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLAttribute.java (rev 0) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLAttribute.java 2006-07-08 15:57:53 UTC (rev 1002) @@ -0,0 +1,77 @@ +/* +XMLAttribute.java +:tabSize=4:indentSize=4:noTabs=true: +:folding=explicit:collapseFolds=1: + +Copyright (C) 2006 Ian Lewis (Ian...@me...) + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +Optionally, you may find a copy of the GNU General Public License +from http://www.fsf.org/copyleft/gpl.txt +*/ + +package net.sourceforge.jsxe.dom2; + +//{{{ Imports + +//{{{ Swing classes +import javax.swing.text.*; +//}}} + +//{{{ DOM classes +import org.w3c.dom.*; +import org.w3c.dom.events.*; +//}}} + +//}}} + +/** + * The XMLAttribute class represents an attribute in the XMLDocument tree. It + * does not allow modifications to the attribute itself. This is done through + * the <code>XMLElement</code> class. + * + * @author Ian Lewis (<a href="mailto:Ian...@me...">Ian...@me...</a>) + * @version $Id$ + * @see XMLDocument + * @see XMLElement + * @since jsXe 0.5 pre2 + */ +public class XMLAttribute extends XMLNode { + + //{{{ XMLAttribute constructor + + public XMLAttribute(Attr attribute) { + super(attribute); + }//}}} + + //{{{ getOwnerElement() + + public XMLElement getOwnerElement() { + return (XMLElement)getNode().getUserData(USER_DATA_KEY); + }//}}} + + //{{{ isSpecified() + + public boolean isSpecified() { + return ((Attr)getNode()).getSpecified(); + }//}}} + + //{{{ isId() + + public boolean isId() { + return ((Attr)getNode()).getId(); + }//}}} + +} Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java 2006-07-08 00:31:35 UTC (rev 1001) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java 2006-07-08 15:57:53 UTC (rev 1002) @@ -54,7 +54,7 @@ /** * The XMLDocument class represents an XML document as a tree structure - * that has nodes, implemented as AdapterNodes, as well as text. Methods are + * that has nodes, implemented as XMLNodes, as well as text. Methods are * provided to allow user objects to interact with the XML document as text * or as a tree structure seamlessly. * Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLElement.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLElement.java 2006-07-08 00:31:35 UTC (rev 1001) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLElement.java 2006-07-08 15:57:53 UTC (rev 1002) @@ -58,12 +58,182 @@ }//}}} //{{{ getAttributes() + /** + * Returns a read only set of attributes in this node. The AttributeSet + * maps the attribute name to the attribute's value. + */ + public AttributeSet getAttributes() { + //TODO: create resolving parent for the attributes for default node + // values from a DTD or schema? + + SimpleAttributeSet attrSet = new SimpleAttributeSet(); + NamedNodeMap attributes = getNode().getAttributes(); + + int len = attributes.getLength(); + for (int i=0; i<len; i++) { + Node attr = attributes.item(i); + XMLAttribute xmlAttr = (XMLAttribute)attr.getUserData(USER_DATA_KEY); + attrSet.addAttribute(xmlAttr.getName(), xmlAttr.getValue()); + } + return attrSet; + }//}}} - public AttributeSet getAttributes() { - //TODO: implement attributes + //{{{ getAttributeNodes() + /** + * Returns a read only set of attributes in this node. This List + * contains all the XMLAttributeNode objects for this element. + */ + public List getAttributeNodes() { + ArrayList attrSet = new ArrayList(); + + NamedNodeMap attributes = getNode().getAttributes(); + + int len = attributes.getLength(); + for (int i=0; i<len; i++) { + Node attr = attributes.item(i); + XMLAttribute xmlAttr = (XMLAttribute)attr.getUserData(USER_DATA_KEY); + attrSet.add(xmlAttr); + } + + return attrSet; + }//}}} + + //{{{ getAttribute() + /** + * @param name the qualified name of the attribute + */ + public XMLAttribute getAttribute(String name) { + Element element = (org.w3c.dom.Element)getNode(); + String localName = MiscUtilities.getLocalNameFromQualifiedName(name); + String prefix = MiscUtilities.getNSPrefixFromQualifiedName(name); + + if (prefix != null && !prefix.equals("")) { + Attr attr = element.getAttributeNodeNS(lookupNamespaceURI(prefix),localName); + return (XMLAttribute)attr.getUserData(USER_DATA_KEY); + } else { + Attr attr = element.getAttributeNode(name); + return (XMLAttribute)attr.getUserData(USER_DATA_KEY); + } + }//}}} + + //{{{ setAttribute() + /** + * @param name the qualified name of the attribute + * @param value the value of the attribute + */ + public XMLAttribute setAttribute(String name, String value) throws DOMException { + Element element = (org.w3c.dom.Element)getNode(); + String prefix = MiscUtilities.getNSPrefixFromQualifiedName(name); + Attr newAttr; + + //check if we are setting a namespace declaration + if ("xmlns".equals(prefix)) { + //if so then make sure the value is valid + if (value != null && value.equals("")) { + //TODO: fix messages + throw new DOMException(DOMException.NAMESPACE_ERR, "An attempt was made to create an empty namespace declaration"); + } + } + + if (prefix != null && !prefix.equals("")) { + String uri = lookupNamespaceURI(prefix); + + element.setAttributeNS(uri,name,value); + newAttr = getAttributeNodeNS(uri, name, value); + } else { + /* + setAttribute doesn't throw an error if the first character is + a ":" + */ + if (name != null && !name.equals("") && name.charAt(0)==':') { + //TODO: fix messages + throw new DOMException(DOMException.NAMESPACE_ERR, "An attribute name cannot have a ':' as the first character"); + } + element.setAttribute(name, value); + newAttr = getAttributeNode(name, value); + } + + //create an XMLAttribute node for the new attribute + if (newAttr != null) { + xmlAttr = new XMLAttribute(attr); + attr.setUserData(USER_DATA_KEY, xmlAttr, null); + return xmlAttr; + } return null; }//}}} + //{{{ setAttribute() + + public XMLAttribute setAttribute(XMLAttribute attr) throws DOMException { + /* + TODO: test how this works. Will I need to check for a namespace and + call setAttributeNode() instead if there is none? + */ + ((org.w3c.dom.Element)getNode()).setAttributeNodeNS((Attr)attr.getNode()); + return attr; + }//}}} + + //{{{ removeAttributeAt() + /** + * @param index the index at which to remove an attribute. + */ + public removeAttributeAt(int index) throws DOMException { + Element element = (org.w3c.dom.Element)getNode(); + NamedNodeMap attrs = element.getAttributes(); + if (attrs != null) { + removeAttribute(attrs.item(index).getNodeName()); + } + }//}}} + + //{{{ removeAttribute() + /** + * @param name The qualified name of the attribute. + */ + public XMLAttribute removeAttribute(String name) throws DOMException { + Element element = (org.w3c.dom.Element)getNode(); + + String prefix = MiscUtilities.getNSPrefixFromQualifiedName(name); + String localName = MiscUtilities.getLocalNameFromQualifiedName(name); + + //Check if we are removing a namespace declaration + //This is a somewhat expensive operation, may need to + //optimize somehow in the future + if ("xmlns".equals(prefix)) { + //check if there are nodes using the namespace + String uri = lookupNamespaceURI(localName); + //check this element's namespace + if (!uri.equals(element.getNamespaceURI())) { + //check for decendent elements with this namespace + NodeList list = element.getElementsByTagName("*"); + //check if an attribute with this NS is used + for (int i=0; i<list.getLength(); i++) { + Node ele = list.item(i); + if (uri.equals(ele.getNamespaceURI())) { + //TODO: fix messages + throw new DOMException(DOMException.NAMESPACE_ERR, "An attempt was made to remove a namespace declaration when nodes exist that use it"); + } + //now check the attributes + NamedNodeMap attrs = ele.getAttributes(); + for (int j=0; j<attrs.getLength(); j++) { + Node foundAttr = attrs.item(i); + if (uri.equals(foundAttr.getNamespaceURI())) { + //TODO: fix messages + throw new DOMException(DOMException.NAMESPACE_ERR, "An attempt was made to remove a namespace declaration when nodes exist that use it"); + } + } + } + } else { + throw new DOMException(DOMException.NAMESPACE_ERR, "An attempt was made to remove a namespace declaration when nodes exist that use it"); + } + } + + if (prefix != null && !prefix.equals("")) { + element.removeAttributeNS(lookupNamespaceURI(prefix),localName); + } else { + element.removeAttribute(localName); + } + }//}}} + //{{{ getNodeType() public int getNodeType() { return Node.ELEMENT_NODE; Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLNode.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLNode.java 2006-07-08 00:31:35 UTC (rev 1001) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLNode.java 2006-07-08 15:57:53 UTC (rev 1002) @@ -60,7 +60,7 @@ */ public abstract class XMLNode /* implements javax.swing.text.Element */ { - private static final String USER_DATA_KEY = "net.sourceforge.jsxe.dom.XMLNode"; + static final String USER_DATA_KEY = "net.sourceforge.jsxe.dom.XMLNode"; //{{{ Private members @@ -120,7 +120,11 @@ }//}}} //{{{ getName() - + /** + * Gets the qualified name of the node. This will be the namespace + * prefix + ":" + the locale name. + * @return the qualified name + */ public String getName() { return m_domNode.getNodeName(); }//}}} @@ -158,13 +162,85 @@ }//}}} //{{{ appendNode() - public XMLNode appendChild(XMLNode newChild) { + public XMLNode appendNode(XMLNode newChild) throws DOMException { m_domNode.appendChild(newChild.getNode()); return newChild; }//}}} + //{{{ getBaseURI() + + public String getBaseURI() { + return m_domNode.getBaseURI(); + }//}}} + + //{{{ getNamespaceURI() + + public String getNamespaceURI() { + return m_domNode.getNamespaceURI(); + }//}}} + + //{{{ getNodeType() + + public short getNodeType() { + return m_domNode.getNodeType(); + }//}}} + + //{{{ getValue() + + public String getValue() { + return m_domNode.getNodeValue(); + }//}}} + + //{{{ getNSPrefix() + + public String getNSPrefix() { + return m_domNode.getPrefix(); + }//}}} + + //{{{ insertNode() + + public XMLNode insertNode(XMLNode node, int index) throws DOMException { + m_domNode.insertBefore(node.getNode(), m_domNode.getChildNodes().item(index)); + return node; + }//}}} + + //{{{ lookupNamespaceURI() + + public String lookupNamespaceURI(String prefix) { + return m_domNode.lookupNamespaceURI(prefix); + }//}}} + + //{{{ removeNode() + + public XMLNode removeNode(XMLNode child) throws DOMException { + Node childNode = child.getNode(); + m_domNode.removeChild(childNode); + childNode.setUserData(USER_DATA_KEY, null, null); + return child; + }//}}} + + //{{{ setValue() + + public void setValue(String value) throws DOMException { + m_domNode.setNodeValue(value); + }//}}} + + //{{{ setNSPrefix() + + public void setNSPrefix(String prefix) throws DOMException { + m_domNode.setPrefix(prefix); + }//}}} + + //{{{ setName() + /** + * @param name the qualified name of the node. + */ + public void setName(String name) { + m_domNode = m_domNode.getOwnerDocument().renameNode(m_domNode, m_domNode.getNamespaceURI(), name); + }//}}} + //{{{ Protected Members //{{{ getNode() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ian...@us...> - 2006-07-24 21:24:34
|
Revision: 1063 Author: ian_lewis Date: 2006-07-24 14:24:27 -0700 (Mon, 24 Jul 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1063&view=rev Log Message: ----------- Added support for the URI and standalone properties in the XMLDocument Modified Paths: -------------- branches/jsxe2/Changelog branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java Modified: branches/jsxe2/Changelog =================================================================== --- branches/jsxe2/Changelog 2006-07-24 20:26:42 UTC (rev 1062) +++ branches/jsxe2/Changelog 2006-07-24 21:24:27 UTC (rev 1063) @@ -1,3 +1,10 @@ +07/24/2006 Ian Lewis <Ian...@me...> + + * Added the XMLText, XMLComment, and XMLProcessingInstruction node + types. + * Added some support for the URIs and standalone properties in + XMLDocument. + 07/20/2006 Ian Lewis <Ian...@me...> * Xerces needs to be installed in the java endorsed directory now to make Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java 2006-07-24 20:26:42 UTC (rev 1062) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java 2006-07-24 21:24:27 UTC (rev 1063) @@ -28,6 +28,7 @@ //{{{ jsXe classes import net.sourceforge.jsxe.jsXe; +import net.sourceforge.jsxe.dom2.ls.*; import net.sourceforge.jsxe.util.Log; import net.sourceforge.jsxe.util.MiscUtilities; //}}} @@ -35,14 +36,18 @@ //{{{ DOM classes import org.w3c.dom.*; import org.w3c.dom.events.*; +import org.xml.sax.EntityResolver; //}}} //{{{ Java base classes import java.io.IOException; +import java.io.InputStream; import java.io.Writer; import java.util.ArrayList; +import java.util.Iterator; import java.util.Map; import java.util.HashMap; +import java.net.URI; //}}} //{{{ Swing classes @@ -68,9 +73,99 @@ */ public class XMLDocument /* implements javax.swing.text.Document */ { + //{{{ XMLDocument defined properties + /** + * The property key for the encoding of this XML document + */ + public static final String ENCODING = DOMSerializerConfiguration.XML_ENCODING; + /** + * The property key for the boolean property specifying if whitespace + * is allowed in element content. + */ + public static final String WS_IN_ELEMENT_CONTENT = DOMSerializerConfiguration.WS_IN_ELEMENT_CONTENT; + /** + * The property key for the boolean property specifying that the XML text + * should be formatted to look pleasing to the eye. + */ + public static final String FORMAT_XML = DOMSerializerConfiguration.FORMAT_XML; + /** + * The property key for the property defining the size of a tab when the + * document is displayed as text or otherwise. Used when serializing the + * document using soft-tabs. + */ + public static final String INDENT = DOMSerializerConfiguration.INDENT; + /** + * The property key for the property defining whether to serialize + * using soft tabs (tabs replaced by the number of spaces specified in the + * INDENT property). Has a value of "true" if using soft tabs. + */ + public static final String IS_USING_SOFT_TABS = DOMSerializerConfiguration.SOFT_TABS; + /** + * The property key for the property defining whether to validate the + * document with a DTD or Schema + */ + public static final String IS_VALIDATING = "validating"; + /** + * The property key for the property defining what line separator + * to use when serializing a document. \n is always used for the internal + * text but this line separator is used when serializing using the + * serialize method. + */ + public static final String LINE_SEPARATOR = "line-separator"; + //}}} + //{{{ XMLDocument constructor - XMLDocument() { + /** + * Creates a new XMLDocument for a document that can be read by the given + * Reader. + * @param uri the uri for the location of this document. Can be null. + * @param reader the Reader object to read the XML document from. + * @throws IOException if there was a problem reading the document + */ + public XMLDocument(String uri, InputStream reader) throws IOException { + this(uri, reader, null); + }//}}} + + //{{{ XMLDocument constructor + /** + * Creates a new XMLDocument for a document that can be read by the given + * Reader. + * @param reader the Reader object to read the XML document from. + * @param resolver the EntityResolver to use when resolving external + * entities. + * @throws IOException if there was a problem reading the document + */ + public XMLDocument(String uri, InputStream reader, EntityResolver resolver) throws IOException { + this(uri, reader, resolver, null); + }//}}} + + //{{{ XMLDocument constructor + /** + * Creates a new XMLDocument for a document that can be read by the given + * Reader. + * @param uri the document uri + * @param reader the Reader object to read the XML document from. + * @param resolver the EntityResolver to use when resolving external + * entities. + * @param properties the properties to assign this XMLDocument on creation. + * @throws IOException if there was a problem reading the document + */ + public XMLDocument(String uri, InputStream reader, EntityResolver resolver, Map properties) throws IOException { + m_entityResolver = resolver; + setDefaultProperties(); + setURI(uri); + //add properties one by one + if (properties != null) { + Iterator propertyNames = properties.keySet().iterator(); + while (propertyNames.hasNext()) { + Object key = propertyNames.next(); + setProperty(key, properties.get(key)); + } + } + + //TODO: Read the document from the input stream + reader.close(); }//}}} //{{{ swing.text.Document methods @@ -288,6 +383,42 @@ return m_properties; }//}}} + //{{{ setURI() + /** + * Sets the URI for the location of this document. + * @param uri the uri specifying the location of this document. Can be null. + */ + public void setURI(String uri) { + m_document.setDocumentURI(uri); + }//}}} + + //{{{ getURI() + /** + * Gets the URI for the location of this document. + * @return the uri specifying the location of this document. Can be null. + */ + public String getURI() { + return m_document.getDocumentURI(); + }//}}} + + //{{{ setStandalone() + /** + * An attribute specifying, as part of the XML declaration, whether this + * document is standalone. This is false when unspecified. + */ + public void setStandalone(boolean standalone) throws DOMException { + m_document.setXmlStandalone(standalone); + }//}}} + + //{{{ isStandalone() + /** + * An attribute specifying, as part of the XML declaration, whether this + * document is standalone. This is false when unspecified. + */ + public boolean isStandalone() { + return m_document.getXmlStandalone(); + }//}}} + //{{{ Node Factory methods //{{{ newElementNode() @@ -312,6 +443,16 @@ //{{{ Private members + //{{{ setDefaultProperties() + private void setDefaultProperties() { + setProperty(FORMAT_XML, "false"); + setProperty(IS_USING_SOFT_TABS, "false"); + setProperty(WS_IN_ELEMENT_CONTENT, "true"); + setProperty(ENCODING, "UTF-8"); + setProperty(INDENT, "4"); + setProperty(IS_VALIDATING, "false"); + }//}}} + //{{{ ContentManager class /** * Text content manager based off of jEdit's ContentManager class. @@ -546,6 +687,11 @@ private ArrayList m_docListeners = new ArrayList(); private ArrayList m_undoListeners = new ArrayList(); + /** + * The entity resolver to use when resolving external entities + * in this document. + */ + private EntityResolver m_entityResolver; //}}} } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ian...@us...> - 2006-08-04 19:17:55
|
Revision: 1104 Author: ian_lewis Date: 2006-08-04 12:17:41 -0700 (Fri, 04 Aug 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1104&view=rev Log Message: ----------- More porting of jEdit's VFS to jsXe Modified Paths: -------------- branches/jsxe2/Changelog branches/jsxe2/messages/messages branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java branches/jsxe2/src/net/sourceforge/jsxe/dom2/event/XMLDocumentEvent.java branches/jsxe2/src/net/sourceforge/jsxe/dom2/event/XMLDocumentListener.java branches/jsxe2/src/net/sourceforge/jsxe/dom2/ls/XMLDocumentIORequest.java branches/jsxe2/src/net/sourceforge/jsxe/io/FileRootsVFS.java branches/jsxe2/src/net/sourceforge/jsxe/io/FileVFS.java branches/jsxe2/src/net/sourceforge/jsxe/io/VFS.java branches/jsxe2/src/net/sourceforge/jsxe/io/VFSManager.java branches/jsxe2/src/net/sourceforge/jsxe/properties branches/jsxe2/src/net/sourceforge/jsxe/util/MiscUtilities.java Modified: branches/jsxe2/Changelog =================================================================== --- branches/jsxe2/Changelog 2006-08-03 19:18:36 UTC (rev 1103) +++ branches/jsxe2/Changelog 2006-08-04 19:17:41 UTC (rev 1104) @@ -1,3 +1,7 @@ +08/03/2006 Ian Lewis <Ian...@me...> + + * More porting of jEdit's VFS classes to jsXe + 07/29/2006 Ian Lewis <Ian...@me...> * Added some more code for multi-threaded IO support. Modified: branches/jsxe2/messages/messages =================================================================== --- branches/jsxe2/messages/messages 2006-08-03 19:18:36 UTC (rev 1103) +++ branches/jsxe2/messages/messages 2006-08-04 19:17:41 UTC (rev 1104) @@ -179,6 +179,15 @@ DocumentBuffer.Close.Message={0} unsaved! Save it now? DocumentBuffer.Close.Message.Title=Unsaved Changes +#{{{ I/O status messages +vfs.status.load=Loading {0} +vfs.status.save=Saving {0} +vfs.status.autosave=Autosaving {0} +vfs.status.listing-directory=Listing {0} +vfs.status.deleting=Deleting {0} +vfs.status.renaming=Renaming {0} to {1} +#}}} + #{0} file name DocumentBuffer.Saved.Message={0} Saved DocumentBuffer.Closed.Message={0} Closed @@ -250,6 +259,21 @@ #}}} +#{{{ VFS +vfs.browser.name=Name +vfs.browser.type=Type +vfs.browser.type.file=File +vfs.browser.type.directory=Directory +vfs.browser.type.filesystem=File system +vfs.browser.status=Status +vfs.browser.status.no=No access +vfs.browser.status.ro=Read only +vfs.browser.status.append=Append only +vfs.browser.status.rw=Read/write +vfs.browser.size=Size +vfs.browser.modified=Last modified +#}}} + #{{{ Dialogs #{{{ Download resource dialog Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java 2006-08-03 19:18:36 UTC (rev 1103) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/XMLDocument.java 2006-08-04 19:17:41 UTC (rev 1104) @@ -32,8 +32,13 @@ import net.sourceforge.jsxe.dom2.event.*; import net.sourceforge.jsxe.util.Log; import net.sourceforge.jsxe.util.MiscUtilities; +import net.sourceforge.jsxe.util.ReadWriteLock; //}}} +//{{{ Swing classes +import javax.swing.text.Segment; +//}}} + //{{{ DOM classes import org.w3c.dom.*; import org.w3c.dom.events.*; @@ -44,10 +49,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.Writer; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.Map; -import java.util.HashMap; +import java.util.*; import java.net.URI; //}}} @@ -112,6 +114,8 @@ * serialize method. */ public static final String LINE_SEPARATOR = "line-separator"; + + public static final String ENCODING_AUTODETECT = "encoding.autodetect"; //}}} //{{{ XMLDocument constructor @@ -361,7 +365,7 @@ }//}}} //{{{ setProperty() - public void settProperty(String key, String value) { + public void setProperty(String key, String value) { synchronized(propertyLock) { if (value == null) { m_properties.remove(key); Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom2/event/XMLDocumentEvent.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/event/XMLDocumentEvent.java 2006-08-03 19:18:36 UTC (rev 1103) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/event/XMLDocumentEvent.java 2006-08-04 19:17:41 UTC (rev 1104) @@ -25,6 +25,7 @@ package net.sourceforge.jsxe.dom2.event; import net.sourceforge.jsxe.dom2.*; +import java.util.EventObject; /** * XMLDocumentEvents are modifications to the structure of the XMLDocument. @@ -35,9 +36,8 @@ * @see XMLDocument * @since jsXe 0.5 pre3 */ -public interface XMLDocumentEvent extends EventListener { +public class XMLDocumentEvent extends EventObject { - private XMLDocument m_document; private int m_offset; private int m_length; private short m_type; @@ -51,7 +51,7 @@ * */ public XMLDocumentEvent(XMLDocument doc, int offset, String text, short type) { - m_document = doc; + super(doc); m_type = type; m_length = text.length(); m_offset = offset; @@ -62,7 +62,7 @@ * Gets the document that was updated. */ public XMLDocument getDocument() { - return m_document; + return (XMLDocument)getSource(); }//}}} //{{{ getOffset() Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom2/event/XMLDocumentListener.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/event/XMLDocumentListener.java 2006-08-03 19:18:36 UTC (rev 1103) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/event/XMLDocumentListener.java 2006-08-04 19:17:41 UTC (rev 1104) @@ -25,10 +25,11 @@ package net.sourceforge.jsxe.dom2.event; import net.sourceforge.jsxe.dom2.*; +import java.util.EventListener; public interface XMLDocumentListener extends EventListener { - public void propertyChanged(PropertyChangeEvent event); + public void propertyChanged(PropertyChangedEvent event); public void insertUpdate(XMLDocumentEvent event); Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom2/ls/XMLDocumentIORequest.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/ls/XMLDocumentIORequest.java 2006-08-03 19:18:36 UTC (rev 1103) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/ls/XMLDocumentIORequest.java 2006-08-04 19:17:41 UTC (rev 1104) @@ -32,6 +32,8 @@ import java.util.Vector; import net.sourceforge.jsxe.io.*; import net.sourceforge.jsxe.*; +import net.sourceforge.jsxe.gui.TabbedView; +import net.sourceforge.jsxe.dom2.XMLDocument; import net.sourceforge.jsxe.util.*; //}}} @@ -82,7 +84,7 @@ /** * An insert file request. */ - public static final int INSERT = 3; + // public static final int INSERT = 3; /** * Magic numbers used for auto-detecting Unicode and GZIP files. @@ -136,14 +138,22 @@ case AUTOSAVE: autosave(); break; - case INSERT: - insert(); - break; + // case INSERT: + // insert(); + // break; default: throw new InternalError(); } } //}}} - + + //{{{ getLoadData() + /** + * Gets the data loaded from a load request. + */ + public SegmentBuffer getLoadData() { + return m_loadData; + }//}}} + //{{{ toString() method public String toString() { @@ -175,6 +185,7 @@ private Object session; private VFS vfs; private String path; + private SegmentBuffer m_loadData; //}}} //{{{ load() method @@ -215,7 +226,7 @@ } catch(CharConversionException ch) { Log.log(Log.ERROR,this,ch); - Object[] pp = { buffer.getProperty(Buffer.ENCODING), ch.toString() }; + Object[] pp = { buffer.getProperty(XMLDocument.ENCODING), ch.toString() }; VFSManager.error(view,path,"IO.Error.Encoding.Error",pp); @@ -223,7 +234,7 @@ } catch(UnsupportedEncodingException uu) { Log.log(Log.ERROR,this,uu); - Object[] pp = { buffer.getProperty(Buffer.ENCODING), + Object[] pp = { buffer.getProperty(XMLDocument.ENCODING), uu.toString() }; VFSManager.error(view,path,"IO.Error.Encoding.Error",pp); @@ -274,11 +285,11 @@ private Reader autodetect(InputStream in) throws IOException { in = new BufferedInputStream(in); - String encoding = buffer.getStringProperty(Buffer.ENCODING); + String encoding = buffer.getStringProperty(XMLDocument.ENCODING); if (!in.markSupported()) { Log.log(Log.WARNING,this,"Mark not supported: " + in); } else { - if(buffer.getBooleanProperty(Buffer.ENCODING_AUTODETECT)) { + if(buffer.getBooleanProperty(XMLDocument.ENCODING_AUTODETECT)) { in.mark(XML_PI_LENGTH); int b1 = in.read(); int b2 = in.read(); @@ -300,13 +311,13 @@ encoding = "UTF-8"; } else { - if (b1 == GZIP_MAGIC_1 && b2 == GZIP_MAGIC_2) { - in.reset(); - in = new GZIPInputStream(in); - buffer.setBooleanProperty(Buffer.GZIPPED,true); - // auto-detect encoding within the gzip stream. - return autodetect(in); - } else { + // if (b1 == GZIP_MAGIC_1 && b2 == GZIP_MAGIC_2) { + // in.reset(); + // in = new GZIPInputStream(in); + // buffer.setBooleanProperty(Buffer.GZIPPED,true); + // // auto-detect encoding within the gzip stream. + // return autodetect(in); + // } else { if ((b1 == UNICODE_MAGIC_1 && b2 == UNICODE_MAGIC_2) || (b1 == UNICODE_MAGIC_2 @@ -314,7 +325,7 @@ { in.reset(); encoding = "UTF-16"; - buffer.setProperty(Buffer.ENCODING,encoding); + buffer.setProperty(XMLDocument.ENCODING,encoding); } else { if (b1 == UTF8_MAGIC_1 && b2 == UTF8_MAGIC_2 && b3 == UTF8_MAGIC_3) @@ -358,7 +369,7 @@ in.reset(); } } - } + // } } } } @@ -367,15 +378,14 @@ } //}}} //{{{ read() method - private SegmentBuffer read(Reader in, long length, - boolean insert) throws IOException - { + private SegmentBuffer read(Reader in, long length, boolean insert) throws IOException { + /* we guess an initial size for the array */ - IntegerArray endOffsets = new IntegerArray( - Math.max(1,(int)(length / 50))); + // IntegerArray endOffsets = new IntegerArray( + // Math.max(1,(int)(length / 50))); // only true if the file size is known - boolean trackProgress = (!buffer.isTemporary() && length != 0); + boolean trackProgress = (length != 0); if (trackProgress) { setProgressValue(0); @@ -447,7 +457,7 @@ seg.append(buf,lastLine,i - lastLine); seg.append('\n'); - endOffsets.add(seg.count); + // endOffsets.add(seg.count); if(trackProgress && lineCount++ % PROGRESS_INTERVAL == 0) setProgressValue(seg.count); @@ -485,7 +495,7 @@ seg.append(buf,lastLine, i - lastLine); seg.append('\n'); - endOffsets.add(seg.count); + // endOffsets.add(seg.count); if(trackProgress && lineCount++ % PROGRESS_INTERVAL == 0) setProgressValue(seg.count); lastLine = i + 1; @@ -539,39 +549,36 @@ // Chop trailing newline and/or ^Z (if any) int bufferLength = seg.count; - if(bufferLength != 0) - { + if (bufferLength != 0) { char ch = seg.array[bufferLength - 1]; if(ch == 0x1a /* DOS ^Z */) seg.count--; } - buffer.setBooleanProperty(Buffer.TRAILING_EOL,false); - if(bufferLength != 0 && jEdit.getBooleanProperty("stripTrailingEOL")) - { - char ch = seg.array[bufferLength - 1]; - if(ch == '\n') - { - buffer.setBooleanProperty(Buffer.TRAILING_EOL,true); - seg.count--; - endOffsets.setSize(endOffsets.getSize() - 1); - } - } + // buffer.setBooleanProperty(Buffer.TRAILING_EOL,false); + // if (bufferLength != 0 && jEdit.getBooleanProperty("stripTrailingEOL")) { + // char ch = seg.array[bufferLength - 1]; + // if (ch == '\n') { + // buffer.setBooleanProperty(Buffer.TRAILING_EOL,true); + // seg.count--; + // // endOffsets.setSize(endOffsets.getSize() - 1); + // } + // } // add a line marker at the end for proper offset manager // operation - endOffsets.add(seg.count + 1); + // endOffsets.add(seg.count + 1); // to avoid having to deal with read/write locks and such, // we insert the loaded data into the buffer in the // post-load cleanup runnable, which runs in the AWT thread. - if(!insert) - { - buffer.setProperty(LOAD_DATA,seg); - buffer.setProperty(END_OFFSETS,endOffsets); - buffer.setProperty(NEW_PATH,path); - if(lineSeparator != null) - buffer.setProperty(Buffer.LINESEP,lineSeparator); + if (!insert) { + m_loadData = seg; + // buffer.setProperty(END_OFFSETS,endOffsets); + // buffer.setProperty(NEW_PATH,path); + if (lineSeparator != null) { + buffer.setProperty(XMLDocument.LINE_SEPARATOR, lineSeparator); + } } // used in insert() @@ -586,7 +593,7 @@ try { String[] args = { vfs.getFileName(path) }; - setStatus(jEdit.getProperty("vfs.status.save",args)); + setStatus(Messages.getMessage("vfs.status.save",args)); // the entire save operation can be aborted... setAbortable(true); @@ -595,12 +602,12 @@ path = MiscUtilities.resolveSymlinks(path); // Only backup once per session - if(buffer.getProperty(Buffer.BACKED_UP) == null - || jEdit.getBooleanProperty("backupEverySave")) - { - vfs._backup(session,path,view); - buffer.setBooleanProperty(Buffer.BACKED_UP,true); - } + // if(buffer.getProperty(Buffer.BACKED_UP) == null + // || jEdit.getBooleanProperty("backupEverySave")) + // { + // vfs._backup(session,path,view); + // buffer.setBooleanProperty(Buffer.BACKED_UP,true); + // } /* if the VFS supports renaming files, we first * save to #<filename>#save#, then rename that @@ -614,7 +621,7 @@ String savePath; boolean twoStageSave = (vfs.getCapabilities() & VFS.RENAME_CAP) != 0 - && jEdit.getBooleanProperty("twoStageSave"); + && jsXe.getBooleanProperty("twoStageSave"); if(twoStageSave) savePath = vfs.getTwoStageSaveName(path); else @@ -632,11 +639,11 @@ // Can't use buffer.getName() here because // it is not changed until the save is // complete - if(savePath.endsWith(".gz")) - buffer.setBooleanProperty(Buffer.GZIPPED,true); + // if(savePath.endsWith(".gz")) + // buffer.setBooleanProperty(Buffer.GZIPPED,true); - if(buffer.getBooleanProperty(Buffer.GZIPPED)) - out = new GZIPOutputStream(out); + // if(buffer.getBooleanProperty(Buffer.GZIPPED)) + // out = new GZIPOutputStream(out); write(buffer,out); @@ -710,7 +717,7 @@ try { String[] args = { vfs.getFileName(path) }; - setStatus(jEdit.getProperty("vfs.status.autosave",args)); + setStatus(Messages.getMessage("vfs.status.autosave",args)); // the entire save operation can be aborted... setAbortable(true); @@ -756,152 +763,204 @@ } //}}} //{{{ write() method - private void write(Buffer buffer, OutputStream _out) - throws IOException - { - BufferedWriter out = null; + // private void write(XMLDocument buffer, OutputStream _out) throws IOException { + // BufferedWriter out = null; - try - { - String encoding = buffer.getStringProperty(Buffer.ENCODING); - if(encoding.equals(MiscUtilities.UTF_8_Y)) - { - // not supported by Java... - _out.write(UTF8_MAGIC_1); - _out.write(UTF8_MAGIC_2); - _out.write(UTF8_MAGIC_3); - _out.flush(); - encoding = "UTF-8"; - } + // try { + // String encoding = buffer.getStringProperty(Buffer.ENCODING); + // if (encoding.equals(MiscUtilities.UTF_8_Y)) { + // // not supported by Java... + // _out.write(UTF8_MAGIC_1); + // _out.write(UTF8_MAGIC_2); + // _out.write(UTF8_MAGIC_3); + // _out.flush(); + // encoding = "UTF-8"; + // } - out = new BufferedWriter( - new OutputStreamWriter(_out,encoding), - IOBUFSIZE); + // out = new BufferedWriter(new OutputStreamWriter(_out,encoding), IOBUFSIZE); - Segment lineSegment = new Segment(); - String newline = buffer.getStringProperty(Buffer.LINESEP); - if(newline == null) - newline = System.getProperty("line.separator"); + // Segment lineSegment = new Segment(); + // String newline = buffer.getStringProperty(Buffer.LINESEP); + // if (newline == null) { + // newline = System.getProperty("line.separator"); + // } - setProgressMaximum(buffer.getLineCount() / PROGRESS_INTERVAL); - setProgressValue(0); + // setProgressMaximum(buffer.getLineCount() / PROGRESS_INTERVAL); + // setProgressValue(0); - int i = 0; - while(i < buffer.getLineCount()) - { - buffer.getLineText(i,lineSegment); - out.write(lineSegment.array,lineSegment.offset, - lineSegment.count); + // int i = 0; + // while (i < buffer.getLineCount()) { + // buffer.getLineText(i,lineSegment); + // out.write(lineSegment.array, lineSegment.offset, lineSegment.count); - if(i != buffer.getLineCount() - 1) - { - out.write(newline); - } + // if (i != buffer.getLineCount() - 1) { + // out.write(newline); + // } - if(++i % PROGRESS_INTERVAL == 0) - setProgressValue(i / PROGRESS_INTERVAL); - } + // if (++i % PROGRESS_INTERVAL == 0) { + // setProgressValue(i / PROGRESS_INTERVAL); + // } + // } - if(jEdit.getBooleanProperty("stripTrailingEOL") - && buffer.getBooleanProperty(Buffer.TRAILING_EOL)) - { - out.write(newline); + // // if(jEdit.getBooleanProperty("stripTrailingEOL") + // // && buffer.getBooleanProperty(Buffer.TRAILING_EOL)) + // // { + // // out.write(newline); + // // } + // } finally { + // if (out != null) { + // out.close(); + // } else { + // _out.close(); + // } + // } + // } //}}} + + //{{{ write() + private void write(XMLDocument buffer, OutputStream out) throws IOException { + + String newLine = getProperty(XMLDocument.LINE_SEPARATOR); + + String encoding = getProperty(XMLDocument.ENCODING); + if (encoding.equals(MiscUtilities.UTF_8_Y)) { + // not supported by Java... + out.write(UTF8_MAGIC_1); + out.write(UTF8_MAGIC_2); + out.write(UTF8_MAGIC_3); + out.flush(); + encoding = "UTF-8"; + } + + //now just write out the text. + int length = buffer.getLength(); + int index = 0; + BufferedWriter outbuf = new BufferedWriter(new OutputStreamWriter(out, encoding), IO_BUFFER_SIZE); + Segment seg = new Segment(); + + while (index < length) { + int size = WRITE_SIZE; + try { + size = Math.min(length - index, WRITE_SIZE); + } catch(NumberFormatException nf) { + Log.log(Log.ERROR, this, nf); } + + // out.write(m_content.getText(index, size).getBytes(getProperty(ENCODING)), index, size); + buffer.getText(index, size, seg); + + int startOffset = seg.offset; + int endOffset = size + seg.offset; + + for (int i=startOffset; i<endOffset; i++) { + if (seg.array[i]=='\n') { + outbuf.write(seg.array, seg.offset, i - seg.offset); + outbuf.write(newLine.toCharArray(), 0, newLine.length()); + + //add 1 because of \n character, + seg.count -= i-seg.offset+1; + seg.offset += i-seg.offset+1; + } + } + + //write the rest + outbuf.write(seg.array, seg.offset, seg.count); + index += size; } - finally - { - if(out != null) - out.close(); - else - _out.close(); - } - } //}}} + + outbuf.close(); + }//}}} + + // //{{{ insert() method + // private void insert() + // { + // InputStream in = null; - //{{{ insert() method - private void insert() - { - InputStream in = null; + // try + // { + // try + // { + // String[] args = { vfs.getFileName(path) }; + // setStatus(jEdit.getProperty("vfs.status.load",args)); + // setAbortable(true); - try - { - try - { - String[] args = { vfs.getFileName(path) }; - setStatus(jEdit.getProperty("vfs.status.load",args)); - setAbortable(true); + // path = vfs._canonPath(session,path,view); - path = vfs._canonPath(session,path,view); + // VFS.DirectoryEntry entry = vfs._getDirectoryEntry( + // session,path,view); + // long length; + // if(entry != null) + // length = entry.length; + // else + // length = 0L; - VFS.DirectoryEntry entry = vfs._getDirectoryEntry( - session,path,view); - long length; - if(entry != null) - length = entry.length; - else - length = 0L; + // in = vfs._createInputStream(session,path,false,view); + // if(in == null) + // return; - in = vfs._createInputStream(session,path,false,view); - if(in == null) - return; + // final SegmentBuffer seg = read( + // autodetect(in),length,true); - final SegmentBuffer seg = read( - autodetect(in),length,true); + // /* we don't do this in Buffer.insert() so that + // we can insert multiple files at once */ + // VFSManager.runInAWTThread(new Runnable() + // { + // public void run() + // { + // view.getTextArea().setSelectedText( + // seg.toString()); + // } + // }); + // } + // catch(IOException io) + // { + // Log.log(Log.ERROR,this,io); + // String[] pp = { io.toString() }; + // VFSManager.error(view,path,"ioerror.read-error",pp); - /* we don't do this in Buffer.insert() so that - we can insert multiple files at once */ - VFSManager.runInAWTThread(new Runnable() - { - public void run() - { - view.getTextArea().setSelectedText( - seg.toString()); - } - }); - } - catch(IOException io) - { - Log.log(Log.ERROR,this,io); - String[] pp = { io.toString() }; - VFSManager.error(view,path,"ioerror.read-error",pp); + // buffer.setBooleanProperty(ERROR_OCCURRED,true); + // } + // } + // catch(WorkThread.Abort a) + // { + // if(in != null) + // { + // try + // { + // in.close(); + // } + // catch(IOException io) + // { + // } + // } - buffer.setBooleanProperty(ERROR_OCCURRED,true); - } - } - catch(WorkThread.Abort a) - { - if(in != null) - { - try - { - in.close(); - } - catch(IOException io) - { - } - } + // buffer.setBooleanProperty(ERROR_OCCURRED,true); + // } + // finally + // { + // try + // { + // vfs._endVFSSession(session,view); + // } + // catch(IOException io) + // { + // Log.log(Log.ERROR,this,io); + // String[] pp = { io.toString() }; + // VFSManager.error(view,path,"ioerror.read-error",pp); - buffer.setBooleanProperty(ERROR_OCCURRED,true); - } - finally - { - try - { - vfs._endVFSSession(session,view); - } - catch(IOException io) - { - Log.log(Log.ERROR,this,io); - String[] pp = { io.toString() }; - VFSManager.error(view,path,"ioerror.read-error",pp); + // buffer.setBooleanProperty(ERROR_OCCURRED,true); + // } + // catch(WorkThread.Abort a) + // { + // buffer.setBooleanProperty(ERROR_OCCURRED,true); + // } + // } + // } //}}} - buffer.setBooleanProperty(ERROR_OCCURRED,true); - } - catch(WorkThread.Abort a) - { - buffer.setBooleanProperty(ERROR_OCCURRED,true); - } - } - } //}}} - + //{{{ Private static members + private static final int READ_SIZE = 5120; + private static final int WRITE_SIZE = 5120; + private static final int IO_BUFFER_SIZE = 32768; //}}} + + //}}} } Modified: branches/jsxe2/src/net/sourceforge/jsxe/io/FileRootsVFS.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/io/FileRootsVFS.java 2006-08-03 19:18:36 UTC (rev 1103) +++ branches/jsxe2/src/net/sourceforge/jsxe/io/FileRootsVFS.java 2006-08-04 19:17:41 UTC (rev 1104) @@ -1,5 +1,5 @@ /* -FileVFS.java +FileRootsVFS.java :tabSize=4:indentSize=4:noTabs=true: :folding=explicit:collapseFolds=1: @@ -25,7 +25,7 @@ from http://www.fsf.org/copyleft/gpl.txt */ -package org.gjt.sp.jedit.io; +package net.sourceforge.jsxe.io; //{{{ Imports import javax.swing.filechooser.FileSystemView; Modified: branches/jsxe2/src/net/sourceforge/jsxe/io/FileVFS.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/io/FileVFS.java 2006-08-03 19:18:36 UTC (rev 1103) +++ branches/jsxe2/src/net/sourceforge/jsxe/io/FileVFS.java 2006-08-04 19:17:41 UTC (rev 1104) @@ -30,6 +30,7 @@ import java.io.*; import java.text.*; import java.util.Date; +import net.sourceforge.jsxe.OperatingSystem; import net.sourceforge.jsxe.util.Log; //}}} @@ -89,10 +90,8 @@ } //}}} //{{{ save() method - public boolean save(View view, Buffer buffer, String path) - { - if(OperatingSystem.isUnix()) - { + public boolean save(TabbedView view, XMLDocument buffer, String path) { + if (OperatingSystem.isUnix()) { int permissions = getPermissions(buffer.getPath()); Log.log(Log.DEBUG,this,buffer.getPath() + " has permissions 0" + Integer.toString(permissions,8)); @@ -103,30 +102,30 @@ } //}}} //{{{ insert() method - public boolean insert(View view, Buffer buffer, String path) - { - File file = new File(path); + // public boolean insert(View view, Buffer buffer, String path) + // { + // File file = new File(path); - //{{{ Check if file is valid - if(!file.exists()) - return false; + // //{{{ Check if file is valid + // if(!file.exists()) + // return false; - if(file.isDirectory()) - { - VFSManager.error(view,file.getPath(), - "ioerror.open-directory",null); - return false; - } + // if(file.isDirectory()) + // { + // VFSManager.error(view,file.getPath(), + // "ioerror.open-directory",null); + // return false; + // } - if(!file.canRead()) - { - VFSManager.error(view,file.getPath(), - "ioerror.no-read",null); - return false; - } //}}} + // if(!file.canRead()) + // { + // VFSManager.error(view,file.getPath(), + // "ioerror.no-read",null); + // return false; + // } //}}} - return super.insert(view,buffer,path); - } //}}} + // return super.insert(view,buffer,path); + // } //}}} //{{{ _canonPath() method /** @@ -323,47 +322,47 @@ return retVal; } //}}} - //{{{ _backup() method - public void _backup(Object session, String path, Component comp) - throws IOException - { - // Fetch properties - int backups = jEdit.getIntegerProperty("backups",1); + // //{{{ _backup() method + // public void _backup(Object session, String path, Component comp) + // throws IOException + // { + // // Fetch properties + // int backups = jsXe.getIntegerProperty("backups",1); - if(backups == 0) - return; + // if(backups == 0) + // return; - String backupPrefix = jEdit.getProperty("backup.prefix"); - String backupSuffix = jEdit.getProperty("backup.suffix"); + // String backupPrefix = jsXe.getProperty("backup.prefix"); + // String backupSuffix = jsXe.getProperty("backup.suffix"); - String backupDirectory = jEdit.getProperty("backup.directory"); + // String backupDirectory = jsXe.getProperty("backup.directory"); - int backupTimeDistance = jEdit.getIntegerProperty("backup.minTime",0); - File file = new File(path); + // int backupTimeDistance = jsXe.getIntegerProperty("backup.minTime",0); + // File file = new File(path); - // Check for backup.directory, and create that - // directory if it doesn't exist - if(backupDirectory == null || backupDirectory.length() == 0) - backupDirectory = file.getParent(); - else - { - backupDirectory = MiscUtilities.constructPath( - System.getProperty("user.home"),backupDirectory); + // // Check for backup.directory, and create that + // // directory if it doesn't exist + // if(backupDirectory == null || backupDirectory.length() == 0) + // backupDirectory = file.getParent(); + // else + // { + // backupDirectory = MiscUtilities.constructPath( + // System.getProperty("user.home"),backupDirectory); - // Perhaps here we would want to guard with - // a property for parallel backups or not. - backupDirectory = MiscUtilities.concatPath( - backupDirectory,file.getParent()); + // // Perhaps here we would want to guard with + // // a property for parallel backups or not. + // backupDirectory = MiscUtilities.concatPath( + // backupDirectory,file.getParent()); - File dir = new File(backupDirectory); + // File dir = new File(backupDirectory); - if (!dir.exists()) - dir.mkdirs(); - } + // if (!dir.exists()) + // dir.mkdirs(); + // } - MiscUtilities.saveBackup(file,backups,backupPrefix, - backupSuffix,backupDirectory,backupTimeDistance); - } //}}} + // MiscUtilities.saveBackup(file,backups,backupPrefix, + // backupSuffix,backupDirectory,backupTimeDistance); + // } //}}} //{{{ _createInputStream() method public InputStream _createInputStream(Object session, String path, @@ -390,7 +389,7 @@ } //}}} //{{{ _saveComplete() method - public void _saveComplete(Object session, Buffer buffer, String path, + public void _saveComplete(Object session, XMLDocument buffer, String path, Component comp) { int permissions = buffer.getIntegerProperty(PERMISSIONS_PROPERTY,0); @@ -410,7 +409,7 @@ public static int getPermissions(String path) { int permissions = 0; - if (jEdit.getBooleanProperty("chmodDisabled")) { + if (jsXe.getBooleanProperty("chmodDisabled")) { return permissions; } @@ -448,7 +447,7 @@ * does nothing. */ public static void setPermissions(String path, int permissions) { - if (jEdit.getBooleanProperty("chmodDisabled")) + if (jsXe.getBooleanProperty("chmodDisabled")) return; if (permissions != 0) { Modified: branches/jsxe2/src/net/sourceforge/jsxe/io/VFS.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/io/VFS.java 2006-08-03 19:18:36 UTC (rev 1103) +++ branches/jsxe2/src/net/sourceforge/jsxe/io/VFS.java 2006-08-04 19:17:41 UTC (rev 1104) @@ -23,7 +23,7 @@ from http://www.fsf.org/copyleft/gpl.txt */ -package net.sourceforge.jsxe.io.io; +package net.sourceforge.jsxe.io; //{{{ Imports import gnu.regexp.*; @@ -33,6 +33,9 @@ import java.util.*; import net.sourceforge.jsxe.msg.PropertiesChanged; import net.sourceforge.jsxe.util.Log; +import net.sourceforge.jsxe.util.MiscUtilities; +import net.sourceforge.jsxe.dom2.ls.XMLDocumentIORequest; +import net.sourceforge.jsxe.gui.Messages; //}}} /** @@ -345,27 +348,26 @@ * @param buffer The buffer * @param path The path */ - public boolean load(View view, Buffer buffer, String path) - { - if((getCapabilities() & READ_CAP) == 0) - { + public boolean load(TabbedView view, XMLDocument buffer, String path) { + if((getCapabilities() & READ_CAP) == 0) { VFSManager.error(view,path,"vfs.not-supported.load",new String[] { name }); return false; } Object session = createVFSSession(path,view); - if(session == null) + if (session == null) { return false; + } - if((getCapabilities() & WRITE_CAP) == 0) + if ((getCapabilities() & WRITE_CAP) == 0) { buffer.setReadOnly(true); + } - BufferIORequest request = new BufferIORequest( - BufferIORequest.LOAD,view,buffer,session,this,path); - if(buffer.isTemporary()) - // this makes HyperSearch much faster - request.run(); - else + XMLDocumentIORequest request = new XMLDocumentIORequest(XMLDocumentIORequest.LOAD,view,buffer,session,this,path); + // if(buffer.isTemporary()) + // // this makes HyperSearch much faster + // request.run(); + // else VFSManager.runInWorkThread(request); return true; @@ -379,55 +381,54 @@ * @param buffer The buffer * @param path The path */ - public boolean save(View view, Buffer buffer, String path) + public boolean save(TabbedView view, XMLDocument buffer, String path) { - if((getCapabilities() & WRITE_CAP) == 0) - { + if ((getCapabilities() & WRITE_CAP) == 0) { VFSManager.error(view,path,"vfs.not-supported.save",new String[] { name }); return false; } Object session = createVFSSession(path,view); - if(session == null) + if (session == null) { return false; + } /* When doing a 'save as', the path to save to (path) * will not be the same as the buffer's previous path * (buffer.getPath()). In that case, we want to create * a backup of the new path, even if the old path was * backed up as well (BACKED_UP property set) */ - if(!path.equals(buffer.getPath())) - buffer.unsetProperty(Buffer.BACKED_UP); + // if (!path.equals(buffer.getPath())) { + // buffer.unsetProperty(Buffer.BACKED_UP); + // } - VFSManager.runInWorkThread(new BufferIORequest( - BufferIORequest.SAVE,view,buffer,session,this,path)); + VFSManager.runInWorkThread(new XMLDocumentIORequest(XMLDocumentIORequest.SAVE,view,buffer,session,this,path)); return true; } //}}} - //{{{ insert() method - /** - * Inserts a file into the specified buffer. The default implementation - * posts an I/O request to the I/O thread. - * @param view The view - * @param buffer The buffer - * @param path The path - */ - public boolean insert(View view, Buffer buffer, String path) - { - if((getCapabilities() & READ_CAP) == 0) - { - VFSManager.error(view,path,"vfs.not-supported.load",new String[] { name }); - return false; - } + // //{{{ insert() method + // /** + // * Inserts a file into the specified buffer. The default implementation + // * posts an I/O request to the I/O thread. + // * @param view The view + // * @param buffer The buffer + // * @param path The path + // */ + // public boolean insert(View view, Buffer buffer, String path) { + + // if ((getCapabilities() & READ_CAP) == 0) { + // VFSManager.error(view,path,"vfs.not-supported.load",new String[] { name }); + // return false; + // } - Object session = createVFSSession(path,view); - if(session == null) - return false; + // Object session = createVFSSession(path,view); + // if(session == null) + // return false; - VFSManager.runInWorkThread(new BufferIORequest( - BufferIORequest.INSERT,view,buffer,session,this,path)); - return true; - } //}}} + // VFSManager.runInWorkThread(new XMLDocumentIORequest( + // XMLDocumentIORequest.INSERT,view,buffer,session,this,path)); + // return true; + // } //}}} // A method name that starts with _ requires a session object @@ -583,11 +584,11 @@ switch(type) { case FILE: - return jEdit.getProperty("vfs.browser.type.file"); + return Messages.getMessage("vfs.browser.type.file"); case DIRECTORY: - return jEdit.getProperty("vfs.browser.type.directory"); + return Messages.getMessage("vfs.browser.type.directory"); case FILESYSTEM: - return jEdit.getProperty("vfs.browser.type.filesystem"); + return Messages.getMessage("vfs.browser.type.filesystem"); default: throw new IllegalArgumentException(); } @@ -595,15 +596,15 @@ if(name.equals(EA_STATUS)) { if (canRead) { if (canWrite) { - return jEdit.getProperty("vfs.browser.status.rw"); + return Messages.getMessage("vfs.browser.status.rw"); } else { - return jEdit.getProperty("vfs.browser.status.ro"); + return Messages.getMessage("vfs.browser.status.ro"); } } else { if (canWrite) { - return jEdit.getProperty("vfs.browser.status.append"); + return Messages.getMessage("vfs.browser.status.append"); } else { - return jEdit.getProperty("vfs.browser.status.no"); + return Messages.getMessage("vfs.browser.status.no"); } } } else { @@ -620,15 +621,15 @@ } } //}}} - //{{{ getColor() method - public Color getColor() { - if (!colorCalculated) { - colorCalculated = true; - color = getDefaultColorFor(name); - } + // //{{{ getColor() method + // public Color getColor() { + // if (!colorCalculated) { + // colorCalculated = true; + // color = getDefaultColorFor(name); + // } - return color; - } //}}} + // return color; + // } //}}} //{{{ toString() method public String toString() { @@ -742,7 +743,7 @@ * @param comp The component that will parent error dialog boxes * @exception IOException If an I/O error occurs */ - public void _saveComplete(Object session, Buffer buffer, String path, + public void _saveComplete(Object session, XMLDocument buffer, String path, Component comp) throws IOException {} //}}} //{{{ _endVFSSession() method @@ -764,22 +765,22 @@ * Returns color of the specified file name, by matching it against * user-specified regular expressions. */ - public static Color getDefaultColorFor(String name) { - synchronized(lock) { - if (colors == null) { - loadColors(); - } + // public static Color getDefaultColorFor(String name) { + // synchronized(lock) { + // if (colors == null) { + // loadColors(); + // } - for (int i = 0; i < colors.size(); i++) { - ColorEntry entry = (ColorEntry)colors.elementAt(i); - if (entry.re.isMatch(name)) { - return entry.color; - } - } + // for (int i = 0; i < colors.size(); i++) { + // ColorEntry entry = (ColorEntry)colors.elementAt(i); + // if (entry.re.isMatch(name)) { + // return entry.color; + // } + // } - return null; - } - } //}}} + // return null; + // } + // } //}}} //{{{ DirectoryEntryCompare class /** @@ -819,26 +820,21 @@ private String name; private int caps; private String[] extAttrs; - private static Vector colors; + // private static Vector colors; private static Object lock = new Object(); //{{{ Class initializer - static - { - EditBus.addToBus(new EBComponent() - { - public void handleMessage(EBMessage msg) - { - if(msg instanceof PropertiesChanged) - { - synchronized(lock) - { - colors = null; - } - } - } - }); - } //}}} + // static { + // EditBus.addToBus(new EBListener() { + // public void handleMessage(EBMessage msg) { + // if (msg instanceof PropertiesChanged) { + // synchronized(lock) { + // colors = null; + // } + // } + // } + // }); + // } //}}} //{{{ _listDirectory() method private void _listDirectory(Object session, ArrayList stack, @@ -892,38 +888,38 @@ } //}}} //{{{ loadColors() method - private static void loadColors() - { - synchronized(lock) - { - colors = new Vector(); + // private static void loadColors() + // { + // synchronized(lock) + // { + // colors = new Vector(); - if(!jEdit.getBooleanProperty("vfs.browser.colorize")) - return; + // if(!jEdit.getBooleanProperty("vfs.browser.colorize")) + // return; - String glob; - int i = 0; - while((glob = jEdit.getProperty("vfs.browser.colors." + i + ".glob")) != null) - { - try - { - colors.addElement(new ColorEntry( - new RE(MiscUtilities.globToRE(glob)), - jEdit.getColorProperty( - "vfs.browser.colors." + i + ".color", - Color.black))); - } - catch(REException e) - { - Log.log(Log.ERROR,VFS.class,"Invalid regular expression: " - + glob); - Log.log(Log.ERROR,VFS.class,e); - } + // String glob; + // int i = 0; + // while((glob = jEdit.getProperty("vfs.browser.colors." + i + ".glob")) != null) + // { + // try + // { + // colors.addElement(new ColorEntry( + // new RE(MiscUtilities.globToRE(glob)), + // jEdit.getColorProperty( + // "vfs.browser.colors." + i + ".color", + // Color.black))); + // } + // catch(REException e) + // { + // Log.log(Log.ERROR,VFS.class,"Invalid regular expression: " + // + glob); + // Log.log(Log.ERROR,VFS.class,e); + // } - i++; - } - } - } //}}} + // i++; + // } + // } + // } //}}} //{{{ ColorEntry class static class ColorEntry Modified: branches/jsxe2/src/net/sourceforge/jsxe/io/VFSManager.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/io/VFSManager.java 2006-08-03 19:18:36 UTC (rev 1103) +++ branches/jsxe2/src/net/sourceforge/jsxe/io/VFSManager.java 2006-08-04 19:17:41 UTC (rev 1104) @@ -23,7 +23,7 @@ from http://www.fsf.org/copyleft/gpl.txt */ -package org.gjt.sp.jedit.io; +package net.sourceforge.jsxe.io; //{{{ Imports import javax.swing.JOptionPane; @@ -37,11 +37,10 @@ import java.util.LinkedList; import java.util.List; import java.util.Vector; -import org.gjt.sp.jedit.gui.ErrorListDialog; -import org.gjt.sp.jedit.msg.VFSUpdate; -import org.gjt.sp.jedit.*; -import org.gjt.sp.util.Log; -import org.gjt.sp.util.WorkThreadPool; +import net.sourceforge.jsxe.gui.ErrorListDialog; +import net.sourceforge.jsxe.msg.VFSUpdate; +import net.sourceforge.jsxe.util.Log; +import net.sourceforge.jsxe.WorkThreadPool; //}}} /** Modified: branches/jsxe2/src/net/sourceforge/jsxe/properties =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/properties 2006-08-03 19:18:36 UTC (rev 1103) +++ branches/jsxe2/src/net/sourceforge/jsxe/properties 2006-08-04 19:17:41 UTC (rev 1104) @@ -15,6 +15,12 @@ ioThreadCount=4 +encoding.autodetect=true + +twoStageSave=false + +chmodDisabled=true + #{{{ Plugin Manager Default Dimensions #pluginmgr.x=100 #pluginmgr.y=100 Modified: branches/jsxe2/src/net/sourceforge/jsxe/util/MiscUtilities.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/util/MiscUtilities.java 2006-08-03 19:18:36 UTC (rev 1103) +++ branches/jsxe2/src/net/sourceforge/jsxe/util/MiscUtilities.java 2006-08-04 19:17:41 UTC (rev 1104) @@ -34,7 +34,7 @@ import java.util.*; import javax.swing.JMenuItem; - +import java.text.DecimalFormat; import javax.swing.JPopupMenu; import java.awt.Component; import javax.swing.JComponent; @@ -872,6 +872,28 @@ return s1.equals(s2); } //}}} + //{{{ formatFileSize() method + public static final DecimalFormat KB_FORMAT = new DecimalFormat("#.# KB"); + public static final DecimalFormat MB_FORMAT = new DecimalFormat("#.# MB"); + + /** + * Formats the given file size into a nice string (123 bytes, 10.6 KB, + * 1.2 MB). + * @param length The size + * @since jsXe 0.5 pre3 + */ + public static String formatFileSize(long length) { + if (length < 1024) { + return length + " bytes"; + } else { + if (length < 1024*1024) { + return KB_FORMAT.format((double)length / 1024); + } else { + return MB_FORMAT.format((double)length / 1024 / 1024); + } + } + } //}}} + //}}} //{{{ Sorting methods This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ian...@us...> - 2006-09-05 15:51:36
|
Revision: 1235 http://svn.sourceforge.net/jsxe/?rev=1235&view=rev Author: ian_lewis Date: 2006-09-05 08:47:51 -0700 (Tue, 05 Sep 2006) Log Message: ----------- Merge from trunk/jsxe of rev. 1232 Modified Paths: -------------- branches/jsxe2/AUTHORS branches/jsxe2/Changelog branches/jsxe2/INSTALL branches/jsxe2/README branches/jsxe2/bin/jsXe.bat branches/jsxe2/bin/jsXe.sh branches/jsxe2/build.xml branches/jsxe2/src/net/sourceforge/jsxe/ActionManager.java branches/jsxe2/src/net/sourceforge/jsxe/BufferHistory.java branches/jsxe2/src/net/sourceforge/jsxe/CatalogManager.java branches/jsxe2/src/net/sourceforge/jsxe/CustomFileFilter.java branches/jsxe2/src/net/sourceforge/jsxe/DocumentBuffer.java branches/jsxe2/src/net/sourceforge/jsxe/LocalizedAction.java branches/jsxe2/src/net/sourceforge/jsxe/action/CopyAction.java branches/jsxe2/src/net/sourceforge/jsxe/action/CutAction.java branches/jsxe2/src/net/sourceforge/jsxe/action/FindAction.java branches/jsxe2/src/net/sourceforge/jsxe/action/FindNextAction.java branches/jsxe2/src/net/sourceforge/jsxe/action/OpenRecentFileAction.java branches/jsxe2/src/net/sourceforge/jsxe/action/PasteAction.java branches/jsxe2/src/net/sourceforge/jsxe/dom/AdapterNode.java branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLDocument.java branches/jsxe2/src/net/sourceforge/jsxe/gui/GUIUtilities.java branches/jsxe2/src/net/sourceforge/jsxe/gui/Messages.java branches/jsxe2/src/net/sourceforge/jsxe/gui/TabbedView.java branches/jsxe2/src/net/sourceforge/jsxe/gui/menu/WrappingMenu.java branches/jsxe2/src/net/sourceforge/jsxe/jsXe.java branches/jsxe2/src/net/sourceforge/jsxe/msg/PropertyChanged.java branches/jsxe2/src/net/sourceforge/jsxe/options/GeneralOptionPane.java branches/jsxe2/src/net/sourceforge/jsxe/options/ShortcutsOptionPane.java branches/jsxe2/src/net/sourceforge/jsxe/properties Added Paths: ----------- branches/jsxe2/buildlib/avalon.jar branches/jsxe2/buildlib/batik.jar branches/jsxe2/buildlib/bsf.jar branches/jsxe2/buildlib/docbook/ branches/jsxe2/buildlib/docbook/VERSION branches/jsxe2/buildlib/docbook/catalog.xml branches/jsxe2/buildlib/docbook/common/ branches/jsxe2/buildlib/docbook/common/ChangeLog branches/jsxe2/buildlib/docbook/common/af.xml branches/jsxe2/buildlib/docbook/common/ar.xml branches/jsxe2/buildlib/docbook/common/autoidx-ng.xsl branches/jsxe2/buildlib/docbook/common/bg.xml branches/jsxe2/buildlib/docbook/common/bn.xml branches/jsxe2/buildlib/docbook/common/bs.xml branches/jsxe2/buildlib/docbook/common/ca.xml branches/jsxe2/buildlib/docbook/common/common.xsl branches/jsxe2/buildlib/docbook/common/cs.xml branches/jsxe2/buildlib/docbook/common/da.xml branches/jsxe2/buildlib/docbook/common/de.xml branches/jsxe2/buildlib/docbook/common/el.xml branches/jsxe2/buildlib/docbook/common/en.xml branches/jsxe2/buildlib/docbook/common/es.xml branches/jsxe2/buildlib/docbook/common/et.xml branches/jsxe2/buildlib/docbook/common/eu.xml branches/jsxe2/buildlib/docbook/common/fa.xml branches/jsxe2/buildlib/docbook/common/fi.xml branches/jsxe2/buildlib/docbook/common/fr.xml branches/jsxe2/buildlib/docbook/common/gentext.xsl branches/jsxe2/buildlib/docbook/common/he.xml branches/jsxe2/buildlib/docbook/common/hr.xml branches/jsxe2/buildlib/docbook/common/hu.xml branches/jsxe2/buildlib/docbook/common/id.xml branches/jsxe2/buildlib/docbook/common/it.xml branches/jsxe2/buildlib/docbook/common/ja.xml branches/jsxe2/buildlib/docbook/common/ko.xml branches/jsxe2/buildlib/docbook/common/l10n.dtd branches/jsxe2/buildlib/docbook/common/l10n.xml branches/jsxe2/buildlib/docbook/common/l10n.xsl branches/jsxe2/buildlib/docbook/common/la.xml branches/jsxe2/buildlib/docbook/common/labels.xsl branches/jsxe2/buildlib/docbook/common/lt.xml branches/jsxe2/buildlib/docbook/common/nl.xml branches/jsxe2/buildlib/docbook/common/nn.xml branches/jsxe2/buildlib/docbook/common/no.xml branches/jsxe2/buildlib/docbook/common/olink.xsl branches/jsxe2/buildlib/docbook/common/pi.xsl branches/jsxe2/buildlib/docbook/common/pl.xml branches/jsxe2/buildlib/docbook/common/pt.xml branches/jsxe2/buildlib/docbook/common/pt_br.xml branches/jsxe2/buildlib/docbook/common/ro.xml branches/jsxe2/buildlib/docbook/common/ru.xml branches/jsxe2/buildlib/docbook/common/sk.xml branches/jsxe2/buildlib/docbook/common/sl.xml branches/jsxe2/buildlib/docbook/common/sr.xml branches/jsxe2/buildlib/docbook/common/sr_Latn.xml branches/jsxe2/buildlib/docbook/common/subtitles.xsl branches/jsxe2/buildlib/docbook/common/sv.xml branches/jsxe2/buildlib/docbook/common/table.xsl branches/jsxe2/buildlib/docbook/common/targetdatabase.dtd branches/jsxe2/buildlib/docbook/common/targets.xsl branches/jsxe2/buildlib/docbook/common/th.xml branches/jsxe2/buildlib/docbook/common/titles.xsl branches/jsxe2/buildlib/docbook/common/tr.xml branches/jsxe2/buildlib/docbook/common/uk.xml branches/jsxe2/buildlib/docbook/common/vi.xml branches/jsxe2/buildlib/docbook/common/xh.xml branches/jsxe2/buildlib/docbook/common/zh_cn.xml branches/jsxe2/buildlib/docbook/common/zh_tw.xml branches/jsxe2/buildlib/docbook/dtd/ branches/jsxe2/buildlib/docbook/dtd/calstblx.dtd branches/jsxe2/buildlib/docbook/dtd/catalog branches/jsxe2/buildlib/docbook/dtd/catalog.xml branches/jsxe2/buildlib/docbook/dtd/dbcentx.mod branches/jsxe2/buildlib/docbook/dtd/dbgenent.mod branches/jsxe2/buildlib/docbook/dtd/dbhierx.mod branches/jsxe2/buildlib/docbook/dtd/dbnotnx.mod branches/jsxe2/buildlib/docbook/dtd/dbpoolx.mod branches/jsxe2/buildlib/docbook/dtd/docbookx.dtd branches/jsxe2/buildlib/docbook/dtd/ent/ branches/jsxe2/buildlib/docbook/dtd/ent/ISOamsa.ent branches/jsxe2/buildlib/docbook/dtd/ent/ISOamsb.ent branches/jsxe2/buildlib/docbook/dtd/ent/ISOamsc.ent branches/jsxe2/buildlib/docbook/dtd/ent/ISOamsn.ent branches/jsxe2/buildlib/docbook/dtd/ent/ISOamso.ent branches/jsxe2/buildlib/docbook/dtd/ent/ISOamsr.ent branches/jsxe2/buildlib/docbook/dtd/ent/ISObox.ent branches/jsxe2/buildlib/docbook/dtd/ent/ISOcyr1.ent branches/jsxe2/buildlib/docbook/dtd/ent/ISOcyr2.ent branches/jsxe2/buildlib/docbook/dtd/ent/ISOdia.ent branches/jsxe2/buildlib/docbook/dtd/ent/ISOgrk1.ent branches/jsxe2/buildlib/docbook/dtd/ent/ISOgrk2.ent branches/jsxe2/buildlib/docbook/dtd/ent/ISOgrk3.ent branches/jsxe2/buildlib/docbook/dtd/ent/ISOgrk4.ent branches/jsxe2/buildlib/docbook/dtd/ent/ISOlat1.ent branches/jsxe2/buildlib/docbook/dtd/ent/ISOlat2.ent branches/jsxe2/buildlib/docbook/dtd/ent/ISOnum.ent branches/jsxe2/buildlib/docbook/dtd/ent/ISOpub.ent branches/jsxe2/buildlib/docbook/dtd/ent/ISOtech.ent branches/jsxe2/buildlib/docbook/dtd/ent/catalog branches/jsxe2/buildlib/docbook/dtd/ent/catalog.xml branches/jsxe2/buildlib/docbook/dtd/htmltblx.mod branches/jsxe2/buildlib/docbook/dtd/soextblx.dtd branches/jsxe2/buildlib/docbook/fo/ branches/jsxe2/buildlib/docbook/fo/ChangeLog branches/jsxe2/buildlib/docbook/fo/admon.xsl branches/jsxe2/buildlib/docbook/fo/autoidx-ng.xsl branches/jsxe2/buildlib/docbook/fo/autoidx.xsl branches/jsxe2/buildlib/docbook/fo/autotoc.xsl branches/jsxe2/buildlib/docbook/fo/axf.xsl branches/jsxe2/buildlib/docbook/fo/biblio.xsl branches/jsxe2/buildlib/docbook/fo/block.xsl branches/jsxe2/buildlib/docbook/fo/callout.xsl branches/jsxe2/buildlib/docbook/fo/component.xsl branches/jsxe2/buildlib/docbook/fo/division.xsl branches/jsxe2/buildlib/docbook/fo/docbook.xsl branches/jsxe2/buildlib/docbook/fo/docbookng.xsl branches/jsxe2/buildlib/docbook/fo/ebnf.xsl branches/jsxe2/buildlib/docbook/fo/fo-patch-for-fop.xsl branches/jsxe2/buildlib/docbook/fo/fo-rtf.xsl branches/jsxe2/buildlib/docbook/fo/fo.xsl branches/jsxe2/buildlib/docbook/fo/footnote.xsl branches/jsxe2/buildlib/docbook/fo/fop.xsl branches/jsxe2/buildlib/docbook/fo/formal.xsl branches/jsxe2/buildlib/docbook/fo/glossary.xsl branches/jsxe2/buildlib/docbook/fo/graphics.xsl branches/jsxe2/buildlib/docbook/fo/htmltbl.xsl branches/jsxe2/buildlib/docbook/fo/index.xsl branches/jsxe2/buildlib/docbook/fo/info.xsl branches/jsxe2/buildlib/docbook/fo/inline.xsl branches/jsxe2/buildlib/docbook/fo/keywords.xsl branches/jsxe2/buildlib/docbook/fo/lists.xsl branches/jsxe2/buildlib/docbook/fo/math.xsl branches/jsxe2/buildlib/docbook/fo/pagesetup.xsl branches/jsxe2/buildlib/docbook/fo/param.ent branches/jsxe2/buildlib/docbook/fo/param.xml branches/jsxe2/buildlib/docbook/fo/param.xsl branches/jsxe2/buildlib/docbook/fo/param.xweb branches/jsxe2/buildlib/docbook/fo/passivetex.xsl branches/jsxe2/buildlib/docbook/fo/pdf2index branches/jsxe2/buildlib/docbook/fo/pi.xsl branches/jsxe2/buildlib/docbook/fo/profile-docbook.xsl branches/jsxe2/buildlib/docbook/fo/qandaset.xsl branches/jsxe2/buildlib/docbook/fo/refentry.xsl branches/jsxe2/buildlib/docbook/fo/sections.xsl branches/jsxe2/buildlib/docbook/fo/synop.xsl branches/jsxe2/buildlib/docbook/fo/table.xsl branches/jsxe2/buildlib/docbook/fo/task.xsl branches/jsxe2/buildlib/docbook/fo/titlepage.templates.xml branches/jsxe2/buildlib/docbook/fo/titlepage.templates.xsl branches/jsxe2/buildlib/docbook/fo/titlepage.xsl branches/jsxe2/buildlib/docbook/fo/toc.xsl branches/jsxe2/buildlib/docbook/fo/verbatim.xsl branches/jsxe2/buildlib/docbook/fo/xep.xsl branches/jsxe2/buildlib/docbook/fo/xref.xsl branches/jsxe2/buildlib/docbook/html/ branches/jsxe2/buildlib/docbook/html/ChangeLog branches/jsxe2/buildlib/docbook/html/admon.xsl branches/jsxe2/buildlib/docbook/html/autoidx-ng.xsl branches/jsxe2/buildlib/docbook/html/autoidx.xsl branches/jsxe2/buildlib/docbook/html/autotoc.xsl branches/jsxe2/buildlib/docbook/html/biblio.xsl branches/jsxe2/buildlib/docbook/html/block.xsl branches/jsxe2/buildlib/docbook/html/callout.xsl branches/jsxe2/buildlib/docbook/html/changebars.xsl branches/jsxe2/buildlib/docbook/html/chunk-code.xsl branches/jsxe2/buildlib/docbook/html/chunk-common.xsl branches/jsxe2/buildlib/docbook/html/chunk.xsl branches/jsxe2/buildlib/docbook/html/chunker.xsl branches/jsxe2/buildlib/docbook/html/chunkfast.xsl branches/jsxe2/buildlib/docbook/html/chunktoc.xsl branches/jsxe2/buildlib/docbook/html/component.xsl branches/jsxe2/buildlib/docbook/html/division.xsl branches/jsxe2/buildlib/docbook/html/docbook.xsl branches/jsxe2/buildlib/docbook/html/docbookng.xsl branches/jsxe2/buildlib/docbook/html/ebnf.xsl branches/jsxe2/buildlib/docbook/html/footnote.xsl branches/jsxe2/buildlib/docbook/html/formal.xsl branches/jsxe2/buildlib/docbook/html/glossary.xsl branches/jsxe2/buildlib/docbook/html/graphics.xsl branches/jsxe2/buildlib/docbook/html/html-rtf.xsl branches/jsxe2/buildlib/docbook/html/html.xsl branches/jsxe2/buildlib/docbook/html/htmltbl.xsl branches/jsxe2/buildlib/docbook/html/index.xsl branches/jsxe2/buildlib/docbook/html/info.xsl branches/jsxe2/buildlib/docbook/html/inline.xsl branches/jsxe2/buildlib/docbook/html/keywords.xsl branches/jsxe2/buildlib/docbook/html/lists.xsl branches/jsxe2/buildlib/docbook/html/maketoc.xsl branches/jsxe2/buildlib/docbook/html/manifest.xsl branches/jsxe2/buildlib/docbook/html/math.xsl branches/jsxe2/buildlib/docbook/html/oldchunker.xsl branches/jsxe2/buildlib/docbook/html/onechunk.xsl branches/jsxe2/buildlib/docbook/html/param.ent branches/jsxe2/buildlib/docbook/html/param.xml branches/jsxe2/buildlib/docbook/html/param.xsl branches/jsxe2/buildlib/docbook/html/param.xweb branches/jsxe2/buildlib/docbook/html/pi.xsl branches/jsxe2/buildlib/docbook/html/profile-chunk-code.xsl branches/jsxe2/buildlib/docbook/html/profile-chunk.xsl branches/jsxe2/buildlib/docbook/html/profile-docbook.xsl branches/jsxe2/buildlib/docbook/html/profile-onechunk.xsl branches/jsxe2/buildlib/docbook/html/qandaset.xsl branches/jsxe2/buildlib/docbook/html/refentry.xsl branches/jsxe2/buildlib/docbook/html/sections.xsl branches/jsxe2/buildlib/docbook/html/synop.xsl branches/jsxe2/buildlib/docbook/html/table.xsl branches/jsxe2/buildlib/docbook/html/task.xsl branches/jsxe2/buildlib/docbook/html/titlepage.templates.xml branches/jsxe2/buildlib/docbook/html/titlepage.templates.xsl branches/jsxe2/buildlib/docbook/html/titlepage.xsl branches/jsxe2/buildlib/docbook/html/toc.xsl branches/jsxe2/buildlib/docbook/html/verbatim.xsl branches/jsxe2/buildlib/docbook/html/xref.xsl branches/jsxe2/buildlib/docbook/lib/ branches/jsxe2/buildlib/docbook/lib/ChangeLog branches/jsxe2/buildlib/docbook/lib/lib.xml branches/jsxe2/buildlib/docbook/lib/lib.xsl branches/jsxe2/buildlib/docbook/lib/lib.xweb branches/jsxe2/buildlib/fop.jar branches/jsxe2/buildlib/js.jar branches/jsxe2/doc/ branches/jsxe2/doc/manual/ branches/jsxe2/doc/manual/manual.xml branches/jsxe2/installer/ branches/jsxe2/installer/done-HalfAnOS.html branches/jsxe2/installer/done-MacOS.html branches/jsxe2/installer/done-Unix.html branches/jsxe2/installer/done-VMS.html branches/jsxe2/installer/done-Windows.html branches/jsxe2/installer/gpl.html branches/jsxe2/installer/jsxe-installer.ico branches/jsxe2/installer/jsxe.desktop branches/jsxe2/installer/jsxe.png branches/jsxe2/installer/launch4j.xml branches/jsxe2/installer/readme.html branches/jsxe2/installer/src/ branches/jsxe2/installer/src/installer/ branches/jsxe2/installer/src/installer/BZip2Constants.java branches/jsxe2/installer/src/installer/CBZip2InputStream.java branches/jsxe2/installer/src/installer/CBZip2OutputStream.java branches/jsxe2/installer/src/installer/CRC.java branches/jsxe2/installer/src/installer/ConsoleInstall.java branches/jsxe2/installer/src/installer/ConsoleProgress.java branches/jsxe2/installer/src/installer/Install.java branches/jsxe2/installer/src/installer/InstallThread.java branches/jsxe2/installer/src/installer/InvalidHeaderException.java branches/jsxe2/installer/src/installer/NonInteractiveInstall.java branches/jsxe2/installer/src/installer/OperatingSystem.java branches/jsxe2/installer/src/installer/Progress.java branches/jsxe2/installer/src/installer/SwingInstall.java branches/jsxe2/installer/src/installer/TarBuffer.java branches/jsxe2/installer/src/installer/TarEntry.java branches/jsxe2/installer/src/installer/TarHeader.java branches/jsxe2/installer/src/installer/TarInputStream.java branches/jsxe2/installer/src/installer/TarOutputStream.java branches/jsxe2/installer/src/installer/VariableGridLayout.java branches/jsxe2/jsxe.ico branches/jsxe2/launch4j.xml branches/jsxe2/messages/messages.properties branches/jsxe2/messages/messages_de.properties branches/jsxe2/messages/messages_ja.properties branches/jsxe2/messages/messages_ru.properties branches/jsxe2/messages/messages_sv.properties branches/jsxe2/src/net/sourceforge/jsxe/action/ContextSpecificAction.java branches/jsxe2/src/net/sourceforge/jsxe/action/RedoAction.java branches/jsxe2/src/net/sourceforge/jsxe/action/UndoAction.java branches/jsxe2/src/net/sourceforge/jsxe/dom/undo/ branches/jsxe2/src/net/sourceforge/jsxe/dom/undo/AddNodeChange.java branches/jsxe2/src/net/sourceforge/jsxe/dom/undo/AttributeChange.java branches/jsxe2/src/net/sourceforge/jsxe/dom/undo/InsertEdit.java branches/jsxe2/src/net/sourceforge/jsxe/dom/undo/NodeNameChange.java branches/jsxe2/src/net/sourceforge/jsxe/dom/undo/NodePrefixChange.java branches/jsxe2/src/net/sourceforge/jsxe/dom/undo/NodeValueChange.java branches/jsxe2/src/net/sourceforge/jsxe/dom/undo/RemoveEdit.java branches/jsxe2/src/net/sourceforge/jsxe/dom/undo/RemoveNodeChange.java branches/jsxe2/src/net/sourceforge/jsxe/gui/RolloverButton.java branches/jsxe2/src/net/sourceforge/jsxe/help/ branches/jsxe2/src/net/sourceforge/jsxe/help/HelpIndex.java branches/jsxe2/src/net/sourceforge/jsxe/help/HelpSearchPanel.java branches/jsxe2/src/net/sourceforge/jsxe/help/HelpTOCPanel.java branches/jsxe2/src/net/sourceforge/jsxe/help/HelpViewer.java branches/jsxe2/src/net/sourceforge/jsxe/icons/ArrowD.png branches/jsxe2/src/net/sourceforge/jsxe/icons/ArrowL.png branches/jsxe2/src/net/sourceforge/jsxe/icons/ArrowR.png branches/jsxe2/src/net/sourceforge/jsxe/icons/ArrowU.png branches/jsxe2/src/net/sourceforge/jsxe/msg/RedoEvent.java branches/jsxe2/src/net/sourceforge/jsxe/msg/UndoEvent.java Removed Paths: ------------- branches/jsxe2/buildlib/docbook/VERSION branches/jsxe2/buildlib/docbook/catalog.xml branches/jsxe2/buildlib/docbook/common/ branches/jsxe2/buildlib/docbook/common/ChangeLog branches/jsxe2/buildlib/docbook/common/af.xml branches/jsxe2/buildlib/docbook/common/ar.xml branches/jsxe2/buildlib/docbook/common/autoidx-ng.xsl branches/jsxe2/buildlib/docbook/common/bg.xml branches/jsxe2/buildlib/docbook/common/bn.xml branches/jsxe2/buildlib/docbook/common/bs.xml branches/jsxe2/buildlib/docbook/common/ca.xml branches/jsxe2/buildlib/docbook/common/common.xsl branches/jsxe2/buildlib/docbook/common/cs.xml branches/jsxe2/buildlib/docbook/common/da.xml branches/jsxe2/buildlib/docbook/common/de.xml branches/jsxe2/buildlib/docbook/common/el.xml branches/jsxe2/buildlib/docbook/common/en.xml branches/jsxe2/buildlib/docbook/common/es.xml branches/jsxe2/buildlib/docbook/common/et.xml branches/jsxe2/buildlib/docbook/common/eu.xml branches/jsxe2/buildlib/docbook/common/fa.xml branches/jsxe2/buildlib/docbook/common/fi.xml branches/jsxe2/buildlib/docbook/common/fr.xml branches/jsxe2/buildlib/docbook/common/gentext.xsl branches/jsxe2/buildlib/docbook/common/he.xml branches/jsxe2/buildlib/docbook/common/hr.xml branches/jsxe2/buildlib/docbook/common/hu.xml branches/jsxe2/buildlib/docbook/common/id.xml branches/jsxe2/buildlib/docbook/common/it.xml branches/jsxe2/buildlib/docbook/common/ja.xml branches/jsxe2/buildlib/docbook/common/ko.xml branches/jsxe2/buildlib/docbook/common/l10n.dtd branches/jsxe2/buildlib/docbook/common/l10n.xml branches/jsxe2/buildlib/docbook/common/l10n.xsl branches/jsxe2/buildlib/docbook/common/la.xml branches/jsxe2/buildlib/docbook/common/labels.xsl branches/jsxe2/buildlib/docbook/common/lt.xml branches/jsxe2/buildlib/docbook/common/nl.xml branches/jsxe2/buildlib/docbook/common/nn.xml branches/jsxe2/buildlib/docbook/common/no.xml branches/jsxe2/buildlib/docbook/common/olink.xsl branches/jsxe2/buildlib/docbook/common/pi.xsl branches/jsxe2/buildlib/docbook/common/pl.xml branches/jsxe2/buildlib/docbook/common/pt.xml branches/jsxe2/buildlib/docbook/common/pt_br.xml branches/jsxe2/buildlib/docbook/common/ro.xml branches/jsxe2/buildlib/docbook/common/ru.xml branches/jsxe2/buildlib/docbook/common/sk.xml branches/jsxe2/buildlib/docbook/common/sl.xml branches/jsxe2/buildlib/docbook/common/sr.xml branches/jsxe2/buildlib/docbook/common/sr_Latn.xml branches/jsxe2/buildlib/docbook/common/subtitles.xsl branches/jsxe2/buildlib/docbook/common/sv.xml branches/jsxe2/buildlib/docbook/common/table.xsl branches/jsxe2/buildlib/docbook/common/targetdatabase.dtd branches/jsxe2/buildlib/docbook/common/targets.xsl branches/jsxe2/buildlib/docbook/common/th.xml branches/jsxe2/buildlib/docbook/common/titles.xsl branches/jsxe2/buildlib/docbook/common/tr.xml branches/jsxe2/buildlib/docbook/common/uk.xml branches/jsxe2/buildlib/docbook/common/vi.xml branches/jsxe2/buildlib/docbook/common/xh.xml branches/jsxe2/buildlib/docbook/common/zh_cn.xml branches/jsxe2/buildlib/docbook/common/zh_tw.xml branches/jsxe2/buildlib/docbook/dtd/ branches/jsxe2/buildlib/docbook/dtd/calstblx.dtd branches/jsxe2/buildlib/docbook/dtd/catalog branches/jsxe2/buildlib/docbook/dtd/catalog.xml branches/jsxe2/buildlib/docbook/dtd/dbcentx.mod branches/jsxe2/buildlib/docbook/dtd/dbgenent.mod branches/jsxe2/buildlib/docbook/dtd/dbhierx.mod branches/jsxe2/buildlib/docbook/dtd/dbnotnx.mod branches/jsxe2/buildlib/docbook/dtd/dbpoolx.mod branches/jsxe2/buildlib/docbook/dtd/docbookx.dtd branches/jsxe2/buildlib/docbook/dtd/ent/ branches/jsxe2/buildlib/docbook/dtd/ent/ISOamsa.ent branches/jsxe2/buildlib/docbook/dtd/ent/ISOamsb.ent branches/jsxe2/buildlib/docbook/dtd/ent/ISOamsc.ent branches/jsxe2/buildlib/docbook/dtd/ent/ISOamsn.ent branches/jsxe2/buildlib/docbook/dtd/ent/ISOamso.ent branches/jsxe2/buildlib/docbook/dtd/ent/ISOamsr.ent branches/jsxe2/buildlib/docbook/dtd/ent/ISObox.ent branches/jsxe2/buildlib/docbook/dtd/ent/ISOcyr1.ent branches/jsxe2/buildlib/docbook/dtd/ent/ISOcyr2.ent branches/jsxe2/buildlib/docbook/dtd/ent/ISOdia.ent branches/jsxe2/buildlib/docbook/dtd/ent/ISOgrk1.ent branches/jsxe2/buildlib/docbook/dtd/ent/ISOgrk2.ent branches/jsxe2/buildlib/docbook/dtd/ent/ISOgrk3.ent branches/jsxe2/buildlib/docbook/dtd/ent/ISOgrk4.ent branches/jsxe2/buildlib/docbook/dtd/ent/ISOlat1.ent branches/jsxe2/buildlib/docbook/dtd/ent/ISOlat2.ent branches/jsxe2/buildlib/docbook/dtd/ent/ISOnum.ent branches/jsxe2/buildlib/docbook/dtd/ent/ISOpub.ent branches/jsxe2/buildlib/docbook/dtd/ent/ISOtech.ent branches/jsxe2/buildlib/docbook/dtd/ent/catalog branches/jsxe2/buildlib/docbook/dtd/ent/catalog.xml branches/jsxe2/buildlib/docbook/dtd/htmltblx.mod branches/jsxe2/buildlib/docbook/dtd/soextblx.dtd branches/jsxe2/buildlib/docbook/fo/ branches/jsxe2/buildlib/docbook/fo/ChangeLog branches/jsxe2/buildlib/docbook/fo/admon.xsl branches/jsxe2/buildlib/docbook/fo/autoidx-ng.xsl branches/jsxe2/buildlib/docbook/fo/autoidx.xsl branches/jsxe2/buildlib/docbook/fo/autotoc.xsl branches/jsxe2/buildlib/docbook/fo/axf.xsl branches/jsxe2/buildlib/docbook/fo/biblio.xsl branches/jsxe2/buildlib/docbook/fo/block.xsl branches/jsxe2/buildlib/docbook/fo/callout.xsl branches/jsxe2/buildlib/docbook/fo/component.xsl branches/jsxe2/buildlib/docbook/fo/division.xsl branches/jsxe2/buildlib/docbook/fo/docbook.xsl branches/jsxe2/buildlib/docbook/fo/docbookng.xsl branches/jsxe2/buildlib/docbook/fo/ebnf.xsl branches/jsxe2/buildlib/docbook/fo/fo-patch-for-fop.xsl branches/jsxe2/buildlib/docbook/fo/fo-rtf.xsl branches/jsxe2/buildlib/docbook/fo/fo.xsl branches/jsxe2/buildlib/docbook/fo/footnote.xsl branches/jsxe2/buildlib/docbook/fo/fop.xsl branches/jsxe2/buildlib/docbook/fo/formal.xsl branches/jsxe2/buildlib/docbook/fo/glossary.xsl branches/jsxe2/buildlib/docbook/fo/graphics.xsl branches/jsxe2/buildlib/docbook/fo/htmltbl.xsl branches/jsxe2/buildlib/docbook/fo/index.xsl branches/jsxe2/buildlib/docbook/fo/info.xsl branches/jsxe2/buildlib/docbook/fo/inline.xsl branches/jsxe2/buildlib/docbook/fo/keywords.xsl branches/jsxe2/buildlib/docbook/fo/lists.xsl branches/jsxe2/buildlib/docbook/fo/math.xsl branches/jsxe2/buildlib/docbook/fo/pagesetup.xsl branches/jsxe2/buildlib/docbook/fo/param.ent branches/jsxe2/buildlib/docbook/fo/param.xml branches/jsxe2/buildlib/docbook/fo/param.xsl branches/jsxe2/buildlib/docbook/fo/param.xweb branches/jsxe2/buildlib/docbook/fo/passivetex.xsl branches/jsxe2/buildlib/docbook/fo/pdf2index branches/jsxe2/buildlib/docbook/fo/pi.xsl branches/jsxe2/buildlib/docbook/fo/profile-docbook.xsl branches/jsxe2/buildlib/docbook/fo/qandaset.xsl branches/jsxe2/buildlib/docbook/fo/refentry.xsl branches/jsxe2/buildlib/docbook/fo/sections.xsl branches/jsxe2/buildlib/docbook/fo/synop.xsl branches/jsxe2/buildlib/docbook/fo/table.xsl branches/jsxe2/buildlib/docbook/fo/task.xsl branches/jsxe2/buildlib/docbook/fo/titlepage.templates.xml branches/jsxe2/buildlib/docbook/fo/titlepage.templates.xsl branches/jsxe2/buildlib/docbook/fo/titlepage.xsl branches/jsxe2/buildlib/docbook/fo/toc.xsl branches/jsxe2/buildlib/docbook/fo/verbatim.xsl branches/jsxe2/buildlib/docbook/fo/xep.xsl branches/jsxe2/buildlib/docbook/fo/xref.xsl branches/jsxe2/buildlib/docbook/html/ branches/jsxe2/buildlib/docbook/html/ChangeLog branches/jsxe2/buildlib/docbook/html/admon.xsl branches/jsxe2/buildlib/docbook/html/autoidx-ng.xsl branches/jsxe2/buildlib/docbook/html/autoidx.xsl branches/jsxe2/buildlib/docbook/html/autotoc.xsl branches/jsxe2/buildlib/docbook/html/biblio.xsl branches/jsxe2/buildlib/docbook/html/block.xsl branches/jsxe2/buildlib/docbook/html/callout.xsl branches/jsxe2/buildlib/docbook/html/changebars.xsl branches/jsxe2/buildlib/docbook/html/chunk-code.xsl branches/jsxe2/buildlib/docbook/html/chunk-common.xsl branches/jsxe2/buildlib/docbook/html/chunk.xsl branches/jsxe2/buildlib/docbook/html/chunker.xsl branches/jsxe2/buildlib/docbook/html/chunkfast.xsl branches/jsxe2/buildlib/docbook/html/chunktoc.xsl branches/jsxe2/buildlib/docbook/html/component.xsl branches/jsxe2/buildlib/docbook/html/division.xsl branches/jsxe2/buildlib/docbook/html/docbook.xsl branches/jsxe2/buildlib/docbook/html/docbookng.xsl branches/jsxe2/buildlib/docbook/html/ebnf.xsl branches/jsxe2/buildlib/docbook/html/footnote.xsl branches/jsxe2/buildlib/docbook/html/formal.xsl branches/jsxe2/buildlib/docbook/html/glossary.xsl branches/jsxe2/buildlib/docbook/html/graphics.xsl branches/jsxe2/buildlib/docbook/html/html-rtf.xsl branches/jsxe2/buildlib/docbook/html/html.xsl branches/jsxe2/buildlib/docbook/html/htmltbl.xsl branches/jsxe2/buildlib/docbook/html/index.xsl branches/jsxe2/buildlib/docbook/html/info.xsl branches/jsxe2/buildlib/docbook/html/inline.xsl branches/jsxe2/buildlib/docbook/html/keywords.xsl branches/jsxe2/buildlib/docbook/html/lists.xsl branches/jsxe2/buildlib/docbook/html/maketoc.xsl branches/jsxe2/buildlib/docbook/html/manifest.xsl branches/jsxe2/buildlib/docbook/html/math.xsl branches/jsxe2/buildlib/docbook/html/oldchunker.xsl branches/jsxe2/buildlib/docbook/html/onechunk.xsl branches/jsxe2/buildlib/docbook/html/param.ent branches/jsxe2/buildlib/docbook/html/param.xml branches/jsxe2/buildlib/docbook/html/param.xsl branches/jsxe2/buildlib/docbook/html/param.xweb branches/jsxe2/buildlib/docbook/html/pi.xsl branches/jsxe2/buildlib/docbook/html/profile-chunk-code.xsl branches/jsxe2/buildlib/docbook/html/profile-chunk.xsl branches/jsxe2/buildlib/docbook/html/profile-docbook.xsl branches/jsxe2/buildlib/docbook/html/profile-onechunk.xsl branches/jsxe2/buildlib/docbook/html/qandaset.xsl branches/jsxe2/buildlib/docbook/html/refentry.xsl branches/jsxe2/buildlib/docbook/html/sections.xsl branches/jsxe2/buildlib/docbook/html/synop.xsl branches/jsxe2/buildlib/docbook/html/table.xsl branches/jsxe2/buildlib/docbook/html/task.xsl branches/jsxe2/buildlib/docbook/html/titlepage.templates.xml branches/jsxe2/buildlib/docbook/html/titlepage.templates.xsl branches/jsxe2/buildlib/docbook/html/titlepage.xsl branches/jsxe2/buildlib/docbook/html/toc.xsl branches/jsxe2/buildlib/docbook/html/verbatim.xsl branches/jsxe2/buildlib/docbook/html/xref.xsl branches/jsxe2/buildlib/docbook/lib/ branches/jsxe2/buildlib/docbook/lib/ChangeLog branches/jsxe2/buildlib/docbook/lib/lib.xml branches/jsxe2/buildlib/docbook/lib/lib.xsl branches/jsxe2/buildlib/docbook/lib/lib.xweb branches/jsxe2/buildlib/jsmoothgen-ant.jar branches/jsxe2/buildlib/skeletons/ branches/jsxe2/doc/manual/ branches/jsxe2/doc/manual/manual.xml branches/jsxe2/installer/done-HalfAnOS.html branches/jsxe2/installer/done-MacOS.html branches/jsxe2/installer/done-Unix.html branches/jsxe2/installer/done-VMS.html branches/jsxe2/installer/done-Windows.html branches/jsxe2/installer/gpl.html branches/jsxe2/installer/jsxe-installer.ico branches/jsxe2/installer/jsxe.desktop branches/jsxe2/installer/jsxe.png branches/jsxe2/installer/launch4j.xml branches/jsxe2/installer/readme.html branches/jsxe2/installer/src/ branches/jsxe2/installer/src/installer/ branches/jsxe2/installer/src/installer/BZip2Constants.java branches/jsxe2/installer/src/installer/CBZip2InputStream.java branches/jsxe2/installer/src/installer/CBZip2OutputStream.java branches/jsxe2/installer/src/installer/CRC.java branches/jsxe2/installer/src/installer/ConsoleInstall.java branches/jsxe2/installer/src/installer/ConsoleProgress.java branches/jsxe2/installer/src/installer/Install.java branches/jsxe2/installer/src/installer/InstallThread.java branches/jsxe2/installer/src/installer/InvalidHeaderException.java branches/jsxe2/installer/src/installer/NonInteractiveInstall.java branches/jsxe2/installer/src/installer/OperatingSystem.java branches/jsxe2/installer/src/installer/Progress.java branches/jsxe2/installer/src/installer/SwingInstall.java branches/jsxe2/installer/src/installer/TarBuffer.java branches/jsxe2/installer/src/installer/TarEntry.java branches/jsxe2/installer/src/installer/TarHeader.java branches/jsxe2/installer/src/installer/TarInputStream.java branches/jsxe2/installer/src/installer/TarOutputStream.java branches/jsxe2/installer/src/installer/VariableGridLayout.java branches/jsxe2/jsXe.jsmooth branches/jsxe2/messages/messages branches/jsxe2/messages/messages.de branches/jsxe2/messages/messages.ja branches/jsxe2/messages/messages.sv branches/jsxe2/src/net/sourceforge/jsxe/dom/undo/AddNodeChange.java branches/jsxe2/src/net/sourceforge/jsxe/dom/undo/AttributeChange.java branches/jsxe2/src/net/sourceforge/jsxe/dom/undo/InsertEdit.java branches/jsxe2/src/net/sourceforge/jsxe/dom/undo/NodeNameChange.java branches/jsxe2/src/net/sourceforge/jsxe/dom/undo/NodePrefixChange.java branches/jsxe2/src/net/sourceforge/jsxe/dom/undo/NodeValueChange.java branches/jsxe2/src/net/sourceforge/jsxe/dom/undo/RemoveEdit.java branches/jsxe2/src/net/sourceforge/jsxe/dom/undo/RemoveNodeChange.java branches/jsxe2/src/net/sourceforge/jsxe/help/HelpIndex.java branches/jsxe2/src/net/sourceforge/jsxe/help/HelpSearchPanel.java branches/jsxe2/src/net/sourceforge/jsxe/help/HelpTOCPanel.java branches/jsxe2/src/net/sourceforge/jsxe/help/HelpViewer.java Modified: branches/jsxe2/AUTHORS =================================================================== --- branches/jsxe2/AUTHORS 2006-09-05 15:47:20 UTC (rev 1234) +++ branches/jsxe2/AUTHORS 2006-09-05 15:47:51 UTC (rev 1235) @@ -4,7 +4,7 @@ Translators: German (de) - Bianca Schoen Swedish (sv) - Patrik Johansson <pa...@it...> + Russian (ru) - Alexandr Gridnev <ale...@ya...> Past Contributers:\n\ Aaron Flatten <afl...@us...> - Bilel Remmache <rb...@us...> - SVM <svm...@us...> + Bilel Remmache <rb...@us...> \ No newline at end of file Modified: branches/jsxe2/Changelog =================================================================== --- branches/jsxe2/Changelog 2006-09-05 15:47:20 UTC (rev 1234) +++ branches/jsxe2/Changelog 2006-09-05 15:47:51 UTC (rev 1235) @@ -1,10 +1,82 @@ +08/31/2006 Ian Lewis <Ian...@me...> + + * Added new ContextSpecificActions to replace ViewSpecificActions. Now + actions such as cut and paste can be registered for specific components + not just a specific view. + +08/29/2006 Ian Lewis <Ian...@me...> + + * Fixed a memory leak with JMenuItems. ActionManager kept a cache of + Wrapper Action objects. JMenu items register listeners with those Actions + so the JMenuItems would never be Garbage collected. + * Fixed that the Find action had Ctrl-v as the default shortcut. Changed it + to Ctrl-f + +08/28/2006 Ian Lewis <Ian...@me...> + + * Changed the messages files to be named the standard ResourceBundle way. + * Fixed default key binding for exit. + * Added some new processing for generating jsXe's manual. + +08/27/2006 Ian Lewis <Ian...@me...> + + * Updated the launch4j script to set the absolute path of the lib directory + in the jre option to set the endorsed dirs. This will allow jsXe to be + launched from anywhere and still be able to find the right version of + Xerces. + * Updated the installer to create a script file in unix that uses the java + in the environment path and use the HotSpot server so that jsXe runs + faster at the cost of startup time and memory footprint. + * Added an option to display the full path to a file in the recent files + menu. Feature Request #1546371 + +08/21/2006 Ian Lewis <Ian...@me...> + + * Updated russian translation. + +08/18/2006 Ian Lewis <Ian...@me...> + + * Added a hack to disable view specific actions that aren't implemented by + the view. + +08/17/2006 Ian Lewis <Ian...@me...> + + * Updated the German translation thanks to Dieter Steiner + +08/12/2006 Ian Lewis <Ian...@me...> + + * Added support for running jsXe in a wrapped exe using launch4j. + * Added an installer for jsXe. The installer can be packaged in an exe for + easy use by windows users. + * Moved the windows integration into it's own component in the installer so + that it won't be installed on systems other than Windows. + +08/09/2006 Ian Lewis <Ian...@me...> + + * Added a new option to the Global Options dialog for the number of undo + operations to remember. + +08/08/2006 Ian Lewis <Ian...@me...> + + * Added undo/redo support for attributes. + 08/07/2006 Ian Lewis <Ian...@me...> + * Added temporary support for undo to jsXe. + * Added support for undo of text insert and delete. + * Added support for undo of changes to a node's name, value, and prefix. * Removed get/setStringProperty methods from XMLDocument since they aren't needed +08/05/2006 Ian Lewis <Ian...@me...> + + * Added core support for Undo/Redo. Undo/Redo will temporarily be view + specific. Eventually it will be entirely part of core after the + new data model is complete. + 08/03/2006 Ian Lewis <Ian...@me...> + * Added Russian translation thanks to Alexandr Gridnev. * More porting of jEdit's VFS classes to jsXe 07/29/2006 Ian Lewis <Ian...@me...> Modified: branches/jsxe2/INSTALL =================================================================== --- branches/jsxe2/INSTALL 2006-09-05 15:47:20 UTC (rev 1234) +++ branches/jsxe2/INSTALL 2006-09-05 15:47:51 UTC (rev 1235) @@ -1,7 +1,9 @@ REQUIREMENTS -Java 1.4.2 -Xerces 2.6.2 +Java >= 1.4.2 +Xerces >= 2.8.0 +Xalan >= 2.7.0 (for building jsXe's documentation) +launch4j >= 3.0.0pre1 (for building the installer from source) GETTING jsXe @@ -13,17 +15,32 @@ Once you have the source trees for both of these you should put them in a directory called 'jars' in your jsXe root folder. Once they are in that folder, the ant targets (compile, bin, src, etc.) will recognise those plugins and build -them if necessary. So something like this should do it: +them if necessary. -cvs checkout jsxe +You should check out jsxe to make a structure like this. This ensures that +when compiling jsXe the other views and will be compiled as well. It also +ensures that you can build jsxe's installer in binary release distributions. + +jsxe module => jsxe/ +treeview module (optional) => jsxe/jars/treeview +sourceview module (optional) => jsxe/jars/sourceview +jsxe installer (optional) => jsxe/installer +jsxe web module (optional) => web/ +launch4j (needed for win builds) => buildlib/launch4j + +So something like this should do it: + +svn checkout https://svn.sourceforge.net/svnroot/jsxe/trunk/jsxe cd jsxe mkdir jars cd jars -cvs checkout treeview -cvs checkout sourceview +svn checkout https://svn.sourceforge.net/svnroot/jsxe/trunk/treeview +svn checkout https://svn.sourceforge.net/svnroot/jsxe/trunk/sourceview BUILDING jsXe FROM SOURCE +** Requirements ** + This is pretty simple. You will need jakarta ANT and a Sun's javac compiler (others might work, I just haven't tested them). You will need the optional ant tasks installed as well. On some Linux distributions this may be a separate @@ -34,32 +51,56 @@ Xerces (A Xerces 2.8.0 binary distribution is not included in the CVS source tree. You can aquire it at at http://xml.apache.org/) The jar files xercesImpl.jar, xml-apis.jar, and resolver.jar from the 2.8.0 distribution are -required. These should be placed in a directory called lib in jsXe's root folder -(where you installed jsXe's source) or in the jre/lib/ext or lib/ext in your -JVM. These jar files will be included with jsXe distributions for convenience. +required. These should already be in a directory called lib in jsXe's root folder +(where you installed jsXe's source) but you will need to copy them in +the jre/lib/endorsed directory in your JVM. You will also need to put the +xalan.jar in the jre/lib/endorsed directory in order to build jsXe's +documentation. xalan.jar is not currently included with jsXe so you need to +download it from http://xml.apache.org/ -Simply typing 'ant' in jsXe's root directory will give you the +In order to build jsXe's installer or a windows distribution of jsXe you will +need to install launch4j (http://launch4j.sourceforge.net/). You can install it +in the buildlib directory or change the launch4j.dir property in the build.xml +file. You will also need to put the js.jar and bsf.jar in your classpath. These +files are found in the 'buildlib' directory. They are used in scripts for +calculating file sizes. + +** Building ** + +Simply typing 'ant -p' in jsXe's root directory will give you the available targets to use with ant. To just simply compile jsXe and the default views to a jar file you can type 'ant compile'. To build a binary distribution you will need to run the 'bin' target in the build.xml file. I do this by simply typing 'ant bin'. Source distributions can be built using the 'src' target by typing 'ant src'. +You can build jsXe's installer by running 'ant build-installer' which will +build jsXe's installer. The installer will be packaged in a jar file to be run +by java. + +You can build a windows distribution of jsXe by running the 'ant win'. This will +compile jsXe's installer and wrap it in an exe wrapper. The wrapper will search +for the appropriate java runtime with which to run jsXe. + INSTALLING jsXe Unpack the distribution file wherever you like. Normally you would install it in C:\Program Files\ or /usr/local/share/ or something like that. +Or + +Run the install program and follow the prompts to install jsXe. + RUNNING jsXe -You should have 1.4.2 or better of java and you need 2.6.2 of Xerces. +You should have 1.4.2 or better of java and you need 2.8.0 of Xerces. *Windows* Just run jsXe using the jsXe.exe in the install directory. The exe will detect your version of Java and run jsXe using that version. -*Unix* +*Unix/Linux* To run jsXe you should just run the java interpreter on the jsXe.jar file. There is a shell script or batch file included in the source tree for this purpose. Modified: branches/jsxe2/README =================================================================== --- branches/jsxe2/README 2006-09-05 15:47:20 UTC (rev 1234) +++ branches/jsxe2/README 2006-09-05 15:47:51 UTC (rev 1235) @@ -7,3 +7,22 @@ way of creating XML documents. It is geared towards simpler XML documents but will (eventually) be able to handle any XML document. Visit http://jsxe.sourceforge.net/ to learn more about this project. + +jsXe bundles the following libraries: + +- Xerces Java 2.8.0 is a XML parsing library released by the Apache foundation. + This library is released under the Apache license, which can be found at + http://www.apache.org/licenses/LICENSE-2.0 + +The jsXe installer bundles the following libraries: + +- org.apache.excalibur.bzip2 compression library. This library is + released under the Apache license, which can be found at + http://www.apache.org/licenses/LICENSE-2.0 + + The org.apache.excalibur.bzip2 web site is + <http://jakarta.apache.org/avalon/excalibur/bzip2/>. + +- com.ice.tar, by Tim Endres. This code is in the public domain. + + The com.ice.tar web site is <http://www.trustice.com/java/tar/>. \ No newline at end of file Modified: branches/jsxe2/bin/jsXe.bat =================================================================== --- branches/jsxe2/bin/jsXe.bat 2006-09-05 15:47:20 UTC (rev 1234) +++ branches/jsxe2/bin/jsXe.bat 2006-09-05 15:47:51 UTC (rev 1235) @@ -1,7 +1,7 @@ @ECHO OFF set JSXEDIR=. -set CLASSPATH=%JSXEDIR%/jsXe.jar;%JSXEDIR%/lib/xml-apis.jar;%JSXEDIR%/lib/xercesImpl.jar;%JSXEDIR%/lib/resolver.jar -set JSXE=net.sourceforge.jsxe.jsXe +rem set CLASSPATH=%JSXEDIR%/jsXe.jar;%JSXEDIR%/lib/xml-apis.jar;%JSXEDIR%/lib/xercesImpl.jar;%JSXEDIR%/lib/resolver.jar +rem set JSXE=net.sourceforge.jsxe.jsXe set JAVA_HEAP_SIZE=32 -java -mx%JAVA_HEAP_SIZE%m -cp %CLASSPATH% %JSXE% %1 %2 %3 %4 %5 %6 %7 %8 %9 -if errorlevel 1 pause +javaw -server -mx%JAVA_HEAP_SIZE%m -Djava.endorsed.dirs=%JSXEDIR%/lib -jar %JSXEDIR%/jsXe.jar %1 %2 %3 %4 %5 %6 %7 %8 %9 +if errorlevel 1 pause \ No newline at end of file Modified: branches/jsxe2/bin/jsXe.sh =================================================================== --- branches/jsxe2/bin/jsXe.sh 2006-09-05 15:47:20 UTC (rev 1234) +++ branches/jsxe2/bin/jsXe.sh 2006-09-05 15:47:51 UTC (rev 1235) @@ -1,6 +1,5 @@ #!/bin/sh +# Java heap size, in megabytes JSXEDIR=. -CLASSPATH=$JSXEDIR/jsXe.jar:$JSXEDIR/lib/xml-apis.jar:$JSXEDIR/lib/xercesImpl.jar:$JSXEDIR/lib/resolver.jar -JSXE=net.sourceforge.jsxe.jsXe JAVA_HEAP_SIZE=32 -exec java -mx${JAVA_HEAP_SIZE}m -cp $CLASSPATH $JSXE $@ +exec java -server -mx${JAVA_HEAP_SIZE}m -Djava.endorsed.dirs=${JSXEDIR}/lib ${JSXE} -jar ${JSXEDIR}/jsXe.jar $@ \ No newline at end of file Modified: branches/jsxe2/build.xml =================================================================== --- branches/jsxe2/build.xml 2006-09-05 15:47:20 UTC (rev 1234) +++ branches/jsxe2/build.xml 2006-09-05 15:47:51 UTC (rev 1235) @@ -7,23 +7,38 @@ Version: $Id$ You should check out jsxe to make a structure like this. This ensures that - when compiling jsXe the other views will be compiled as well. + when compiling jsXe the other views and will be compiled as well. It also + ensures that you can build jsxe's installer in binary release distributions. jsxe module => jsxe/ treeview module (optional) => jsxe/jars/treeview sourceview module (optional) => jsxe/jars/sourceview + jsxe installer (optional) => jsxe/installer jsxe web module (optional) => web/ - jsmooth ant task (optional) => buildlib/ + launch4j (needed for win builds) => buildlib/launch4j --> -<project basedir="." default="usage" name="jsXe"> +<project basedir="." default="compile" name="jsXe"> <description>jsXe - Java Simple XML Editor</description> <!-- {{{ ============ Initializes properties and variables ============= --> <target name="init"> <tstamp/> + <!-- {{{ app/build properties --> <property name="app.name" value="jsXe"/> + <property name="main.class" value="net.sourceforge.jsxe.jsXe"/> + <property name="major.version" value="0"/> + <property name="minor.version" value="5"/> + <property name="beta.version" value="4"/> + <property name="bugfix.version" value="0"/> + <property name="date.format" value="MM.dd.yyyy HH:mm:ss z"/> + <!-- Human Readable --> + <property name="app.version" value="0.5 pre4"/> + <!-- Used in filenames --> + <property name="app_version" value="05_pre4"/> + <!-- }}} --> + <!-- {{{ build directories --> <property name="root.dir" value="."/> <property name="build.dir" value="${root.dir}/build"/> <property name="src.dir" value="${root.dir}/src"/> @@ -31,47 +46,120 @@ <property name="bin.dir" value="${root.dir}/bin"/> <property name="messages.dir" value="${root.dir}/messages"/> <property name="build.messages" value="${build.dir}/messages"/> - <property name="docs.dir" value="${src.dir}/doc"/> + <property name="docs.dir" value="${root.dir}/doc"/> <property name="plugin.dir" value="${root.dir}/jars"/> + <property name="jsxe.jar" value="${build.dir}/${app.name}.jar"/> + <!-- jar file needs to be relative to the exe --> + <property name="launch4j.jsxe.jar" value="${app.name}.jar"/> + <property name="jsxe.exe" value="${build.dir}/${app.name}.exe"/> + <!-- launch4j doesn't like the ./ in the front of the path --> + <property name="launch4j.jsxe.exe" value="build/${app.name}.exe"/> <property name="build.plugin" value="${build.dir}/jars"/> <property name="build.src" value="${build.dir}/src"/> <property name="build.dest" value="${build.dir}/classes"/> <property name="build.docs" value="${build.dir}/doc"/> <property name="build.lib" value="${build.dir}/lib"/> <property name="build.bin" value="${build.dir}/bin"/> - <property name="date.format" value="MM.dd.yyyy HH:mm:ss z"/> - <property name="build.javadocs" value="${build.docs}/api"/> + <property name="build.javadocs" value="${build.dir}/api"/> <property name="build.help" value="${build.docs}/help"/> + <property name="buildlib.dir" value="${root.dir}/buildlib"/> + <property name="docbook.dir" value="${buildlib.dir}/docbook"/> + <!--<property name="app.version" value="${major.version}.${minor.version} beta"/>--> + <!--<property name="app_version" value="${major.version}_${minor.version}beta"/>--> + <property name="distbin.dir" value="${build.dir}/${app.name}-${app_version}-bin"/> + <property name="distsrc.dir" value="${build.dir}/${app.name}-${app_version}-src"/> + <property name="launch4j.dir" value="${buildlib.dir}/launch4j"/> + <property name="launch4j.config" value="${root.dir}/launch4j.xml"/> + <property name="launch4j.classpath" value="${launch4j.dir}/launch4j.jar:${launch4j.dir}/lib/xstream.jar"/> + <!-- }}} --> + <!-- {{{ installer directories --> + <property name="installer.build.dir" value="${build.dir}/installer"/> + <property name="installer.program.dir" value="${installer.build.dir}/program"/> + <property name="installer.api.dir" value="${installer.build.dir}/api"/> + <property name="installer.treeview.dir" value="${installer.build.dir}/treeview"/> + <property name="installer.sourceview.dir" value="${installer.build.dir}/sourceview"/> + <property name="installer.win.dir" value="${installer.build.dir}/win"/> + <property name="installer.gnome.dir" value="${installer.build.dir}/gnome"/> + <property name="installer.build.src" value="${installer.build.dir}/src"/> + <property name="installer.build.dest" value="${installer.build.dir}/build"/> + <property name="install.props" value="${installer.build.dest}/installer/install.props"/> + <property name="installer.dir" value="${root.dir}/installer"/> + <property name="installer.launch4j.config" value="${installer.dir}/launch4j.xml"/> + <!-- launch4j doesn't like the ./ in the front of the path --> + <property name="installer.jar" value="build/${app.name}-${app_version}-install.jar"/> + <property name="installer.exe" value="build/${app.name}-${app_version}-install.exe"/> + <!-- }}} --> + <!-- {{{ installer props --> + <property name="installer.main.class" value="installer.Install"/> + + <!-- files listed here are in the ${installer.dir} directory --> + <!-- TODO: labels should be put into a locale specific messages file --> + <property name="app.readme" value="readme.html"/> + <property name="app.license.title" value="GNU General Public License"/> + <property name="app.license" value="gpl.html"/> + <property name="ostask.unix-script.label" value="Install shortcut in:"/> + <property name="ostask.unix-man.label" value="Install manual page in:"/> + <property name="ostask.unix-desktop.label" value="Install desktop launchers in:"/> + <property name="ostask.unix-desktop.shortcut" value="jsxe.desktop"/> + <property name="ostask.unix-desktop.pixmap" value="jsxe.png"/> + + <!--<property name="ostask.unix-man.manpage" value="jsxe.1"/>--> + <property name="comp.count" value="5"/> + + <property name="comp.0.name" value="jsXe XML Editor"/> + <!-- size values are set by the filesize task in the + build-installer task --> + <!--<property name="comp.0.disk-size" value="7084"/> + <property name="comp.0.real-size" value="6073"/>--> + <property name="comp.0.fileset" value="jsxe-program"/> + <property name="installer.build.program.tar" value="${installer.build.dest}/installer/${comp.0.fileset}.tar.bz2"/> + + <property name="comp.1.name" value="Tree view (highly recommended)"/> + <!-- size values are set by the filesize task in the + build-installer task --> + <!--<property name="comp.1.disk-size" value="7084"/> + <property name="comp.1.real-size" value="6073"/>--> + <property name="comp.1.fileset" value="jsxe-treeview"/> + <property name="installer.build.treeview.tar" value="${installer.build.dest}/installer/${comp.1.fileset}.tar.bz2"/> + + <property name="comp.2.name" value="Source view (highly recommended)"/> + <!-- size values are set by the filesize task in the + build-installer task --> + <!--<property name="comp.2.disk-size" value="7084"/> + <property name="comp.2.real-size" value="6073"/>--> + <property name="comp.2.fileset" value="jsxe-sourceview"/> + <property name="installer.build.sourceview.tar" value="${installer.build.dest}/installer/${comp.2.fileset}.tar.bz2"/> + + <property name="comp.3.name" value="API documentation (for plugin development)"/> + <!-- size values are set by the filesize task in the + build-installer task --> + <!--<property name="comp.3.disk-size" value="7084"/> + <property name="comp.3.real-size" value="6073"/>--> + <property name="comp.3.fileset" value="jsxe-api"/> + <property name="installer.build.api.tar" value="${installer.build.dest}/installer/${comp.3.fileset}.tar.bz2"/> + + <property name="comp.4.name" value="Windows Integration (highly recommended)"/> + <!-- size values are set by the filesize task in the + build-installer task --> + <!--<property name="comp.4.disk-size" value="7084"/> + <property name="comp.4.real-size" value="6073"/>--> + <property name="comp.4.fileset" value="jsxe-win"/> + <property name="comp.4.os" value="Windows"/> + <property name="installer.build.win.tar" value="${installer.build.dest}/installer/${comp.4.fileset}.tar.bz2"/> + <!-- }}} --> + <!-- {{{ java build properties --> <property name="javac.debug" value="on"/> <property name="javac.optimize" value="off"/> <property name="javac.deprecation" value="on"/> <property name="javac.include.runtime" value="no"/> <property name="javac.source" value="1.3"/> + <!-- }}} --> + <!-- {{{ doc properties --> <property name="java.javadoc.link" value="http://java.sun.com/j2se/1.3/docs/api/"/> <property name="xerces.javadoc.link" value="http://xerces.apache.org/xerces2-j/javadocs/api/"/> - <property name="main.class" value="net.sourceforge.jsxe.jsXe"/> - <property name="major.version" value="0"/> - <property name="minor.version" value="5"/> - <property name="beta.version" value="3"/> - <property name="bugfix.version" value="0"/> - <!-- Human Readable --> - <property name="app.version" value="0.5 pre3"/> - <!-- Used in filenames --> - <property name="app_version" value="05_pre3"/> + <!-- }}} --> - <property name="buildlib.dir" value="${root.dir}/buildlib"/> - <property name="jsmooth.project" value="${root.dir}/jsXe.jsmooth"/> - <property name="jsmooth.jar" value="${buildlib.dir}/jsmoothgen-ant.jar"/> - - <condition property="windows.build"> - <and> - <os family="windows"/> - <available file="${jsmooth.jar}" property="jsmooth.avail"/> - </and> - </condition> - - <property name="distbin.dir" value="${build.dir}/${app.name}-${app_version}-bin"/> - <property name="distsrc.dir" value="${build.dir}/${app.name}-${app_version}-src"/> + <!-- {{{ classpaths --> <path id="classpath"> <pathelement location="."/> <pathelement location="${build.dest}"/> @@ -83,38 +171,41 @@ </path> <path id="run-classpath"> - <pathelement location="${build.dir}/${app.name}.jar"/> + <pathelement location="${jsxe.jar}"/> <fileset dir="${lib.dir}"> <include name="**/*.jar"/> </fileset> </path> + <!-- }}} --> + <!-- {{{ conditionals --> + <!-- set whether we have the source for the default views --> + + <available file="${root.dir}/../web" property="web.avail"/> + <available file="${plugin.dir}" property="plugin.avail"/> <available file="${plugin.dir}/treeview/build.xml" property="treeview.avail"/> <available file="${plugin.dir}/sourceview/build.xml" property="sourceview.avail"/> - <available file="${root.dir}/../web" property="web.avail"/> - <available file="${plugin.dir}" property="plugin.avail"/> + <available file="${launch4j.dir}" property="launch4j.avail"/> + <available classname="org.apache.bsf.BSFException" property="bsf.avail"/> + <available classname="org.mozilla.javascript.JavaScriptException" property="js.avail"/> + <available file="${installer.dir}" property="installer.avail"/> + <!-- }}} --> + + <!-- {{{ catalog used for building docs --> + <xmlcatalog id="docbook-catalog"> + <catalogpath> + <fileset dir="${docbook.dir}" includes="**/catalog.xml"/> + </catalogpath> + </xmlcatalog> + <!-- }}} --> + <echo message="${app.name} ${app.version}"/> <echo message="----------------------------------------------------------"/> </target> <!-- }}} --> - <!-- {{{ ============ Prints the available targets ===================== --> - <target depends="init" name="usage" description="Prints available targets"> - <echo message=" available targets are:"/> - <echo message=""/> - <echo message=" compile --> generates the ${app.name}.jar file."/> - <echo message=" also generates the jars for the tree view"/> - <echo message=" and source view plugins if available."/> - <echo message=" bin --> generates a binary distribution"/> - <echo message=" src --> generates a source distribution"/> - <echo message=" doc --> generates all documentation"/> - <echo message=" also updates the web api if the web module"/> - <echo message=" is available."/> - <echo message=" clean --> cleans everything up"/> - </target> - <!-- }}} --> <!-- {{{ ============ Prepares for any type of build =================== --> <target depends="init" name="prepare"> <mkdir dir="${build.dir}"/> @@ -141,8 +232,7 @@ <include name="**/*.png"/> <!-- files in the source directory to ignore --> - <!--<exclude name="net/sourceforge/jsxe/dom2/**/*"/> - <exclude name="net/sourceforge/jsxe/io/**/*"/>--> + <exclude name="net/sourceforge/jsxe/help/**/*"/> </fileset> </copy> <mkdir dir="${build.plugin}"/> @@ -174,6 +264,7 @@ <classpath refid="classpath"/> <include name="**/*.java"/> </javac> + <copy todir="${build.dest}"> <fileset dir="${build.src}"> <include name="**/*.props"/> @@ -187,6 +278,15 @@ </fileset> </copy> + <!-- copy the lib directory so that the jsXe.exe can be run + from the build dir --> + <mkdir dir="${build.lib}"/> + <copy todir="${build.lib}"> + <fileset dir="${lib.dir}"> + <include name="**/*"/> + </fileset> + </copy> + <!-- set the build properties --> <propertyfile comment="${app.name}'s build properties" file="${build.dest}/net/sourceforge/jsxe/build.properties"> <entry key="application.name" value="${app.name}"/> @@ -207,7 +307,7 @@ </section> </manifest> - <jar jarfile="${build.dir}/${app.name}.jar" manifest="${build.dir}/${app.name}.manifest"> + <jar jarfile="${jsxe.jar}" manifest="${build.dir}/${app.name}.manifest"> <fileset dir="${build.dest}"> <include name="**/*.class"/> <include name="**/properties"/> @@ -249,13 +349,6 @@ <!-- }}} --> <!-- {{{ ============ Prepares for a build ============================= --> <target depends="init" name="prepare-build"> - <!-- lib --> - <mkdir dir="${build.dir}/lib"/> - <copy todir="${build.dir}/lib"> - <fileset dir="${lib.dir}"> - <include name="**/*"/> - </fileset> - </copy> <!-- bin --> <mkdir dir="${build.dir}/bin"/> <copy todir="${build.dir}/bin"> @@ -267,6 +360,14 @@ <!-- }}} --> <!-- {{{ ============ Generates the documentation ====================== --> <target depends="prepare-doc, prepare-src" name="doc" description="Build documentation"> + <taskdef name="fop" classname="org.apache.fop.tools.anttasks.Fop"> + <classpath> + <pathelement location="${buildlib.dir}\fop.jar"/> + <pathelement location="${buildlib.dir}\avalon.jar"/> + <pathelement location="${buildlib.dir}\batik.jar"/> + </classpath> + </taskdef> + <copy file="${root.dir}/COPYING" tofile="${build.docs}/COPYING"/> <copy file="${root.dir}/README" tofile="${build.docs}/README"/> <copy file="${root.dir}/AUTHORS" tofile="${build.docs}/AUTHORS"/> @@ -276,17 +377,363 @@ <copy file="${root.dir}/THANKS" tofile="${build.docs}/THANKS"/> <copy file="${root.dir}/NEWS" tofile="${build.docs}/NEWS"/> + <!-- generate the html manual --> + <!-- + <mkdir dir="${build.docs}/manual"/> + <xslt basedir="${docs.dir}/manual" + destdir="${build.docs}/manual" + includes="**/manual.xml" + style="${docbook.dir}/html/docbook.xsl"> + <outputproperty name="encoding" value="UTF-8"/> + <mapper type="glob" from="*.xml" to="*.html"/> + <xmlcatalog refid="docbook-catalog"/> + </xslt> + --> + + <!-- generate the pdf manual --> + <!-- + <mkdir dir="${build.dir}/manual"/> + <xslt basedir="${docs.dir}/manual" + destdir="${build.dir}/manual" + includes="**/manual.xml" + style="${docbook.dir}/fo/docbook.xsl"> + <outputproperty name="encoding" value="UTF-8"/> + <mapper type="glob" from="*.xml" to="*.fo"/> + <xmlcatalog refid="docbook-catalog"/> + </xslt> + + <fop format="application/pdf" + outdir="${build.dir}" + messagelevel="warn"> + <fileset dir="${build.dir}/manual"> + <include name="*.fo"/> + </fileset> + </fop> + --> + <javadoc author="true" destdir="${build.javadocs}" doctitle="${app.name} ${app.version} API" locale="en_US" packagenames="*" sourcepath="${build.src}" version="true" windowtitle="${app.name} ${app.version} API"> <link href="${java.javadoc.link}"/> <link href="${xerces.javadoc.link}"/> - </javadoc> + </javadoc> - <zip basedir="${build.docs}" includes="api/**" zipfile="${build.dir}/${app.name}-${app_version}-api... [truncated message content] |
From: <ian...@us...> - 2006-09-07 02:33:22
|
Revision: 1250 http://svn.sourceforge.net/jsxe/?rev=1250&view=rev Author: ian_lewis Date: 2006-09-06 19:33:14 -0700 (Wed, 06 Sep 2006) Log Message: ----------- Added more synchronization support to AdapterNode Modified Paths: -------------- branches/jsxe2/Changelog branches/jsxe2/src/net/sourceforge/jsxe/dom/AdapterNode.java branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLDocument.java Modified: branches/jsxe2/Changelog =================================================================== --- branches/jsxe2/Changelog 2006-09-07 00:14:29 UTC (rev 1249) +++ branches/jsxe2/Changelog 2006-09-07 02:33:14 UTC (rev 1250) @@ -5,6 +5,7 @@ * AdapterNode now uses the DOM3 renameNode() method to rename element nodes. * Made property methods on AdapterNodes thread safe. * Updated property methods on XMLDocuments + * Made AdapterNode thread safe 08/31/2006 Ian Lewis <Ian...@me...> Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom/AdapterNode.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom/AdapterNode.java 2006-09-07 00:14:29 UTC (rev 1249) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom/AdapterNode.java 2006-09-07 02:33:14 UTC (rev 1250) @@ -225,7 +225,7 @@ //{{{ child() /** - * <p>Gets the child node at the given index.</p> + * <p>Gets the child node at the given index. This method is thread safe.</p> * @param index the index of the requested node * @return an AdapterNode representing the node at the given index, * null if the index is out of bounds @@ -238,40 +238,54 @@ */ XMLDocument rootDocument = getOwnerDocument(); AdapterNode child = null; - if (index < m_domNode.getChildNodes().getLength()) { - if (index < m_children.size()) { - try { - child = (AdapterNode)m_children.get(index); - if (child == null) { - //the size was ok but no AdapterNode was at this index - child = rootDocument.newAdapterNode(this, m_domNode.getChildNodes().item(index)); - m_children.set(index, child); - } - } catch (IndexOutOfBoundsException ioobe) {} - } else { - /* - Populate the other elements with null until we - have the correct size. - */ - ensureChildrenSize(index+1); - child = rootDocument.newAdapterNode(this, m_domNode.getChildNodes().item(index)); - m_children.set(index, child); + + synchronized(childrenLock) { + + + if (index < childCount()) { + if (index < m_children.size()) { + try { + child = (AdapterNode)m_children.get(index); + if (child == null) { + //the size was ok but no AdapterNode was at this index + child = rootDocument.newAdapterNode(this, m_domNode.getChildNodes().item(index)); + m_children.set(index, child); + } + } catch (IndexOutOfBoundsException ioobe) {} + } else { + /* + Populate the other elements with null until we + have the correct size. + */ + ensureChildrenSize(index+1); + child = rootDocument.newAdapterNode(this, m_domNode.getChildNodes().item(index)); + m_children.set(index, child); + } } + return child; } - return child; }//}}} //{{{ childCount() /** - * <p>Gets the number of children that this node has.</p> + * <p>Gets the number of children that this node has. This method is thread + * safe.</p> * @return the number of children of this node */ public int childCount() { - NodeList childNodes = m_domNode.getChildNodes(); - if (childNodes != null) { - return childNodes.getLength(); - } else { - return 0; + Object lock = getLock(); + + /* + Accesses to the underlying DOM should be synchronized on + the root XMLDocument + */ + synchronized (lock) { + NodeList childNodes = m_domNode.getChildNodes(); + if (childNodes != null) { + return childNodes.getLength(); + } else { + return 0; + } } }//}}} @@ -282,7 +296,14 @@ * @return the namespace prefix for this node. null if no namespace */ public String getNSPrefix() { - return m_domNode.getPrefix(); + Object lock = getLock(); + /* + Accesses to the underlying DOM should be synchronized on + the root XMLDocument + */ + synchronized (lock) { + return m_domNode.getPrefix(); + } }//}}} //{{{ setNSPrefix() @@ -296,23 +317,25 @@ * NAMESPACE_ERR: Raised if the specified prefix is malformed per the Namespaces in XML specification, if the namespaceURI of this node is null, if the specified prefix is "xml" and the namespaceURI of this node is different from "http://www.w3.org/XML/1998/namespace", if this node is an attribute and the specified prefix is "xmlns" and the namespaceURI of this node is different from " http://www.w3.org/2000/xmlns/", or if this node is an attribute and the qualifiedName of this node is "xmlns" . */ public void setNSPrefix(String prefix) throws DOMException { - XMLDocument doc = getOwnerDocument(); - try { - doc.beginCompoundEdit(); - String oldPrefix = getNSPrefix(); - /* - for whatever reason if I set a prefix on an node with no prefix - you get DOMException.NAMESPACE_ERRs. If we are adding a NS then - just rename the node. - */ - if (oldPrefix != null && !oldPrefix.equals("")) { - m_domNode.setPrefix(prefix); - } else { - renameElementNode(prefix, getLocalName()); + Object lock = getLock(); + synchronized(lock) { + try { + beginCompoundEdit(); + String oldPrefix = getNSPrefix(); + /* + for whatever reason if I set a prefix on an node with no prefix + you get DOMException.NAMESPACE_ERRs. If we are adding a NS then + just rename the node. + */ + if (oldPrefix != null && !oldPrefix.equals("")) { + m_domNode.setPrefix(prefix); + } else { + renameElementNode(prefix, getLocalName()); + } + fireNamespaceChanged(this, oldPrefix, prefix); + } finally { + endCompoundEdit(); } - fireNamespaceChanged(this, oldPrefix, prefix); - } finally { - doc.endCompoundEdit(); } }//}}} @@ -323,7 +346,10 @@ * @return the full qualified name of this node */ public String getNodeName() { - return m_domNode.getNodeName(); + Object lock = getLock(); + synchronized(lock) { + return m_domNode.getNodeName(); + } }//}}} //{{{ setNodeName() @@ -332,29 +358,37 @@ * @param qualifiedName the new qualified name */ public void setNodeName(String qualifiedName) throws DOMException { - String oldPrefix = getNSPrefix(); - String oldLocalName = getLocalName(); + Object lock = getLock(); - String prefix = MiscUtilities.getNSPrefixFromQualifiedName(qualifiedName); - String localName = MiscUtilities.getLocalNameFromQualifiedName(qualifiedName); - if (getNodeType() == ELEMENT_NODE) { - renameElementNode(prefix, localName); - } else { - if (getNodeType() == PROCESSING_INSTRUCTION_NODE) { - renamePINode(localName); + synchronized(lock) { + + String oldPrefix = getNSPrefix(); + String oldLocalName = getLocalName(); + + String prefix = MiscUtilities.getNSPrefixFromQualifiedName(qualifiedName); + String localName = MiscUtilities.getLocalNameFromQualifiedName(qualifiedName); + + beginCompoundEdit(); + + if (getNodeType() == ELEMENT_NODE) { + renameElementNode(prefix, localName); } else { - throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "An attempt was made to rename a node that is not supported."); + if (getNodeType() == PROCESSING_INSTRUCTION_NODE) { + renamePINode(localName); + } else { + throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "An attempt was made to rename a node that is not supported."); + } } + + if (!MiscUtilities.equals(oldPrefix, prefix)) { + fireNamespaceChanged(this, oldPrefix, prefix); + } + if (!MiscUtilities.equals(oldLocalName, localName)) { + fireLocalNameChanged(this, oldLocalName, localName); + } + + endCompoundEdit(); } - XMLDocument doc = getOwnerDocument(); - doc.beginCompoundEdit(); - if (!MiscUtilities.equals(oldPrefix, prefix)) { - fireNamespaceChanged(this, oldPrefix, prefix); - } - if (!MiscUtilities.equals(oldLocalName, localName)) { - fireLocalNameChanged(this, oldLocalName, localName); - } - doc.endCompoundEdit(); }//}}} //{{{ getLocalName() @@ -363,7 +397,10 @@ * @return the local name of the node */ public String getLocalName() { - return m_domNode.getLocalName(); + Object lock = getLock(); + synchronized(lock) { + return m_domNode.getLocalName(); + } }//}}} //{{{ setLocalName() @@ -374,36 +411,41 @@ * contains an illegal character. */ public void setLocalName(String localName) throws DOMException { + Object lock = getLock(); - if (m_domNode.getNodeType() == Node.ELEMENT_NODE) { - //Verify that this really is a change - String oldLocalName = m_domNode.getLocalName(); - if (!oldLocalName.equals(localName)) { - - renameElementNode(getNSPrefix(), localName); - - fireLocalNameChanged(this, oldLocalName, localName); - } - } else { - if (m_domNode.getNodeType() == Node.PROCESSING_INSTRUCTION_NODE) { - if (m_domNode.getNodeName() != localName) { - Node newNode = m_domNode.getOwnerDocument().createProcessingInstruction(localName, m_domNode.getNodeValue()); - m_domNode.getParentNode().replaceChild(newNode, m_domNode); - m_domNode = newNode; + synchronized(lock) { + + if (m_domNode.getNodeType() == Node.ELEMENT_NODE) { + //Verify that this really is a change + String oldLocalName = m_domNode.getLocalName(); + if (!oldLocalName.equals(localName)) { + + renameElementNode(getNSPrefix(), localName); + + fireLocalNameChanged(this, oldLocalName, localName); } } else { - if (m_domNode.getNodeType() == Node.ENTITY_REFERENCE_NODE) { + if (m_domNode.getNodeType() == Node.PROCESSING_INSTRUCTION_NODE) { if (m_domNode.getNodeName() != localName) { - if (getOwnerDocument().entityDeclared(localName)) { - Node newNode = m_domNode.getOwnerDocument().createEntityReference(localName); - m_domNode.getParentNode().replaceChild(newNode, m_domNode); - m_domNode = newNode; - } else { - throw new DOMException(DOMException.SYNTAX_ERR, "Entity "+"\""+localName+"\""+" is not declared in the Schema"); + Node newNode = m_domNode.getOwnerDocument().createProcessingInstruction(localName, m_domNode.getNodeValue()); + m_domNode.getParentNode().replaceChild(newNode, m_domNode); + m_domNode = newNode; + } + } else { + if (m_domNode.getNodeType() == Node.ENTITY_REFERENCE_NODE) { + if (m_domNode.getNodeName() != localName) { + XMLDocument doc = getOwnerDocument(); + if (doc != null && doc.entityDeclared(localName)) { + Node newNode = m_domNode.getOwnerDocument().createEntityReference(localName); + m_domNode.getParentNode().replaceChild(newNode, m_domNode); + m_domNode = newNode; + } else { + throw new DOMException(DOMException.SYNTAX_ERR, "Entity "+"\""+localName+"\""+" is not declared in the Schema"); + } } + } else { + throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Renaming this node type is not supported."); } - } else { - throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Renaming this node type is not supported."); } } } @@ -415,7 +457,10 @@ * @return the current value associated with this node */ public String getNodeValue() { - return m_domNode.getNodeValue(); + Object lock = getLock(); + synchronized(lock) { + return m_domNode.getNodeValue(); + } }//}}} //{{{ setNodeValue() @@ -429,11 +474,15 @@ * the implementation platform. */ public void setNodeValue(String str) throws DOMException { - // Make sure there is a change. - if (!MiscUtilities.equals(str, m_domNode.getNodeValue())) { - String oldValue = getNodeValue(); - m_domNode.setNodeValue(str); - fireNodeValueChanged(this, oldValue, str); + Object lock = getLock(); + + synchronized(lock) { + // Make sure there is a change. + if (!MiscUtilities.equals(str, m_domNode.getNodeValue())) { + String oldValue = getNodeValue(); + m_domNode.setNodeValue(str); + fireNodeValueChanged(this, oldValue, str); + } } }//}}} @@ -443,7 +492,11 @@ * @return the node type */ public short getNodeType() { - return m_domNode.getNodeType(); + Object lock = getLock(); + + synchronized(lock) { + return m_domNode.getNodeType(); + } }//}}} //{{{ getParentNode() @@ -462,7 +515,11 @@ * <code>null</code> if this is not an element node */ public NamedNodeMap getAttributes() { - return m_domNode.getAttributes(); + Object lock = getLock(); + + synchronized(lock) { + return m_domNode.getAttributes(); + } }//}}} //{{{ addAdapterNode() @@ -529,63 +586,68 @@ * location is invalid. */ public AdapterNode addAdapterNodeAt(AdapterNode node, int location) throws DOMException { - if (node != null) { - if (location >= 0 && location <= childCount()) { - if (m_children.indexOf(node) == location) { - //node is already in the location specified - return node; - } - - XMLDocument doc = getOwnerDocument(); - try { + + synchronized(childrenLock) { + if (node != null) { + if (location >= 0 && location <= childCount()) { + if (m_children.indexOf(node) == location) { + //node is already in the location specified + return node; + } - doc.beginCompoundEdit(); - //add to this AdapterNode and the DOM. - if (node.getNodeType() == Node.DOCUMENT_FRAGMENT_NODE) { - //Add all children of the document fragment - for (int i=0; i<node.childCount(); i++) { - addAdapterNodeAt(node.child(i), location+i); - } - } else { + Object lock = getLock(); + synchronized(lock) { - /* - if the node is already contained in this node - then we are effectively moving the node. - */ - if (m_children.contains(node)) { - if (location > m_children.indexOf(node)) { - location -= 1; - } - int index = index(node); - m_children.remove(node); - addUndoableEdit(new RemoveNodeChange(this, node, index)); - } else { - //Remove from previous parent - AdapterNode previousParent = node.getParentNode(); - if (previousParent != this) { - if (previousParent != null) { - previousParent.removeChild(node); + try { + beginCompoundEdit(); + //add to this AdapterNode and the DOM. + if (node.getNodeType() == Node.DOCUMENT_FRAGMENT_NODE) { + //Add all children of the document fragment + for (int i=0; i<node.childCount(); i++) { + addAdapterNodeAt(node.child(i), location+i); } + } else { + + /* + if the node is already contained in this node + then we are effectively moving the node. + */ + if (m_children.contains(node)) { + if (location > m_children.indexOf(node)) { + location -= 1; + } + int index = index(node); + m_children.remove(node); + addUndoableEdit(new RemoveNodeChange(this, node, index)); + } else { + //Remove from previous parent + AdapterNode previousParent = node.getParentNode(); + if (previousParent != this) { + if (previousParent != null) { + previousParent.removeChild(node); + } + } + } + if (location >= m_children.size()) { + m_domNode.appendChild(node.getNode()); + ensureChildrenSize(location); + m_children.add(node); + } else { + m_domNode.insertBefore(node.getNode(), child(location).getNode()); + m_children.add(location, node); + } + + node.setParent(this); + fireNodeAdded(this, node, location); } + } finally { + endCompoundEdit(); } - if (location >= m_children.size()) { - m_domNode.appendChild(node.getNode()); - ensureChildrenSize(location); - m_children.add(node); - } else { - m_domNode.insertBefore(node.getNode(), child(location).getNode()); - m_children.add(location, node); - } - - node.setParent(this); - fireNodeAdded(this, node, location); } - } finally { - doc.endCompoundEdit(); + } else { + throw new DOMException(DOMException.INDEX_SIZE_ERR, "The location to insert this node is invalid."); } - } else { - throw new DOMException(DOMException.INDEX_SIZE_ERR, "The location to insert this node is invalid."); } } return node; @@ -601,19 +663,26 @@ * a child of this node. */ public void remove(AdapterNode child) throws DOMException { - if (child != null) { - if (getNodeType() == Node.DOCUMENT_NODE && child.getNodeType() == Node.ELEMENT_NODE) { - throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "You cannot remove the root element node."); + + synchronized(childrenLock) { + Object lock = getLock(); + synchronized(lock) { + + if (child != null) { + if (getNodeType() == Node.DOCUMENT_NODE && child.getNodeType() == Node.ELEMENT_NODE) { + throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "You cannot remove the root element node."); + } + if (child.getNodeType() != Node.DOCUMENT_TYPE_NODE) { + int index = index(child); + m_domNode.removeChild(child.getNode()); + m_children.remove(child); + child.setParent(null); + fireNodeRemoved(this, child, index); + } else { + throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Cannot remove Document Type Nodes"); + } + } } - if (child.getNodeType() != Node.DOCUMENT_TYPE_NODE) { - int index = index(child); - m_domNode.removeChild(child.getNode()); - m_children.remove(child); - child.setParent(null); - fireNodeRemoved(this, child, index); - } else { - throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Cannot remove Document Type Nodes"); - } } }//}}} @@ -631,43 +700,48 @@ * readonly */ public void setAttribute(String name, String value) throws DOMException { - if (m_domNode.getNodeType() == Node.ELEMENT_NODE) { - - Element element = (Element)m_domNode; - String prefix = MiscUtilities.getNSPrefixFromQualifiedName(name); - - String oldValue = getAttribute(name); - - if (!MiscUtilities.equals(oldValue, value)) { - //check if we are setting a namespace declaration - if ("xmlns".equals(prefix)) { - //if so then make sure the value is valid - if (value != null && value.equals("")) { - throw new DOMException(DOMException.NAMESPACE_ERR, "An attempt was made to create an empty namespace declaration"); + Object lock = getLock(); + + synchronized(lock) { + + if (m_domNode.getNodeType() == Node.ELEMENT_NODE) { + + Element element = (Element)m_domNode; + String prefix = MiscUtilities.getNSPrefixFromQualifiedName(name); + + String oldValue = getAttribute(name); + + if (!MiscUtilities.equals(oldValue, value)) { + //check if we are setting a namespace declaration + if ("xmlns".equals(prefix)) { + //if so then make sure the value is valid + if (value != null && value.equals("")) { + throw new DOMException(DOMException.NAMESPACE_ERR, "An attempt was made to create an empty namespace declaration"); + } } - } - - /* - If the attribute did not have a prefix to begin with then - using setAttributeNS may add a new attribute node to the element - even though the attribute already exists. - */ - if (prefix != null && !prefix.equals("")) { - element.setAttributeNS(lookupNamespaceURI(prefix),name,value); - } else { + /* - setAttribute doesn't throw an error if the first character - is a ":" + If the attribute did not have a prefix to begin with then + using setAttributeNS may add a new attribute node to the element + even though the attribute already exists. */ - if (name != null && !name.equals("") && name.charAt(0)==':') { - throw new DOMException(DOMException.NAMESPACE_ERR, "An attribute name cannot have a ':' as the first character"); + if (prefix != null && !prefix.equals("")) { + element.setAttributeNS(lookupNamespaceURI(prefix),name,value); + } else { + /* + setAttribute doesn't throw an error if the first character + is a ":" + */ + if (name != null && !name.equals("") && name.charAt(0)==':') { + throw new DOMException(DOMException.NAMESPACE_ERR, "An attribute name cannot have a ':' as the first character"); + } + element.setAttribute(name, value); } - element.setAttribute(name, value); + fireAttributeChanged(this, name, oldValue, value); } - fireAttributeChanged(this, name, oldValue, value); + } else { + throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Only Element Nodes can have attributes"); } - } else { - throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Only Element Nodes can have attributes"); } }//}}} @@ -678,28 +752,33 @@ * @throws DOMException NOT_SUPPORTED_ERR: if this is not an element node */ public String getAttribute(String name) throws DOMException { - if (m_domNode.getNodeType() == Node.ELEMENT_NODE) { - String localName = MiscUtilities.getLocalNameFromQualifiedName(name); - String prefix = MiscUtilities.getNSPrefixFromQualifiedName(name); - - Element element = (Element)m_domNode; - if (prefix != null && !prefix.equals("")) { - //getAttributeNS returns "" even if the attribute isn't in the - //element. - if (element.getAttributeNodeNS(lookupNamespaceURI(prefix),localName) == null) { - return null; + + Object lock = getLock(); + + synchronized(lock) { + if (m_domNode.getNodeType() == Node.ELEMENT_NODE) { + String localName = MiscUtilities.getLocalNameFromQualifiedName(name); + String prefix = MiscUtilities.getNSPrefixFromQualifiedName(name); + + Element element = (Element)m_domNode; + if (prefix != null && !prefix.equals("")) { + //getAttributeNS returns "" even if the attribute isn't in the + //element. + if (element.getAttributeNodeNS(lookupNamespaceURI(prefix),localName) == null) { + return null; + } + return element.getAttributeNS(lookupNamespaceURI(prefix),localName); + } else { + //getAttribute returns "" even if the attribute isn't in the + //element. + if (element.getAttributeNode(name) == null) { + return null; + } + return element.getAttribute(name); } - return element.getAttributeNS(lookupNamespaceURI(prefix),localName); } else { - //getAttribute returns "" even if the attribute isn't in the - //element. - if (element.getAttributeNode(name) == null) { - return null; - } - return element.getAttribute(name); + throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Only Element Nodes can have attributes"); } - } else { - throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Only Element Nodes can have attributes"); } }//}}} @@ -713,14 +792,19 @@ * readonly */ public void removeAttributeAt(int index) throws DOMException { - if (m_domNode.getNodeType() == Node.ELEMENT_NODE) { - Element element = (Element)m_domNode; - NamedNodeMap attrs = element.getAttributes(); - if (attrs != null) { - removeAttribute(attrs.item(index).getNodeName()); + Object lock = getLock(); + + synchronized(lock) { + + if (m_domNode.getNodeType() == Node.ELEMENT_NODE) { + Element element = (Element)m_domNode; + NamedNodeMap attrs = element.getAttributes(); + if (attrs != null) { + removeAttribute(attrs.item(index).getNodeName()); + } + } else { + throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Only Element Nodes can have attributes"); } - } else { - throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Only Element Nodes can have attributes"); } }//}}} @@ -733,52 +817,57 @@ * readonly */ public void removeAttribute(String attr) throws DOMException { - if (m_domNode.getNodeType() == Node.ELEMENT_NODE) { - Element element = (Element)m_domNode; - String prefix = MiscUtilities.getNSPrefixFromQualifiedName(attr); - String localName = MiscUtilities.getLocalNameFromQualifiedName(attr); - String oldValue = getAttribute(attr); - - //make sure we are actually removing an attribute. - if (oldValue != null) { - //Check if we are removing a namespace declaration - //This is a somewhat expensive operation, may need to - //optimize in the future - if ("xmlns".equals(prefix)) { - //check if there are nodes using the namespace - String uri = lookupNamespaceURI(localName); - //check this element's namespace - if (!uri.equals(element.getNamespaceURI())) { - //check for decendent elements with this namespace - NodeList list = element.getElementsByTagName("*"); - //check if an attribute with this NS is used - for (int i=0; i<list.getLength(); i++) { - Node ele = list.item(i); - if (uri.equals(ele.getNamespaceURI())) { - throw new DOMException(DOMException.NAMESPACE_ERR, "An attempt was made to remove a namespace declaration when nodes exist that use it"); - } - //now check the attributes - NamedNodeMap attrs = ele.getAttributes(); - for (int j=0; j<attrs.getLength(); j++) { - Node foundAttr = attrs.item(i); - if (uri.equals(foundAttr.getNamespaceURI())) { + Object lock = getLock(); + + synchronized(lock) { + + if (m_domNode.getNodeType() == Node.ELEMENT_NODE) { + Element element = (Element)m_domNode; + String prefix = MiscUtilities.getNSPrefixFromQualifiedName(attr); + String localName = MiscUtilities.getLocalNameFromQualifiedName(attr); + String oldValue = getAttribute(attr); + + //make sure we are actually removing an attribute. + if (oldValue != null) { + //Check if we are removing a namespace declaration + //This is a somewhat expensive operation, may need to + //optimize in the future + if ("xmlns".equals(prefix)) { + //check if there are nodes using the namespace + String uri = lookupNamespaceURI(localName); + //check this element's namespace + if (!uri.equals(element.getNamespaceURI())) { + //check for decendent elements with this namespace + NodeList list = element.getElementsByTagName("*"); + //check if an attribute with this NS is used + for (int i=0; i<list.getLength(); i++) { + Node ele = list.item(i); + if (uri.equals(ele.getNamespaceURI())) { throw new DOMException(DOMException.NAMESPACE_ERR, "An attempt was made to remove a namespace declaration when nodes exist that use it"); } + //now check the attributes + NamedNodeMap attrs = ele.getAttributes(); + for (int j=0; j<attrs.getLength(); j++) { + Node foundAttr = attrs.item(i); + if (uri.equals(foundAttr.getNamespaceURI())) { + throw new DOMException(DOMException.NAMESPACE_ERR, "An attempt was made to remove a namespace declaration when nodes exist that use it"); + } + } } + } else { + throw new DOMException(DOMException.NAMESPACE_ERR, "An attempt was made to remove a namespace declaration when nodes exist that use it"); } + } + if (prefix != null && !prefix.equals("")) { + element.removeAttributeNS(lookupNamespaceURI(prefix),localName); } else { - throw new DOMException(DOMException.NAMESPACE_ERR, "An attempt was made to remove a namespace declaration when nodes exist that use it"); + element.removeAttribute(localName); } + fireAttributeChanged(this, attr, oldValue, null); } - if (prefix != null && !prefix.equals("")) { - element.removeAttributeNS(lookupNamespaceURI(prefix),localName); - } else { - element.removeAttribute(localName); - } - fireAttributeChanged(this, attr, oldValue, null); + } else { + throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Only Element Nodes can have attributes"); } - } else { - throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Only Element Nodes can have attributes"); } }//}}} @@ -791,13 +880,18 @@ * @throws DOMException NOT_SUPPORTED_ERR: if this is not an element node */ public String getAttributeNameAt(int index) throws DOMException { - if (m_domNode.getNodeType() == Node.ELEMENT_NODE) { - Element element = (Element)m_domNode; - NamedNodeMap attrs = element.getAttributes(); - Node attr = attrs.item(index); - return attr.getNodeName(); - } else { - throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Only Element Nodes can have attributes"); + Object lock = getLock(); + + synchronized(lock) { + + if (m_domNode.getNodeType() == Node.ELEMENT_NODE) { + Element element = (Element)m_domNode; + NamedNodeMap attrs = element.getAttributes(); + Node attr = attrs.item(index); + return attr.getNodeName(); + } else { + throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Only Element Nodes can have attributes"); + } } }//}}} @@ -810,7 +904,11 @@ * @throws DOMException NOT_SUPPORTED_ERR: if this is not an element node */ public String getAttributeAt(int index) throws DOMException { - return getAttribute(getAttributeNameAt(index)); + Object lock = getLock(); + + synchronized(lock) { + return getAttribute(getAttributeNameAt(index)); + } }//}}} //{{{ getAllowedElements() @@ -823,31 +921,38 @@ public List getAllowedElements() { XMLDocument rootDocument = getOwnerDocument(); - HashMap mappings = rootDocument.getCompletionInfoMappings(); - ElementDecl thisDecl = rootDocument.getElementDecl(getNodeName()); - - ArrayList allowedElements = new ArrayList(); - - if (thisDecl != null) { - allowedElements.addAll(thisDecl.getChildElements(getNSPrefix())); - } - - // add everything but the parent's prefix now - Iterator iter = mappings.entrySet().iterator(); - while(iter.hasNext()) { - Map.Entry entry = (Map.Entry)iter.next(); - String prefix = entry.getKey().toString(); - String myprefix = getNSPrefix(); - if (myprefix == null) { - myprefix = ""; + if (rootDocument != null) { + Object lock = getLock(); + synchronized(lock) { + HashMap mappings = rootDocument.getCompletionInfoMappings(); + ElementDecl thisDecl = rootDocument.getElementDecl(getNodeName()); + + ArrayList allowedElements = new ArrayList(); + + if (thisDecl != null) { + allowedElements.addAll(thisDecl.getChildElements(getNSPrefix())); + } + + // add everything but the parent's prefix now + Iterator iter = mappings.entrySet().iterator(); + while(iter.hasNext()) { + Map.Entry entry = (Map.Entry)iter.next(); + String prefix = entry.getKey().toString(); + String myprefix = getNSPrefix(); + if (myprefix == null) { + myprefix = ""; + } + if (!prefix.equals(myprefix)) { + CompletionInfo info = (CompletionInfo)entry.getValue(); + info.getAllElements(prefix, allowedElements); + } + } + MiscUtilities.quicksort(allowedElements, new ElementDecl.Compare()); + return allowedElements; } - if (!prefix.equals(myprefix)) { - CompletionInfo info = (CompletionInfo)entry.getValue(); - info.getAllElements(prefix, allowedElements); - } + } else { + return new ArrayList(); } - MiscUtilities.quicksort(allowedElements, new ElementDecl.Compare()); - return allowedElements; }//}}} //{{{ getElementDecl() @@ -855,10 +960,15 @@ * Gets the Element declaration that defines this element */ public ElementDecl getElementDecl() { - if (getOwnerDocument() != null) { - return getOwnerDocument().getElementDecl(getNodeName()); - } else { - return null; + Object lock = getLock(); + + synchronized(lock) { + XMLDocument doc = getOwnerDocument(); + if (doc != null) { + return doc.getElementDecl(getNodeName()); + } else { + return null; + } } }//}}} @@ -879,7 +989,9 @@ * @param listener the listener to add */ public void addAdapterNodeListener(AdapterNodeListener listener) { - m_listeners.add(listener); + if (listener != null) { + m_listeners.add(listener); + } }//}}} //{{{ removeAdapterNodeListener() @@ -898,23 +1010,28 @@ * @return the string representation of this node. */ public String serializeToString() { - XMLDocument owner = getOwnerDocument(); - if (owner != null) { - return owner.serializeNodeToString(this); - } else { - if (m_lastRootDocument != null) { - return m_lastRootDocument.serializeNodeToString(this); + + Object lock = getLock(); + + synchronized(lock) { + XMLDocument owner = getOwnerDocument(); + if (owner != null) { + return owner.serializeNodeToString(this); } else { - //node was never owned? write it out using the default config - String value = null; - try { - DOMSerializer serializer = new DOMSerializer(); - serializer.setNewLine("\n"); - value = serializer.writeToString(m_domNode); - } catch (DOMException e) { - Log.log(Log.WARNING, this, "Could not write node to string"); + if (m_lastRootDocument != null) { + return m_lastRootDocument.serializeNodeToString(this); + } else { + //node was never owned? write it out using the default config + String value = null; + try { + DOMSerializer serializer = new DOMSerializer(); + serializer.setNewLine("\n"); + value = serializer.writeToString(m_domNode); + } catch (DOMException e) { + Log.log(Log.WARNING, this, "Could not write node to string"); + } + return value; } - return value; } } }//}}} @@ -957,11 +1074,17 @@ This is required to help maintain sync between the AdapterNode tree */ void removeChild(AdapterNode node) { - if (node != null) { - int index = index(node); - m_children.remove(node); - if (index != -1) { - addUndoableEdit(new RemoveNodeChange(this, node, index)); + synchronized(childrenLock) { + Object lock = getLock(); + synchronized(lock) { + + if (node != null) { + int index = index(node); + m_children.remove(node); + if (index != -1) { + addUndoableEdit(new RemoveNodeChange(this, node, index)); + } + } } } }//}}} @@ -972,40 +1095,20 @@ * @param parent the new parent for this AdapterNode */ void setParent(AdapterNode parent) { - m_parentNode = parent; - if (parent != null) { - m_lastRootDocument = m_rootDocument; - m_rootDocument = m_parentNode.getOwnerDocument(); - } else { - m_lastRootDocument = m_rootDocument; - m_rootDocument = null; + Object lock = getLock(); + + synchronized(lock) { + m_parentNode = parent; + if (parent != null) { + m_lastRootDocument = m_rootDocument; + m_rootDocument = m_parentNode.getOwnerDocument(); + } else { + m_lastRootDocument = m_rootDocument; + m_rootDocument = null; + } } }//}}} - // //{{{ updateNode() - // /** - // * Sets the node that this AdapterNode wraps. And - // * updates the AdapterNode children. This should only - // * be used when no change in document structure has - // * been made. Only a change that requires reparsing. - // */ - // protected void updateNode(Node node) { - // Iterator itr = m_children.iterator(); - // int index = 0; - // while (itr.hasNext()) { - // AdapterNode child = (AdapterNode)itr.next(); - // //node could be null if we haven't needed it yet. - // //It's ok to do nothing in this case since the - // //AdapterNode object will be created when it is - // //needed. - // if (child != null) { - // child.updateNode(node.getChildNodes().item(index)); - // } - // ++index; - // } - // m_domNode = node; - // }//}}} - //}}} //{{{ Private members @@ -1157,6 +1260,35 @@ } }//}}} + //{{{ getLock() + + private synchronized Object getLock() { + XMLDocument doc = getOwnerDocument(); + if (doc != null) { + return doc; + } else { + return this; + } + }//}}} + + //{{{ beginCompoundEdit() + + private void beginCompoundEdit() { + XMLDocument doc = getOwnerDocument(); + if (doc != null) { + doc.beginCompoundEdit(); + } + }//}}} + + //{{{ endCompoundEdit() + + private void endCompoundEdit() { + XMLDocument doc = getOwnerDocument(); + if (doc != null) { + doc.endCompoundEdit(); + } + }//}}} + private AdapterNode m_parentNode; private XMLDocument m_rootDocument; private XMLDocument m_lastRootDocument; @@ -1168,5 +1300,9 @@ private Properties m_props = new Properties(); private Object propertyLock = new Object(); + /** + * Children lock for when adding AdapterNodes to the children. + */ + private Object childrenLock = new Object(); //}}} } Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLDocument.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLDocument.java 2006-09-07 00:14:29 UTC (rev 1249) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom/XMLDocument.java 2006-09-07 02:33:14 UTC (rev 1250) @@ -1276,7 +1276,12 @@ * Gets the namespace uri to CompletionInfo Mappings for this document. */ protected HashMap getCompletionInfoMappings() { - return m_mappings; + try { + readLock(); + return (HashMap)m_mappings.clone(); + } finally { + readUnlock(); + } }//}}} //}}} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |