jsxe-cvs Mailing List for jsXe (Page 7)
Status: Inactive
Brought to you by:
ian_lewis
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(29) |
Dec
(63) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(4) |
Feb
(23) |
Mar
(19) |
Apr
(102) |
May
(88) |
Jun
(30) |
Jul
(42) |
Aug
(43) |
Sep
(17) |
Oct
(19) |
Nov
(41) |
Dec
(46) |
2005 |
Jan
(32) |
Feb
(8) |
Mar
(110) |
Apr
(102) |
May
(139) |
Jun
(45) |
Jul
(5) |
Aug
(1) |
Sep
(9) |
Oct
(30) |
Nov
(18) |
Dec
|
2006 |
Jan
(10) |
Feb
(85) |
Mar
(9) |
Apr
(64) |
May
(24) |
Jun
(95) |
Jul
(107) |
Aug
(123) |
Sep
(37) |
Oct
(15) |
Nov
(1) |
Dec
|
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(2) |
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <ian...@us...> - 2006-08-08 20:15:03
|
Revision: 1122 Author: ian_lewis Date: 2006-08-08 13:14:54 -0700 (Tue, 08 Aug 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1122&view=rev Log Message: ----------- Added undo/redo support for attributes Modified Paths: -------------- trunk/jsxe/Changelog trunk/jsxe/src/net/sourceforge/jsxe/dom/AdapterNode.java trunk/jsxe/src/net/sourceforge/jsxe/dom/XMLDocument.java Modified: trunk/jsxe/Changelog =================================================================== --- trunk/jsxe/Changelog 2006-08-08 05:55:21 UTC (rev 1121) +++ trunk/jsxe/Changelog 2006-08-08 20:14:54 UTC (rev 1122) @@ -1,3 +1,7 @@ +08/08/2006 Ian Lewis <Ian...@me...> + + * Addded undo/redo support for attributes. + 08/07/2006 Ian Lewis <Ian...@me...> * Added temporary support for undo to jsXe. Modified: trunk/jsxe/src/net/sourceforge/jsxe/dom/AdapterNode.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/dom/AdapterNode.java 2006-08-08 05:55:21 UTC (rev 1121) +++ trunk/jsxe/src/net/sourceforge/jsxe/dom/AdapterNode.java 2006-08-08 20:14:54 UTC (rev 1122) @@ -411,7 +411,7 @@ */ public void setNodeValue(String str) throws DOMException { // Make sure there is a change. - if (str != null && !str.equals(m_domNode.getNodeValue())) { + if (!MiscUtilities.equals(str, m_domNode.getNodeValue())) { String oldValue = getNodeValue(); m_domNode.setNodeValue(str); fireNodeValueChanged(this, oldValue, str); @@ -540,7 +540,7 @@ } int index = index(node); m_children.remove(node); - getOwnerDocument().addUndoableEdit(new RemoveNodeChange(this, node, index)); + // getOwnerDocument().addUndoableEdit(new RemoveNodeChange(this, node, index)); } else { //Remove from previous parent AdapterNode previousParent = node.getParentNode(); @@ -617,35 +617,36 @@ Element element = (Element)m_domNode; String prefix = MiscUtilities.getNSPrefixFromQualifiedName(name); - //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"); + 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. - - Also, if adding or removing a prefix we need to remove the attribute - first so that namespace errors are thrown - */ - 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); } else { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Only Element Nodes can have attributes"); } @@ -664,8 +665,18 @@ 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); } } else { @@ -707,43 +718,46 @@ Element element = (Element)m_domNode; String prefix = MiscUtilities.getNSPrefixFromQualifiedName(attr); String localName = MiscUtilities.getLocalNameFromQualifiedName(attr); + String oldValue = getAttribute(attr); - //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())) { + //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); } else { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Only Element Nodes can have attributes"); } @@ -927,11 +941,9 @@ if (node != null) { int index = index(node); m_children.remove(node); - if (index != -1) { - getOwnerDocument().addUndoableEdit(new RemoveNodeChange(this, node, index)); - } else { - Log.log(Log.DEBUG, this, "node not found"); - } + // if (index != -1) { + // getOwnerDocument().addUndoableEdit(new RemoveNodeChange(this, node, index)); + // } } }//}}} @@ -981,7 +993,7 @@ //{{{ fireNodeAdded() private void fireNodeAdded(AdapterNode source, AdapterNode child, int index) { - getOwnerDocument().addUndoableEdit(new AddNodeChange(source, child, index)); + // getOwnerDocument().addUndoableEdit(new AddNodeChange(source, child, index)); ListIterator iterator = m_listeners.listIterator(); while (iterator.hasNext()) { @@ -993,7 +1005,7 @@ //{{{ fireNodeRemoved() private void fireNodeRemoved(AdapterNode source, AdapterNode child, int index) { - getOwnerDocument().addUndoableEdit(new RemoveNodeChange(source, child, index)); + // getOwnerDocument().addUndoableEdit(new RemoveNodeChange(source, child, index)); ListIterator iterator = m_listeners.listIterator(); while (iterator.hasNext()) { @@ -1041,7 +1053,9 @@ }//}}} //{{{ fireAttributeChanged() - private void fireAttributeChanged(AdapterNode source, String attr) { + private void fireAttributeChanged(AdapterNode source, String attr, String oldValue, String newValue) { + getOwnerDocument().addUndoableEdit(new AttributeChange(this, attr, oldValue, newValue)); + ListIterator iterator = m_listeners.listIterator(); while (iterator.hasNext()) { AdapterNodeListener listener = (AdapterNodeListener)iterator.next(); Modified: trunk/jsxe/src/net/sourceforge/jsxe/dom/XMLDocument.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/dom/XMLDocument.java 2006-08-08 05:55:21 UTC (rev 1121) +++ trunk/jsxe/src/net/sourceforge/jsxe/dom/XMLDocument.java 2006-08-08 20:14:54 UTC (rev 1122) @@ -203,7 +203,6 @@ */ protected boolean addUndoableEdit(UndoableEdit edit) { if (!getFlag(UNDO_IN_PROGRESS)) { - Log.log(Log.DEBUG, this, edit); if (insideCompoundEdit()) { m_addedToCompoundEdits = true; return m_compoundEdit.addEdit(edit); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ian...@us...> - 2006-08-08 05:55:28
|
Revision: 1121 Author: ian_lewis Date: 2006-08-07 22:55:21 -0700 (Mon, 07 Aug 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1121&view=rev Log Message: ----------- Fixed a bug with drag and drop and undo Modified Paths: -------------- trunk/jsxe/src/net/sourceforge/jsxe/dom/AdapterNode.java trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/NodeNameChange.java trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/NodePrefixChange.java trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/NodeValueChange.java Modified: trunk/jsxe/src/net/sourceforge/jsxe/dom/AdapterNode.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/dom/AdapterNode.java 2006-08-08 04:59:58 UTC (rev 1120) +++ trunk/jsxe/src/net/sourceforge/jsxe/dom/AdapterNode.java 2006-08-08 05:55:21 UTC (rev 1121) @@ -516,41 +516,54 @@ //node is already in the location specified return node; } - //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; + + XMLDocument doc = getOwnerDocument(); + try { + + 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); } - m_children.remove(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); - } - - //Remove from previous parent - AdapterNode previousParent = node.getParentNode(); - if (previousParent != this) { - if (previousParent != null) { - previousParent.removeChild(node); + + + /* + 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); + getOwnerDocument().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); } - node.setParent(this); - fireNodeAdded(this, node); + } finally { + doc.endCompoundEdit(); } } else { throw new DOMException(DOMException.INDEX_SIZE_ERR, "The location to insert this node is invalid."); @@ -574,10 +587,11 @@ 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); + fireNodeRemoved(this, child, index); } else { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Cannot remove Document Type Nodes"); } @@ -911,7 +925,13 @@ */ void removeChild(AdapterNode node) { if (node != null) { + int index = index(node); m_children.remove(node); + if (index != -1) { + getOwnerDocument().addUndoableEdit(new RemoveNodeChange(this, node, index)); + } else { + Log.log(Log.DEBUG, this, "node not found"); + } } }//}}} @@ -960,7 +980,9 @@ //{{{ Private members //{{{ fireNodeAdded() - private void fireNodeAdded(AdapterNode source, AdapterNode child) { + private void fireNodeAdded(AdapterNode source, AdapterNode child, int index) { + getOwnerDocument().addUndoableEdit(new AddNodeChange(source, child, index)); + ListIterator iterator = m_listeners.listIterator(); while (iterator.hasNext()) { AdapterNodeListener listener = (AdapterNodeListener)iterator.next(); @@ -970,7 +992,9 @@ }//}}} //{{{ fireNodeRemoved() - private void fireNodeRemoved(AdapterNode source, AdapterNode child) { + private void fireNodeRemoved(AdapterNode source, AdapterNode child, int index) { + getOwnerDocument().addUndoableEdit(new RemoveNodeChange(source, child, index)); + ListIterator iterator = m_listeners.listIterator(); while (iterator.hasNext()) { AdapterNodeListener listener = (AdapterNodeListener)iterator.next(); Modified: trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/NodeNameChange.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/NodeNameChange.java 2006-08-08 04:59:58 UTC (rev 1120) +++ trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/NodeNameChange.java 2006-08-08 05:55:21 UTC (rev 1121) @@ -50,9 +50,9 @@ */ public class NodeNameChange extends AbstractUndoableEdit { - AdapterNode m_node; - String m_oldValue; - String m_newValue; + private AdapterNode m_node; + private String m_oldValue; + private String m_newValue; //{{{ NodeNameChange constructor public NodeNameChange(AdapterNode node, String oldValue, String newValue) { Modified: trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/NodePrefixChange.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/NodePrefixChange.java 2006-08-08 04:59:58 UTC (rev 1120) +++ trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/NodePrefixChange.java 2006-08-08 05:55:21 UTC (rev 1121) @@ -50,9 +50,9 @@ */ public class NodePrefixChange extends AbstractUndoableEdit { - AdapterNode m_node; - String m_oldValue; - String m_newValue; + private AdapterNode m_node; + private String m_oldValue; + private String m_newValue; //{{{ NodePrefixChange constructor public NodePrefixChange(AdapterNode node, String oldValue, String newValue) { Modified: trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/NodeValueChange.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/NodeValueChange.java 2006-08-08 04:59:58 UTC (rev 1120) +++ trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/NodeValueChange.java 2006-08-08 05:55:21 UTC (rev 1121) @@ -50,9 +50,9 @@ */ public class NodeValueChange extends AbstractUndoableEdit { - AdapterNode m_node; - String m_oldValue; - String m_newValue; + private AdapterNode m_node; + private String m_oldValue; + private String m_newValue; //{{{ NodeValueChange constructor public NodeValueChange(AdapterNode node, String oldValue, String newValue) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ian...@us...> - 2006-08-08 05:00:05
|
Revision: 1120 Author: ian_lewis Date: 2006-08-07 21:59:58 -0700 (Mon, 07 Aug 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1120&view=rev Log Message: ----------- Added hacks for undo Modified Paths: -------------- trunk/treeview/src/treeview/DefaultView.java trunk/treeview/src/treeview/treeview.props Modified: trunk/treeview/src/treeview/DefaultView.java =================================================================== --- trunk/treeview/src/treeview/DefaultView.java 2006-08-08 04:59:34 UTC (rev 1119) +++ trunk/treeview/src/treeview/DefaultView.java 2006-08-08 04:59:58 UTC (rev 1120) @@ -36,6 +36,8 @@ import net.sourceforge.jsxe.gui.Messages; import net.sourceforge.jsxe.util.Log; import net.sourceforge.jsxe.msg.PropertyChanged; +import net.sourceforge.jsxe.msg.UndoEvent; +import net.sourceforge.jsxe.msg.RedoEvent; //}}} //{{{ Swing components @@ -329,6 +331,11 @@ if (CONTINUOUS_LAYOUT.equals(key) || SHOW_COMMENTS.equals(key) || SHOW_ATTRIBUTES.equals(key)) { tree.updateUI(); } + } else { + if ((message instanceof UndoEvent) || (message instanceof RedoEvent)) { + //hack to get undo to work properly + m_valueTextArea.setDocument(new DefaultViewDocument(tree.getSelectedNode())); + } } }//}}} Modified: trunk/treeview/src/treeview/treeview.props =================================================================== --- trunk/treeview/src/treeview/treeview.props 2006-08-08 04:59:34 UTC (rev 1119) +++ trunk/treeview/src/treeview/treeview.props 2006-08-08 04:59:58 UTC (rev 1120) @@ -15,7 +15,7 @@ # a percentage of the horizontal size of the parent container treeview.splitpane.horiz.loc=40 -treeview.show.attributes=ID only +treeview.show.attributes=1 #default size for edit doc type dialog treeview.editdoctypenode.width=200 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ian...@us...> - 2006-08-08 04:59:42
|
Revision: 1119 Author: ian_lewis Date: 2006-08-07 21:59:34 -0700 (Mon, 07 Aug 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1119&view=rev Log Message: ----------- Fixed bugs in undo Modified Paths: -------------- trunk/jsxe/Changelog trunk/jsxe/src/net/sourceforge/jsxe/dom/AdapterNode.java trunk/jsxe/src/net/sourceforge/jsxe/dom/XMLDocument.java trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/NodeNameChange.java trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/NodePrefixChange.java trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/NodeValueChange.java Modified: trunk/jsxe/Changelog =================================================================== --- trunk/jsxe/Changelog 2006-08-08 04:20:55 UTC (rev 1118) +++ trunk/jsxe/Changelog 2006-08-08 04:59:34 UTC (rev 1119) @@ -1,6 +1,8 @@ 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. 08/05/2006 Ian Lewis <Ian...@me...> Modified: trunk/jsxe/src/net/sourceforge/jsxe/dom/AdapterNode.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/dom/AdapterNode.java 2006-08-08 04:20:55 UTC (rev 1118) +++ trunk/jsxe/src/net/sourceforge/jsxe/dom/AdapterNode.java 2006-08-08 04:59:34 UTC (rev 1119) @@ -277,9 +277,24 @@ * 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 { - String oldPrefix = getNSPrefix(); - m_domNode.setPrefix(prefix); - fireNamespaceChanged(this, oldPrefix, prefix); + 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()); + } + fireNamespaceChanged(this, oldPrefix, prefix); + } finally { + doc.endCompoundEdit(); + } }//}}} //{{{ getNodeName() @@ -312,14 +327,15 @@ throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "An attempt was made to rename a node that is not supported."); } } - + 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() Modified: trunk/jsxe/src/net/sourceforge/jsxe/dom/XMLDocument.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/dom/XMLDocument.java 2006-08-08 04:20:55 UTC (rev 1118) +++ trunk/jsxe/src/net/sourceforge/jsxe/dom/XMLDocument.java 2006-08-08 04:59:34 UTC (rev 1119) @@ -203,9 +203,10 @@ */ protected boolean addUndoableEdit(UndoableEdit edit) { if (!getFlag(UNDO_IN_PROGRESS)) { + Log.log(Log.DEBUG, this, edit); if (insideCompoundEdit()) { m_addedToCompoundEdits = true; - return ((CompoundEdit)m_compoundEdits.peek()).addEdit(edit); + return m_compoundEdit.addEdit(edit); } else { return m_undoManager.addEdit(edit); } @@ -219,9 +220,11 @@ * undone/redone all at once. */ public void beginCompoundEdit() { - Log.log(Log.DEBUG, this, "begin compound edit"); - m_addedToCompoundEdits = false; - m_compoundEdits.push(new CompoundEdit()); + if (m_compoundEditCount == 0) { + m_compoundEdit = new CompoundEdit(); + m_addedToCompoundEdits = false; + } + ++m_compoundEditCount; }//}}} //{{{ endCompoundEdit() @@ -234,13 +237,13 @@ Log.log(Log.WARNING, this, new Exception("Unbalanced begin/endCompoundEdit()")); return; } - Log.log(Log.DEBUG, this, "end compound edit"); - CompoundEdit edit = (CompoundEdit)m_compoundEdits.pop(); - edit.end(); - if (m_addedToCompoundEdits) { - m_undoManager.addEdit(edit); - m_addedToCompoundEdits = false; + m_compoundEdit.end(); + if (m_compoundEditCount == 1) { + if (m_addedToCompoundEdits) { + m_undoManager.addEdit(m_compoundEdit); + } } + --m_compoundEditCount; }//}}} //{{{ insideCompoundEdit() @@ -249,7 +252,7 @@ * edit that will be undone/redone all at once. */ public boolean insideCompoundEdit() { - return m_compoundEdits.size() != 0; + return (m_compoundEditCount != 0); }//}}} //{{{ undo() @@ -263,7 +266,7 @@ m_undoManager.undo(); EditBus.send(new UndoEvent(this)); } catch (CannotUndoException e) { - Log.log(Log.WARNING, this, e); + Log.log(Log.WARNING, this, "Could not undo"); } finally { setFlag(UNDO_IN_PROGRESS, false); } @@ -280,7 +283,7 @@ m_undoManager.redo(); EditBus.send(new RedoEvent(this)); } catch (CannotRedoException e) { - Log.log(Log.WARNING, this, e); + Log.log(Log.WARNING, this, "Could not redo"); } finally { setFlag(UNDO_IN_PROGRESS, false); } @@ -2267,8 +2270,9 @@ private HashMap m_mappings; private UndoManager m_undoManager = new UndoManager(); - private Stack m_compoundEdits = new Stack(); + private CompoundEdit m_compoundEdit = null; private boolean m_addedToCompoundEdits = false; + private int m_compoundEditCount = 0; // private XMLDocAdapterListener docAdapterListener = new XMLDocAdapterListener(); Modified: trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/NodeNameChange.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/NodeNameChange.java 2006-08-08 04:20:55 UTC (rev 1118) +++ trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/NodeNameChange.java 2006-08-08 04:59:34 UTC (rev 1119) @@ -66,8 +66,9 @@ public void undo() throws CannotUndoException { super.undo(); try { - m_node.setNodeName(m_oldValue); - } catch (DOMException ioe) { + m_node.setLocalName(m_oldValue); + } catch (DOMException e) { + Log.log(Log.ERROR, this, e); throw new CannotUndoException(); } }//}}} @@ -77,8 +78,9 @@ public void redo() throws CannotRedoException { super.redo(); try { - m_node.setNodeName(m_newValue); - } catch (DOMException ioe) { + m_node.setLocalName(m_newValue); + } catch (DOMException e) { + Log.log(Log.ERROR, this, e); throw new CannotRedoException(); } }//}}} Modified: trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/NodePrefixChange.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/NodePrefixChange.java 2006-08-08 04:20:55 UTC (rev 1118) +++ trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/NodePrefixChange.java 2006-08-08 04:59:34 UTC (rev 1119) @@ -67,7 +67,8 @@ super.undo(); try { m_node.setNSPrefix(m_oldValue); - } catch (DOMException ioe) { + } catch (DOMException e) { + Log.log(Log.ERROR, this, e); throw new CannotUndoException(); } }//}}} @@ -78,7 +79,8 @@ super.redo(); try { m_node.setNSPrefix(m_newValue); - } catch (DOMException ioe) { + } catch (DOMException e) { + Log.log(Log.ERROR, this, e); throw new CannotRedoException(); } }//}}} Modified: trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/NodeValueChange.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/NodeValueChange.java 2006-08-08 04:20:55 UTC (rev 1118) +++ trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/NodeValueChange.java 2006-08-08 04:59:34 UTC (rev 1119) @@ -67,7 +67,8 @@ super.undo(); try { m_node.setNodeValue(m_oldValue); - } catch (DOMException ioe) { + } catch (DOMException e) { + Log.log(Log.ERROR, this, e); throw new CannotUndoException(); } }//}}} @@ -78,7 +79,8 @@ super.redo(); try { m_node.setNodeValue(m_newValue); - } catch (DOMException ioe) { + } catch (DOMException e) { + Log.log(Log.ERROR, this, e); throw new CannotRedoException(); } }//}}} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ian...@us...> - 2006-08-08 04:21:09
|
Revision: 1118 Author: ian_lewis Date: 2006-08-07 21:20:55 -0700 (Mon, 07 Aug 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1118&view=rev Log Message: ----------- Added undo for changing node names, values, and prefixes Modified Paths: -------------- trunk/jsxe/src/net/sourceforge/jsxe/dom/AdapterNode.java trunk/jsxe/src/net/sourceforge/jsxe/dom/XMLDocument.java trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/RemoveEdit.java trunk/jsxe/src/net/sourceforge/jsxe/gui/TabbedView.java Added Paths: ----------- trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/NodeNameChange.java trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/NodePrefixChange.java trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/NodeValueChange.java Modified: trunk/jsxe/src/net/sourceforge/jsxe/dom/AdapterNode.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/dom/AdapterNode.java 2006-08-08 02:53:51 UTC (rev 1117) +++ trunk/jsxe/src/net/sourceforge/jsxe/dom/AdapterNode.java 2006-08-08 04:20:55 UTC (rev 1118) @@ -26,16 +26,12 @@ package net.sourceforge.jsxe.dom; //{{{ imports -/* -All classes are listed explicitly so -it is easy to see which package it -belongs to. -*/ //{{{ jsXe classes import net.sourceforge.jsxe.jsXe; import net.sourceforge.jsxe.util.Log; import net.sourceforge.jsxe.util.MiscUtilities; +import net.sourceforge.jsxe.dom.undo.*; import net.sourceforge.jsxe.dom.completion.*; //}}} @@ -281,8 +277,9 @@ * 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 { + String oldPrefix = getNSPrefix(); m_domNode.setPrefix(prefix); - fireNamespaceChanged(this); + fireNamespaceChanged(this, oldPrefix, prefix); }//}}} //{{{ getNodeName() @@ -317,10 +314,10 @@ } if (!MiscUtilities.equals(oldPrefix, prefix)) { - fireNamespaceChanged(this); + fireNamespaceChanged(this, oldPrefix, prefix); } if (!MiscUtilities.equals(oldLocalName, localName)) { - fireLocalNameChanged(this); + fireLocalNameChanged(this, oldLocalName, localName); } }//}}} @@ -345,11 +342,12 @@ if (m_domNode.getNodeType() == Node.ELEMENT_NODE) { //Verify that this really is a change - if (!m_domNode.getLocalName().equals(localName)) { + String oldLocalName = m_domNode.getLocalName(); + if (!oldLocalName.equals(localName)) { renameElementNode(getNSPrefix(), localName); - fireLocalNameChanged(this); + fireLocalNameChanged(this, oldLocalName, localName); } } else { if (m_domNode.getNodeType() == Node.PROCESSING_INSTRUCTION_NODE) { @@ -398,8 +396,9 @@ public void setNodeValue(String str) throws DOMException { // Make sure there is a change. if (str != null && !str.equals(m_domNode.getNodeValue())) { + String oldValue = getNodeValue(); m_domNode.setNodeValue(str); - fireNodeValueChanged(this); + fireNodeValueChanged(this, oldValue, str); } }//}}} @@ -965,7 +964,9 @@ }//}}} //{{{ fireLocalNameChanged() - private void fireLocalNameChanged(AdapterNode source) { + private void fireLocalNameChanged(AdapterNode source, String oldValue, String newValue) { + getOwnerDocument().addUndoableEdit(new NodeNameChange(this, oldValue, newValue)); + ListIterator iterator = m_listeners.listIterator(); while (iterator.hasNext()) { AdapterNodeListener listener = (AdapterNodeListener)iterator.next(); @@ -975,7 +976,9 @@ }//}}} //{{{ fireNamespaceChanged() - private void fireNamespaceChanged(AdapterNode source) { + private void fireNamespaceChanged(AdapterNode source, String oldValue, String newValue) { + getOwnerDocument().addUndoableEdit(new NodePrefixChange(this, oldValue, newValue)); + ListIterator iterator = m_listeners.listIterator(); while (iterator.hasNext()) { AdapterNodeListener listener = (AdapterNodeListener)iterator.next(); @@ -985,7 +988,10 @@ }//}}} //{{{ fireNodeValueChanged() - private void fireNodeValueChanged(AdapterNode source) { + private void fireNodeValueChanged(AdapterNode source, String oldValue, String newValue) { + + getOwnerDocument().addUndoableEdit(new NodeValueChange(this, oldValue, newValue)); + ListIterator iterator = m_listeners.listIterator(); while (iterator.hasNext()) { AdapterNodeListener listener = (AdapterNodeListener)iterator.next(); Modified: trunk/jsxe/src/net/sourceforge/jsxe/dom/XMLDocument.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/dom/XMLDocument.java 2006-08-08 02:53:51 UTC (rev 1117) +++ trunk/jsxe/src/net/sourceforge/jsxe/dom/XMLDocument.java 2006-08-08 04:20:55 UTC (rev 1118) @@ -198,19 +198,19 @@ //{{{ addUndoableEdit() /** - * Allows views and editors to add additional undoable events. Generally - * the edits added by classes that are not this class, classes in this - * package, or a subclass will not be significant. - * + * Allows subclasses to add additional undoable events. * @return true if the edit was added successfully */ - public boolean addUndoableEdit(UndoableEdit edit) { - if (insideCompoundEdit()) { - m_addedToCompoundEdits = true; - return ((CompoundEdit)m_compoundEdits.peek()).addEdit(edit); - } else { - return m_undoManager.addEdit(edit); + protected boolean addUndoableEdit(UndoableEdit edit) { + if (!getFlag(UNDO_IN_PROGRESS)) { + if (insideCompoundEdit()) { + m_addedToCompoundEdits = true; + return ((CompoundEdit)m_compoundEdits.peek()).addEdit(edit); + } else { + return m_undoManager.addEdit(edit); + } } + return false; }//}}} //{{{ beginCompoundEdit() @@ -235,10 +235,11 @@ return; } Log.log(Log.DEBUG, this, "end compound edit"); + CompoundEdit edit = (CompoundEdit)m_compoundEdits.pop(); + edit.end(); if (m_addedToCompoundEdits) { - CompoundEdit edit = (CompoundEdit)m_compoundEdits.pop(); - edit.end(); m_undoManager.addEdit(edit); + m_addedToCompoundEdits = false; } }//}}} @@ -285,6 +286,14 @@ } }//}}} + //{{{ clearUndo() + /** + * Clears all edits from the undo manager. + */ + public void clearUndo() { + m_undoManager.discardAllEdits(); + }//}}} + //}}} //{{{ Property methods Added: trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/NodeNameChange.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/NodeNameChange.java (rev 0) +++ trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/NodeNameChange.java 2006-08-08 04:20:55 UTC (rev 1118) @@ -0,0 +1,86 @@ +/* +NodeNameChange.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.undo; + +//{{{ imports + +//{{{ jsXe classes +import net.sourceforge.jsxe.dom.AdapterNode; +import net.sourceforge.jsxe.util.Log; +//}}} + +//{{{ Swing classes +import javax.swing.undo.*; +//}}} + +//{{{ DOM classes +import org.w3c.dom.DOMException; +//}}} + +//}}} + +/** + * An undoable edit sigifying a change of an AdapterNode's local name. + * @author Ian Lewis (<a href="mailto:Ian...@me...">Ian...@me...</a>) + * @version $Id$ + * @see net.sourceforge.jsxe.dom.XMLDocument + * @see net.sourceforge.jsxe.dom.AdapterNode + */ +public class NodeNameChange extends AbstractUndoableEdit { + + AdapterNode m_node; + String m_oldValue; + String m_newValue; + + //{{{ NodeNameChange constructor + public NodeNameChange(AdapterNode node, String oldValue, String newValue) { + m_node = node; + m_oldValue = oldValue; + m_newValue = newValue; + }//}}} + + //{{{ undo() + + public void undo() throws CannotUndoException { + super.undo(); + try { + m_node.setNodeName(m_oldValue); + } catch (DOMException ioe) { + throw new CannotUndoException(); + } + }//}}} + + //{{{ redo() + + public void redo() throws CannotRedoException { + super.redo(); + try { + m_node.setNodeName(m_newValue); + } catch (DOMException ioe) { + throw new CannotRedoException(); + } + }//}}} + +} \ No newline at end of file Property changes on: trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/NodeNameChange.java ___________________________________________________________________ Name: svn:executable + * Added: trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/NodePrefixChange.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/NodePrefixChange.java (rev 0) +++ trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/NodePrefixChange.java 2006-08-08 04:20:55 UTC (rev 1118) @@ -0,0 +1,86 @@ +/* +NodePrefixChange.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.undo; + +//{{{ imports + +//{{{ jsXe classes +import net.sourceforge.jsxe.dom.AdapterNode; +import net.sourceforge.jsxe.util.Log; +//}}} + +//{{{ Swing classes +import javax.swing.undo.*; +//}}} + +//{{{ DOM classes +import org.w3c.dom.DOMException; +//}}} + +//}}} + +/** + * An undoable edit sigifying a change of an AdapterNode's namespace prefix. + * @author Ian Lewis (<a href="mailto:Ian...@me...">Ian...@me...</a>) + * @version $Id$ + * @see net.sourceforge.jsxe.dom.XMLDocument + * @see net.sourceforge.jsxe.dom.AdapterNode + */ +public class NodePrefixChange extends AbstractUndoableEdit { + + AdapterNode m_node; + String m_oldValue; + String m_newValue; + + //{{{ NodePrefixChange constructor + public NodePrefixChange(AdapterNode node, String oldValue, String newValue) { + m_node = node; + m_oldValue = oldValue; + m_newValue = newValue; + }//}}} + + //{{{ undo() + + public void undo() throws CannotUndoException { + super.undo(); + try { + m_node.setNSPrefix(m_oldValue); + } catch (DOMException ioe) { + throw new CannotUndoException(); + } + }//}}} + + //{{{ redo() + + public void redo() throws CannotRedoException { + super.redo(); + try { + m_node.setNSPrefix(m_newValue); + } catch (DOMException ioe) { + throw new CannotRedoException(); + } + }//}}} + +} \ No newline at end of file Property changes on: trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/NodePrefixChange.java ___________________________________________________________________ Name: svn:executable + * Added: trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/NodeValueChange.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/NodeValueChange.java (rev 0) +++ trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/NodeValueChange.java 2006-08-08 04:20:55 UTC (rev 1118) @@ -0,0 +1,86 @@ +/* +NodeValueChange.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.undo; + +//{{{ imports + +//{{{ jsXe classes +import net.sourceforge.jsxe.dom.AdapterNode; +import net.sourceforge.jsxe.util.Log; +//}}} + +//{{{ Swing classes +import javax.swing.undo.*; +//}}} + +//{{{ DOM classes +import org.w3c.dom.DOMException; +//}}} + +//}}} + +/** + * An undoable edit sigifying a change of an AdapterNode's value. + * @author Ian Lewis (<a href="mailto:Ian...@me...">Ian...@me...</a>) + * @version $Id$ + * @see net.sourceforge.jsxe.dom.XMLDocument + * @see net.sourceforge.jsxe.dom.AdapterNode + */ +public class NodeValueChange extends AbstractUndoableEdit { + + AdapterNode m_node; + String m_oldValue; + String m_newValue; + + //{{{ NodeValueChange constructor + public NodeValueChange(AdapterNode node, String oldValue, String newValue) { + m_node = node; + m_oldValue = oldValue; + m_newValue = newValue; + }//}}} + + //{{{ undo() + + public void undo() throws CannotUndoException { + super.undo(); + try { + m_node.setNodeValue(m_oldValue); + } catch (DOMException ioe) { + throw new CannotUndoException(); + } + }//}}} + + //{{{ redo() + + public void redo() throws CannotRedoException { + super.redo(); + try { + m_node.setNodeValue(m_newValue); + } catch (DOMException ioe) { + throw new CannotRedoException(); + } + }//}}} + +} \ No newline at end of file Property changes on: trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/NodeValueChange.java ___________________________________________________________________ Name: svn:executable + * Modified: trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/RemoveEdit.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/RemoveEdit.java 2006-08-08 02:53:51 UTC (rev 1117) +++ trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/RemoveEdit.java 2006-08-08 04:20:55 UTC (rev 1118) @@ -77,7 +77,7 @@ try { m_document.removeText(m_offset, m_text.length()); } catch (IOException ioe) { - throw new CannotUndoException(); + throw new CannotRedoException(); } }//}}} Modified: trunk/jsxe/src/net/sourceforge/jsxe/gui/TabbedView.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/gui/TabbedView.java 2006-08-08 02:53:51 UTC (rev 1117) +++ trunk/jsxe/src/net/sourceforge/jsxe/gui/TabbedView.java 2006-08-08 04:20:55 UTC (rev 1118) @@ -788,6 +788,7 @@ DocumentBuffer buffer = getDocumentBuffer(); try { + buffer.clearUndo(); // clear undo since it's view specific DocumentView view = m_view.newDocumentView(buffer); setDocumentView(view); } catch (IOException ioe) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ian...@us...> - 2006-08-08 02:54:03
|
Revision: 1117 Author: ian_lewis Date: 2006-08-07 19:53:51 -0700 (Mon, 07 Aug 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1117&view=rev Log Message: ----------- Updated actions Modified Paths: -------------- trunk/jsxe/messages/messages trunk/jsxe/src/net/sourceforge/jsxe/action/CopyAction.java trunk/jsxe/src/net/sourceforge/jsxe/action/CutAction.java trunk/jsxe/src/net/sourceforge/jsxe/action/FindAction.java trunk/jsxe/src/net/sourceforge/jsxe/action/FindNextAction.java trunk/jsxe/src/net/sourceforge/jsxe/action/PasteAction.java trunk/jsxe/src/net/sourceforge/jsxe/action/RedoAction.java trunk/jsxe/src/net/sourceforge/jsxe/action/UndoAction.java Added Paths: ----------- trunk/jsxe/src/net/sourceforge/jsxe/action/ViewSpecificAction.java Modified: trunk/jsxe/messages/messages =================================================================== --- trunk/jsxe/messages/messages 2006-08-08 00:19:21 UTC (rev 1116) +++ trunk/jsxe/messages/messages 2006-08-08 02:53:51 UTC (rev 1117) @@ -20,13 +20,6 @@ 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.undo=Undo -common.redo=Redo common.ctrl=Ctrl common.alt=Alt @@ -158,6 +151,11 @@ close-all.label=Close All exit.label=Exit +undo.label=Undo +redo.label=Redo +cut.label=Cut +copy.label=Copy +paste.label=Paste find.label=Find... findnext.label=Find Next Modified: trunk/jsxe/src/net/sourceforge/jsxe/action/CopyAction.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/action/CopyAction.java 2006-08-08 00:19:21 UTC (rev 1116) +++ trunk/jsxe/src/net/sourceforge/jsxe/action/CopyAction.java 2006-08-08 02:53:51 UTC (rev 1117) @@ -53,25 +53,11 @@ * @version $Id$ * @since jsXe 0.5 pre1 */ -public class CopyAction extends LocalizedAction { +public class CopyAction extends ViewSpecificAction { //{{{ CopyAction constructor public CopyAction() { super("copy"); }//}}} - //{{{ getLabel() - public String getLabel() { - return Messages.getMessage("common.copy"); - }//}}} - - //{{{ invoke() - public void invoke(TabbedView view, ActionEvent evt) { - /* - invoke the action registered for the current DocumentView named - viewname.copy if there is one. - */ - ActionManager.invokeAction(jsXe.getPluginLoader().getPluginProperty(view.getDocumentView().getViewPlugin(), JARClassLoader.PLUGIN_NAME)+".copy", evt); - }//}}} - } Modified: trunk/jsxe/src/net/sourceforge/jsxe/action/CutAction.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/action/CutAction.java 2006-08-08 00:19:21 UTC (rev 1116) +++ trunk/jsxe/src/net/sourceforge/jsxe/action/CutAction.java 2006-08-08 02:53:51 UTC (rev 1117) @@ -52,25 +52,11 @@ * @version $Id$ * @since jsXe 0.5 pre1 */ -public class CutAction extends LocalizedAction { +public class CutAction extends ViewSpecificAction { //{{{ CutAction constructor public CutAction() { super("cut"); }//}}} - //{{{ getLabel() - public String getLabel() { - return Messages.getMessage("common.cut"); - }//}}} - - //{{{ invoke() - public void invoke(TabbedView view, ActionEvent evt) { - /* - invoke the action registered for the current DocumentView named - viewname.cut if there is one. - */ - ActionManager.invokeAction(jsXe.getPluginLoader().getPluginProperty(view.getDocumentView().getViewPlugin(), JARClassLoader.PLUGIN_NAME)+".cut", evt); - }//}}} - } Modified: trunk/jsxe/src/net/sourceforge/jsxe/action/FindAction.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/action/FindAction.java 2006-08-08 00:19:21 UTC (rev 1116) +++ trunk/jsxe/src/net/sourceforge/jsxe/action/FindAction.java 2006-08-08 02:53:51 UTC (rev 1117) @@ -53,20 +53,11 @@ * @version $Id$ * @since jsXe 0.5 pre1 */ -public class FindAction extends LocalizedAction { +public class FindAction extends ViewSpecificAction { //{{{ FindAction constructor public FindAction() { super("find"); }//}}} - - //{{{ invoke() - public void invoke(TabbedView view, ActionEvent evt) { - /* - invoke the action registered for the current DocumentView named - viewname.find if there is one. - */ - ActionManager.invokeAction(jsXe.getPluginLoader().getPluginProperty(view.getDocumentView().getViewPlugin(), JARClassLoader.PLUGIN_NAME)+".find", evt); - }//}}} } Modified: trunk/jsxe/src/net/sourceforge/jsxe/action/FindNextAction.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/action/FindNextAction.java 2006-08-08 00:19:21 UTC (rev 1116) +++ trunk/jsxe/src/net/sourceforge/jsxe/action/FindNextAction.java 2006-08-08 02:53:51 UTC (rev 1117) @@ -53,20 +53,11 @@ * @version $Id$ * @since jsXe 0.5 pre1 */ -public class FindNextAction extends LocalizedAction { +public class FindNextAction extends ViewSpecificAction { //{{{ FindNextAction constructor public FindNextAction() { super("findnext"); }//}}} - //{{{ invoke() - public void invoke(TabbedView view, ActionEvent evt) { - /* - invoke the action registered for the current DocumentView named - viewname.findnext if there is one. - */ - ActionManager.invokeAction(jsXe.getPluginLoader().getPluginProperty(view.getDocumentView().getViewPlugin(), JARClassLoader.PLUGIN_NAME)+".findnext", evt); - }//}}} - } Modified: trunk/jsxe/src/net/sourceforge/jsxe/action/PasteAction.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/action/PasteAction.java 2006-08-08 00:19:21 UTC (rev 1116) +++ trunk/jsxe/src/net/sourceforge/jsxe/action/PasteAction.java 2006-08-08 02:53:51 UTC (rev 1117) @@ -53,25 +53,11 @@ * @version $Id$ * @since jsXe 0.5 pre1 */ -public class PasteAction extends LocalizedAction { +public class PasteAction extends ViewSpecificAction { //{{{ PasteAction constructor public PasteAction() { super("paste"); }//}}} - //{{{ getLabel() - public String getLabel() { - return Messages.getMessage("common.paste"); - }//}}} - - //{{{ invoke() - public void invoke(TabbedView view, ActionEvent evt) { - /* - invoke the action registered for the current DocumentView named - viewname.paste if there is one. - */ - ActionManager.invokeAction(jsXe.getPluginLoader().getPluginProperty(view.getDocumentView().getViewPlugin(), JARClassLoader.PLUGIN_NAME)+".paste", evt); - }//}}} - } Modified: trunk/jsxe/src/net/sourceforge/jsxe/action/RedoAction.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/action/RedoAction.java 2006-08-08 00:19:21 UTC (rev 1116) +++ trunk/jsxe/src/net/sourceforge/jsxe/action/RedoAction.java 2006-08-08 02:53:51 UTC (rev 1117) @@ -60,11 +60,6 @@ super("redo"); }//}}} - //{{{ getLabel() - public String getLabel() { - return Messages.getMessage("common.redo"); - }//}}} - //{{{ invoke() public void invoke(TabbedView view, ActionEvent evt) { view.getDocumentBuffer().redo(); Modified: trunk/jsxe/src/net/sourceforge/jsxe/action/UndoAction.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/action/UndoAction.java 2006-08-08 00:19:21 UTC (rev 1116) +++ trunk/jsxe/src/net/sourceforge/jsxe/action/UndoAction.java 2006-08-08 02:53:51 UTC (rev 1117) @@ -59,11 +59,6 @@ super("undo"); }//}}} - //{{{ getLabel() - public String getLabel() { - return Messages.getMessage("common.undo"); - }//}}} - //{{{ invoke() public void invoke(TabbedView view, ActionEvent evt) { view.getDocumentBuffer().undo(); Added: trunk/jsxe/src/net/sourceforge/jsxe/action/ViewSpecificAction.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/action/ViewSpecificAction.java (rev 0) +++ trunk/jsxe/src/net/sourceforge/jsxe/action/ViewSpecificAction.java 2006-08-08 02:53:51 UTC (rev 1117) @@ -0,0 +1,81 @@ +/* +ViewSpecificAction.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.action; + +//{{{ imports + +//{{{ jsXe classes +import net.sourceforge.jsxe.jsXe; +import net.sourceforge.jsxe.JARClassLoader; +import net.sourceforge.jsxe.ActionManager; +import net.sourceforge.jsxe.LocalizedAction; +import net.sourceforge.jsxe.gui.TabbedView; +import net.sourceforge.jsxe.gui.Messages; +//}}} + +//{{{ Java classes +import java.io.IOException; +//}}} + +//{{{ AWT components +import java.awt.event.ActionEvent; +//}}} + +//}}} + +/** + * The ViewSpecificAction is a class that defines actions that are + * view specific. i.e. Actions that are defined by jsXe but whose + * implementation is determined by the currently active view. + * + * @author Ian Lewis (<a href="mailto:Ian...@me...">Ian...@me...</a>) + * @version $Id$ + * @since jsXe 0.5 pre3 + */ +public abstract class ViewSpecificAction extends LocalizedAction { + + //{{{ ViewSpecificAction constructor + public ViewSpecificAction(String name) { + super(name); + }//}}} + + //{{{ invoke() + public void invoke(TabbedView view, ActionEvent evt) { + /* + invoke the action registered for the current DocumentView named + viewname.actionname if there is one. + */ + ActionManager.invokeAction(getViewActionName(view), evt); + }//}}} + + //{{{ getViewActionName() + /** + * Gets the view specific action name for the current DocumentView in the + * given TabbedView. + */ + private String getViewActionName(TabbedView view) { + return jsXe.getPluginLoader().getPluginProperty(view.getDocumentView().getViewPlugin(), JARClassLoader.PLUGIN_NAME)+"."+getName(); + }//}}} +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ian...@us...> - 2006-08-08 00:19:30
|
Revision: 1116 Author: ian_lewis Date: 2006-08-07 17:19:21 -0700 (Mon, 07 Aug 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1116&view=rev Log Message: ----------- Added russian translation Added Paths: ----------- trunk/sourceview/messages/messages.ru Added: trunk/sourceview/messages/messages.ru =================================================================== --- trunk/sourceview/messages/messages.ru (rev 0) +++ trunk/sourceview/messages/messages.ru 2006-08-08 00:19:21 UTC (rev 1116) @@ -0,0 +1,34 @@ +# JSXE source view English properties file +# $Id: messages 1068 2006-07-26 16:57:45Z ian_lewis $ +# Maintained by Alexandr Gridnev (ale...@ya...) +#:mode=properties: +#:tabSize=4:indentSize=4:noTabs=true: +#:folding=explicit:collapseFolds=1 + +#{{{ Source View Options +SourceView.Options.Title=Отображение исходником +SourceView.Options.EndOfLineMarker=Отображать символы конца строки +SourceView.Syntax.Object=Тип узла +SourceView.Syntax.Style=Стиль текста +SourceView.ColorChooser.Title=Злобное устройство предназначенное для выбора цветов +SourceView.Markup=Элементы разметки +SourceView.Invalid=Неправильное +#}}} + +#{{{ Style Editor +SourceView.StyleEditor.Title=Редактор стилей +SourceView.StyleEditor.Color=Цвет текста +SourceView.StyleEditor.Bold=Жирный +SourceView.StyleEditor.Italics=Курсив +#}}} + +#{{{ Find Dialog +SourceView.Find.title=Найти и заменить +SourceView.Ignore.Case=Игнорировать регистр символов +SourceView.Search.For=Искать: +SourceView.Replace.With=Заменить на: +SourceView.Replace.And.Find=Найти и заменить +SourceView.No.More.Matches.title=Дальше не найдено :( +SourceView.No.More.Matches.message="Ничего не найдено. Искать с начала документа?" +SourceView.Search.Error.title=Ошибка поиска 0_0 +#}}} Property changes on: trunk/sourceview/messages/messages.ru ___________________________________________________________________ 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-08-08 00:18:54
|
Revision: 1115 Author: ian_lewis Date: 2006-08-07 17:18:45 -0700 (Mon, 07 Aug 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1115&view=rev Log Message: ----------- added russian translation Added Paths: ----------- trunk/treeview/messages/messages.ru Added: trunk/treeview/messages/messages.ru =================================================================== --- trunk/treeview/messages/messages.ru (rev 0) +++ trunk/treeview/messages/messages.ru 2006-08-08 00:18:45 UTC (rev 1115) @@ -0,0 +1,35 @@ +# JSXE tree view English properties file +# $Id: messages 1101 2006-08-03 15:40:34Z ian_lewis $ +# Maintained by Alexandr Gridnev (ale...@ya...) +#:mode=properties: +#:tabSize=4:indentSize=4:noTabs=true: +#:folding=explicit:collapseFolds=1: + +TreeView.Options.Title=Отображение деревом + +TreeView.Options.Show.Comments=Показывать узлы-комментарии +TreeView.Options.Show.Comments.ToolTip=Если это выбрано - то узлы-комментарии будут отображаться в дереве +TreeView.Options.Continuous.Layout=При движении разделителей - сразу перерисовывать +TreeView.Options.Continuous.Layout.ToolTip=<html>Если выбрано - то при перемещении разделителей то что они разделяют будет сразу перерисовываться.<br>Если не выбрано - то положение линии будет отображаться черной полоской, а перерисовано все будет после того как вы отпустите мышару.</html> +TreeView.Options.Show.Attributes=Показывать элементы атрибутов в дереве: +TreeView.Options.Show.Attributes.ToolTip=<html>Эта опция определяет какие атрибуты элементов будут отображены в дереве.<ul><li><strong>Никаких</strong> - Атрибутов не покажут.</li><li><strong>только ID </strong> - Покажут только атрибут, определенный как ID.</li><li><strong>Все</strong> - Покажут все что есть.</li></ul></html> +Show.Attributes.None=Никаких +Show.Attributes.ID.Only=Только ID +Show.Attributes.All=Все + +treeview.document.root=Это корень документа + +treeview.rename.node.label=Переименовать узел +treeview.remove.node.label=Удалить узел +treeview.add.attribute.label=Добавить атрибут +treeview.remove.attribute.label=Удалить атрибут +treeview.edit.node.label=Редактировать узел +TreeView.EditDocType.Title=Редактировать определение типа документа (DTD) +Edit.Node.Dialog.Title=Редактирование узла + +treeview.add.doctype.node.label=Добавить определение типа документа (DTD) +treeview.add.element.node.label=Добавить узел-элемент +treeview.add.text.node.label=Добавить узел-текст +treeview.add.cdata.node.label=Добавиь узел-CDATA +treeview.add.pi.node.label=Добавить правило обработки +treeview.add.comment.node.label=Добавить комментарий Property changes on: trunk/treeview/messages/messages.ru ___________________________________________________________________ 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-08-08 00:18:26
|
Revision: 1114 Author: ian_lewis Date: 2006-08-07 17:18:19 -0700 (Mon, 07 Aug 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1114&view=rev Log Message: ----------- Updated russian translation Modified Paths: -------------- trunk/jsxe/messages/messages trunk/jsxe/messages/messages.ru Modified: trunk/jsxe/messages/messages =================================================================== --- trunk/jsxe/messages/messages 2006-08-08 00:09:14 UTC (rev 1113) +++ trunk/jsxe/messages/messages 2006-08-08 00:18:19 UTC (rev 1114) @@ -280,7 +280,8 @@ \ \ \ \ Trish Hartnett <tri...@us...>\n\n\ Translators:\n\ \ \ \ \ German (de) - Bianca Shöen\n\ - \ \ \ \ Swedish (sv) - Patrik Johansson <pa...@it...>\n\n\ + \ \ \ \ Swedish (sv) - Patrik Johansson <pa...@it...>\n\ + \ \ \ \ Russian (ru) - Alexandr Gridnev <ale...@ya...>\n\n\ Past Contributers:\n\ \ \ \ \ Aaron Flatten <afl...@us...>\n\ \ \ \ \ Bilel Remmache <rb...@us...>\n\n\ Modified: trunk/jsxe/messages/messages.ru =================================================================== --- trunk/jsxe/messages/messages.ru 2006-08-08 00:09:14 UTC (rev 1113) +++ trunk/jsxe/messages/messages.ru 2006-08-08 00:18:19 UTC (rev 1114) @@ -1,6 +1,6 @@ # JSXE English properties file # $Id: -# Maintained by Sagrer[GG] (sa...@ya...) +# Maintained by Alexandr Gridnev (ale...@ya...) #:mode=properties: #:tabSize=4:indentSize=4:noTabs=true: #:folding=explicit:collapseFolds=1: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ian...@us...> - 2006-08-08 00:09:29
|
Revision: 1113 Author: ian_lewis Date: 2006-08-07 17:09:14 -0700 (Mon, 07 Aug 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1113&view=rev Log Message: ----------- Undo and redo events Added Paths: ----------- trunk/jsxe/src/net/sourceforge/jsxe/msg/RedoEvent.java trunk/jsxe/src/net/sourceforge/jsxe/msg/UndoEvent.java Added: trunk/jsxe/src/net/sourceforge/jsxe/msg/RedoEvent.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/msg/RedoEvent.java (rev 0) +++ trunk/jsxe/src/net/sourceforge/jsxe/msg/RedoEvent.java 2006-08-08 00:09:14 UTC (rev 1113) @@ -0,0 +1,48 @@ +/* +RedoEvent.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.msg; + +import net.sourceforge.jsxe.*; +import net.sourceforge.jsxe.dom.XMLDocument; + +/** + * Message send when a redo is performed on an XMLDocument. + * + * @author Ian Lewis (<a href="mailto:Ian...@me...">Ian...@me...</a>) + * @version $Id$ + * + * @since jsXe 0.5 pre3 + */ +public class RedoEvent extends EBMessage { + + //{{{ RedoEvent constructor + /** + * Creates a new RedoEvent. + */ + public RedoEvent(XMLDocument document) { + super(document); + } //}}} + +} Property changes on: trunk/jsxe/src/net/sourceforge/jsxe/msg/RedoEvent.java ___________________________________________________________________ Name: svn:executable + * Added: trunk/jsxe/src/net/sourceforge/jsxe/msg/UndoEvent.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/msg/UndoEvent.java (rev 0) +++ trunk/jsxe/src/net/sourceforge/jsxe/msg/UndoEvent.java 2006-08-08 00:09:14 UTC (rev 1113) @@ -0,0 +1,48 @@ +/* +UndoEvent.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.msg; + +import net.sourceforge.jsxe.*; +import net.sourceforge.jsxe.dom.XMLDocument; + +/** + * Message send when an undo is performed on an XMLDocument. + * + * @author Ian Lewis (<a href="mailto:Ian...@me...">Ian...@me...</a>) + * @version $Id$ + * + * @since jsXe 0.5 pre3 + */ +public class UndoEvent extends EBMessage { + + //{{{ UndoEvent constructor + /** + * Creates a new UndoEvent. + */ + public UndoEvent(XMLDocument document) { + super(document); + } //}}} + +} Property changes on: trunk/jsxe/src/net/sourceforge/jsxe/msg/UndoEvent.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-08-08 00:08:46
|
Revision: 1112 Author: ian_lewis Date: 2006-08-07 17:08:42 -0700 (Mon, 07 Aug 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1112&view=rev Log Message: ----------- Moved the edit menu to jsXe core Modified Paths: -------------- trunk/treeview/Changelog trunk/treeview/src/treeview/DefaultView.java Modified: trunk/treeview/Changelog =================================================================== --- trunk/treeview/Changelog 2006-08-08 00:08:19 UTC (rev 1111) +++ trunk/treeview/Changelog 2006-08-08 00:08:42 UTC (rev 1112) @@ -1,3 +1,7 @@ +08/07/2006 Ian Lewis <Ian...@me...> + + * The Edit menu has been moved to jsXe core. + 08/03/2006 Ian Lewis <Ian...@me...> * Added some English tooltip messages to the Global Options Pane for the Modified: trunk/treeview/src/treeview/DefaultView.java =================================================================== --- trunk/treeview/src/treeview/DefaultView.java 2006-08-08 00:08:19 UTC (rev 1111) +++ trunk/treeview/src/treeview/DefaultView.java 2006-08-08 00:08:42 UTC (rev 1112) @@ -163,19 +163,6 @@ // });//}}} //}}} - //{{{ Construct Edit Menu - //TODO: get the keyboard shortcuts to work, - //TODO: get cut/copy/paste to work in the right hand text window - m_editMenu = new JMenu(Messages.getMessage("Edit.Menu")); - m_editMenu.setMnemonic('E'); - JMenuItem menuItem = new JMenuItem(ActionManager.getAction("cut")); - m_editMenu.add(menuItem); - menuItem = new JMenuItem(ActionManager.getAction("copy")); - m_editMenu.add(menuItem); - menuItem = new JMenuItem(ActionManager.getAction("paste")); - m_editMenu.add(menuItem); - //}}} - //{{{ Create and set up the splitpanes vertSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, treeView, attrView); vertSplitPane.setContinuousLayout(false); @@ -264,7 +251,7 @@ //{{{ getMenus() public JMenu[] getMenus() { - return new JMenu[] { m_editMenu }; + return null; }//}}} //{{{ getDocumentBuffer() @@ -531,7 +518,6 @@ private DocumentBuffer m_document; private boolean m_viewShown = false; private TreeViewPlugin m_plugin; - private JMenu m_editMenu; private EditTagDialog.ComboValueRenderer m_comboRenderer = new EditTagDialog.ComboValueRenderer(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ian...@us...> - 2006-08-08 00:08:26
|
Revision: 1111 Author: ian_lewis Date: 2006-08-07 17:08:19 -0700 (Mon, 07 Aug 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1111&view=rev Log Message: ----------- Moved the edit menu to jsXe core and added a hack so that undo will work Modified Paths: -------------- trunk/sourceview/Changelog trunk/sourceview/src/sourceview/SourceView.java trunk/sourceview/src/sourceview/SourceViewDocument.java Modified: trunk/sourceview/Changelog =================================================================== --- trunk/sourceview/Changelog 2006-08-08 00:07:37 UTC (rev 1110) +++ trunk/sourceview/Changelog 2006-08-08 00:08:19 UTC (rev 1111) @@ -1,3 +1,7 @@ +08/07/2006 Ian Lewis <Ian...@me...> + + * Moved the edit menu to jsXe core and added a hack so that undo will work. + 07/26/2006 Ian Lewis <Ian...@me...> * Addded support for the findnext action Modified: trunk/sourceview/src/sourceview/SourceView.java =================================================================== --- trunk/sourceview/src/sourceview/SourceView.java 2006-08-08 00:07:37 UTC (rev 1110) +++ trunk/sourceview/src/sourceview/SourceView.java 2006-08-08 00:08:19 UTC (rev 1111) @@ -39,6 +39,8 @@ import net.sourceforge.jsxe.dom.XMLDocument; import net.sourceforge.jsxe.dom.XMLDocumentListener; import net.sourceforge.jsxe.msg.PropertyChanged; +import net.sourceforge.jsxe.msg.UndoEvent; +import net.sourceforge.jsxe.msg.RedoEvent; import net.sourceforge.jsxe.util.Log; import net.sourceforge.jsxe.util.MiscUtilities; //}}} @@ -151,30 +153,6 @@ setLayout(new BorderLayout()); add(m_textarea, BorderLayout.CENTER); - //{{{ Construct Edit Menu - m_editMenu = new JMenu(Messages.getMessage("Edit.Menu")); - m_editMenu.setMnemonic('E'); - // These don't do anything yet. - // JMenuItem menuItem = new JMenuItem("Undo"); - // menuItem.addActionListener( new EditUndoAction() ); - // menu.add( menuItem ); - // menuItem = new JMenuItem("Redo"); - // menuItem.addActionListener( new EditRedoAction() ); - // menu.add(menuItem); - // menu.addSeparator(); - menuItem = new JMenuItem(ActionManager.getAction("cut")); - m_editMenu.add(menuItem); - menuItem = new JMenuItem(ActionManager.getAction("copy")); - m_editMenu.add(menuItem); - menuItem = new JMenuItem(ActionManager.getAction("paste")); - m_editMenu.add(menuItem); - m_editMenu.addSeparator(); - menuItem = new JMenuItem(ActionManager.getAction("find")); - m_editMenu.add(menuItem); - menuItem = new JMenuItem(ActionManager.getAction("findnext")); - m_editMenu.add(menuItem); - //}}} - setDocumentBuffer(document); //focus on the text area the first time the view is shown @@ -223,6 +201,18 @@ SourceViewOptionPane.parseStyle(jsXe.getProperty("source.invalid.color")), }); } + } else { + if ((message instanceof UndoEvent) || (message instanceof RedoEvent)) { + //hack to get undo to work properly + try { + int caret = m_textarea.getCaretPosition(); + m_textarea.setDocument(new SourceViewDocument(m_document)); + m_textarea.setTokenMarker(new XMLTokenMarker()); + m_textarea.setCaretPosition(caret); + } catch (IOException ioe) { + Log.log(Log.ERROR, this, ioe); + } + } } }//}}} @@ -260,7 +250,7 @@ //{{{ getMenus() public JMenu[] getMenus() { - return new JMenu[] { m_editMenu }; + return null; }//}}} //{{{ getDocumentBuffer() @@ -420,8 +410,6 @@ private String m_replaceString; private SourceViewPlugin m_plugin; - private JMenu m_editMenu; - //}}} } Modified: trunk/sourceview/src/sourceview/SourceViewDocument.java =================================================================== --- trunk/sourceview/src/sourceview/SourceViewDocument.java 2006-08-08 00:07:37 UTC (rev 1110) +++ trunk/sourceview/src/sourceview/SourceViewDocument.java 2006-08-08 00:08:19 UTC (rev 1111) @@ -55,6 +55,7 @@ import javax.swing.text.GapContent; import javax.swing.text.SimpleAttributeSet; import javax.swing.text.StyleContext; +import javax.swing.undo.UndoableEdit; //}}} //{{{ DOM classes @@ -73,6 +74,7 @@ /** * The Document model used by the SourceView for displaying the text of * an XML document. + * * @author <a href="mailto:IanLewis at member dot fsf dot org">Ian Lewis</a> * @version $Id$ * @see SourceView @@ -138,7 +140,27 @@ //}}} + //{{{ beginCompoundEdit() + + public void beginCompoundEdit() { + m_document.beginCompoundEdit(); + }//}}} + + //{{{ endCompoundEdit() + + public void endCompoundEdit() { + m_document.endCompoundEdit(); + }//}}} + + //{{{ addUndoableEdit() + + public void addUndoableEdit(UndoableEdit edit) { + // Log.log(Log.DEBUG, this, "adding edit"); + // m_document.addUndoableEdit(edit); + }//}}} + //{{{ Private members + private XMLDocument m_document; //}}} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ian...@us...> - 2006-08-08 00:07:54
|
Revision: 1110 Author: ian_lewis Date: 2006-08-07 17:07:37 -0700 (Mon, 07 Aug 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1110&view=rev Log Message: ----------- Added some Undo support Modified Paths: -------------- trunk/jsxe/AUTHORS trunk/jsxe/Changelog trunk/jsxe/messages/messages trunk/jsxe/src/net/sourceforge/jsxe/BufferHistory.java trunk/jsxe/src/net/sourceforge/jsxe/DocumentBuffer.java trunk/jsxe/src/net/sourceforge/jsxe/action/RedoAction.java trunk/jsxe/src/net/sourceforge/jsxe/action/UndoAction.java trunk/jsxe/src/net/sourceforge/jsxe/dom/XMLDocument.java trunk/jsxe/src/net/sourceforge/jsxe/gui/TabbedView.java trunk/jsxe/src/net/sourceforge/jsxe/msg/PropertyChanged.java trunk/jsxe/src/net/sourceforge/jsxe/properties Added Paths: ----------- trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/ trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/InsertEdit.java trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/RemoveEdit.java Modified: trunk/jsxe/AUTHORS =================================================================== --- trunk/jsxe/AUTHORS 2006-08-07 22:38:19 UTC (rev 1109) +++ trunk/jsxe/AUTHORS 2006-08-08 00:07:37 UTC (rev 1110) @@ -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: trunk/jsxe/Changelog =================================================================== --- trunk/jsxe/Changelog 2006-08-07 22:38:19 UTC (rev 1109) +++ trunk/jsxe/Changelog 2006-08-08 00:07:37 UTC (rev 1110) @@ -1,3 +1,7 @@ +08/07/2006 Ian Lewis <Ian...@me...> + + * Added temporary support for undo to jsXe. + 08/05/2006 Ian Lewis <Ian...@me...> * Added core support for Undo/Redo. Undo/Redo will temporarily be view @@ -6,7 +10,7 @@ 08/03/2006 Ian Lewis <Ian...@me...> - * Added Russian translation thanks to Segrer. + * Added Russian translation thanks to Alexandr Gridnev. 07/26/2006 Ian Lewis <Ian...@me...> Modified: trunk/jsxe/messages/messages =================================================================== --- trunk/jsxe/messages/messages 2006-08-07 22:38:19 UTC (rev 1109) +++ trunk/jsxe/messages/messages 2006-08-08 00:07:37 UTC (rev 1110) @@ -283,8 +283,7 @@ \ \ \ \ Swedish (sv) - Patrik Johansson <pa...@it...>\n\n\ Past Contributers:\n\ \ \ \ \ Aaron Flatten <afl...@us...>\n\ - \ \ \ \ Bilel Remmache <rb...@us...>\n\ - \ \ \ \ SVM <svm...@us...>\n\n\ + \ \ \ \ Bilel Remmache <rb...@us...>\n\n\ Homepage: http://jsxe.sourceforge.net/ #}}} Modified: trunk/jsxe/src/net/sourceforge/jsxe/BufferHistory.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/BufferHistory.java 2006-08-07 22:38:19 UTC (rev 1109) +++ trunk/jsxe/src/net/sourceforge/jsxe/BufferHistory.java 2006-08-08 00:07:37 UTC (rev 1110) @@ -239,7 +239,7 @@ // Enumeration propertyItr = props.keys(); // while (propertyItr.hasMoreElements()) { // String key = propertyItr.nextElement().toString(); - // if (!m_excludeKeys.contains(key)) { + // if (m_includeKeys.contains(key)) { // String value = props.getProperty(key); // out.write("<property name=\""); // out.write(key); @@ -304,7 +304,7 @@ Enumeration propertyItr = props.keys(); while (propertyItr.hasMoreElements()) { String key = propertyItr.nextElement().toString(); - if (!m_excludeKeys.contains(key)) { + if (m_includeKeys.contains(key)) { try { String value = props.getProperty(key); Element property = (Element)entryNode.appendChild(document.createElement("property")); @@ -453,7 +453,7 @@ propValue = attributes.getValue(i); } } - if (!m_excludeKeys.contains(propName) && propName != null && propValue != null) { + if (m_includeKeys.contains(propName) && propName != null && propValue != null) { m_m_properties.setProperty(propName, propValue); } } @@ -469,11 +469,16 @@ }//}}} private ArrayList m_history = new ArrayList(); - private static ArrayList m_excludeKeys; + private static ArrayList m_includeKeys; static { - m_excludeKeys = new ArrayList(); - m_excludeKeys.add(DocumentBuffer.LINE_SEPARATOR); + m_includeKeys = new ArrayList(); + m_includeKeys.add(DocumentBuffer.ENCODING); + m_includeKeys.add(DocumentBuffer.FORMAT_XML); + m_includeKeys.add(DocumentBuffer.WS_IN_ELEMENT_CONTENT); + m_includeKeys.add(DocumentBuffer.INDENT); + m_includeKeys.add(DocumentBuffer.IS_USING_SOFT_TABS); + m_includeKeys.add(DocumentBuffer.IS_VALIDATING); } //}}} Modified: trunk/jsxe/src/net/sourceforge/jsxe/DocumentBuffer.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/DocumentBuffer.java 2006-08-07 22:38:19 UTC (rev 1109) +++ trunk/jsxe/src/net/sourceforge/jsxe/DocumentBuffer.java 2006-08-08 00:07:37 UTC (rev 1110) @@ -803,5 +803,6 @@ private ArrayList m_listeners = new ArrayList(); private boolean m_dirty=false; private OptionPane m_optionPane; + //}}} } Modified: trunk/jsxe/src/net/sourceforge/jsxe/action/RedoAction.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/action/RedoAction.java 2006-08-07 22:38:19 UTC (rev 1109) +++ trunk/jsxe/src/net/sourceforge/jsxe/action/RedoAction.java 2006-08-08 00:07:37 UTC (rev 1110) @@ -67,11 +67,7 @@ //{{{ invoke() public void invoke(TabbedView view, ActionEvent evt) { - /* - invoke the action registered for the current DocumentView named - viewname.redo if there is one. - */ - ActionManager.invokeAction(jsXe.getPluginLoader().getPluginProperty(view.getDocumentView().getViewPlugin(), JARClassLoader.PLUGIN_NAME)+ActionManager.REDO_SUFFIX, evt); + view.getDocumentBuffer().redo(); }//}}} } Modified: trunk/jsxe/src/net/sourceforge/jsxe/action/UndoAction.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/action/UndoAction.java 2006-08-07 22:38:19 UTC (rev 1109) +++ trunk/jsxe/src/net/sourceforge/jsxe/action/UndoAction.java 2006-08-08 00:07:37 UTC (rev 1110) @@ -46,8 +46,7 @@ //}}} /** - * The undo action invokes a DocumentView specific action defined for undo. - * The action should be defined by the view as <i>viewname</i>.undo + * The undo action invokes a undo on the current XMLDocument. * * @author Ian Lewis (<a href="mailto:Ian...@me...">Ian...@me...</a>) * @version $Id$ @@ -67,11 +66,7 @@ //{{{ invoke() public void invoke(TabbedView view, ActionEvent evt) { - /* - invoke the action registered for the current DocumentView named - viewname.undo if there is one. - */ - ActionManager.invokeAction(jsXe.getPluginLoader().getPluginProperty(view.getDocumentView().getViewPlugin(), JARClassLoader.PLUGIN_NAME)+ActionManager.UNDO_SUFFIX, evt); + view.getDocumentBuffer().undo(); }//}}} } Modified: trunk/jsxe/src/net/sourceforge/jsxe/dom/XMLDocument.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/dom/XMLDocument.java 2006-08-07 22:38:19 UTC (rev 1109) +++ trunk/jsxe/src/net/sourceforge/jsxe/dom/XMLDocument.java 2006-08-08 00:07:37 UTC (rev 1110) @@ -25,17 +25,16 @@ package net.sourceforge.jsxe.dom; //{{{ imports -/* -All classes are listed explicitly so -it is easy to see which package it -belongs to. -*/ //{{{ jsXe classes import net.sourceforge.jsxe.jsXe; +import net.sourceforge.jsxe.EditBus; +import net.sourceforge.jsxe.msg.RedoEvent; +import net.sourceforge.jsxe.msg.UndoEvent; import net.sourceforge.jsxe.util.Log; import net.sourceforge.jsxe.util.MiscUtilities; import net.sourceforge.jsxe.dom.completion.*; +import net.sourceforge.jsxe.dom.undo.*; //}}} //{{{ DOM classes @@ -69,6 +68,8 @@ import java.net.URI; //}}} +import javax.swing.undo.*; + //}}} /** @@ -164,6 +165,7 @@ setURI(uri); setModel(reader); reader.close(); + m_undoManager.setLimit(jsXe.getIntegerProperty("undo.limit", 100)); }//}}} //{{{ XMLDocument constructor @@ -189,29 +191,135 @@ setModel(reader); reader.close(); + m_undoManager.setLimit(jsXe.getIntegerProperty("undo.limit", 100)); }//}}} - //{{{ checkWellFormedness() + //{{{ undo methods + + //{{{ addUndoableEdit() /** - * Checks the wellformedness of the document and throws appropriate - * exceptions based on the errors encountered during parsing. - * @return true if the document is well formed. - * @throws SAXParseException if there was a SAX error when parsing. - * @throws SAXException if there was a problem with the SAX parser. - * @throws ParserConfigurationException if the parser is not configured properly - * @throws IOException if there was a problem reading the document + * Allows views and editors to add additional undoable events. Generally + * the edits added by classes that are not this class, classes in this + * package, or a subclass will not be significant. + * + * @return true if the edit was added successfully */ - 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; + public boolean addUndoableEdit(UndoableEdit edit) { + if (insideCompoundEdit()) { + m_addedToCompoundEdits = true; + return ((CompoundEdit)m_compoundEdits.peek()).addEdit(edit); + } else { + return m_undoManager.addEdit(edit); } - return m_parsedMode; }//}}} + //{{{ beginCompoundEdit() + /** + * Begins a compound edit. A compound edit is an edit that will be + * undone/redone all at once. + */ + public void beginCompoundEdit() { + Log.log(Log.DEBUG, this, "begin compound edit"); + m_addedToCompoundEdits = false; + m_compoundEdits.push(new CompoundEdit()); + }//}}} + + //{{{ endCompoundEdit() + /** + * Ends a compound edit. A compound edit is an edit that will be + * undone/redone all at once. + */ + public void endCompoundEdit() { + if (!insideCompoundEdit()) { + Log.log(Log.WARNING, this, new Exception("Unbalanced begin/endCompoundEdit()")); + return; + } + Log.log(Log.DEBUG, this, "end compound edit"); + if (m_addedToCompoundEdits) { + CompoundEdit edit = (CompoundEdit)m_compoundEdits.pop(); + edit.end(); + m_undoManager.addEdit(edit); + } + }//}}} + + //{{{ insideCompoundEdit() + /** + * Gets whether the document is in a compound edit. A compound edit is an + * edit that will be undone/redone all at once. + */ + public boolean insideCompoundEdit() { + return m_compoundEdits.size() != 0; + }//}}} + + //{{{ undo() + + public void undo() { + if (insideCompoundEdit()) { + throw new InternalError("Unbalanced begin/endCompoundEdit()"); + } + try { + setFlag(UNDO_IN_PROGRESS, true); + m_undoManager.undo(); + EditBus.send(new UndoEvent(this)); + } catch (CannotUndoException e) { + Log.log(Log.WARNING, this, e); + } finally { + setFlag(UNDO_IN_PROGRESS, false); + } + }//}}} + + //{{{ redo() + + public void redo() { + if (insideCompoundEdit()) { + throw new InternalError("Unbalanced begin/endCompoundEdit()"); + } + try { + setFlag(UNDO_IN_PROGRESS, true); + m_undoManager.redo(); + EditBus.send(new RedoEvent(this)); + } catch (CannotRedoException e) { + Log.log(Log.WARNING, this, e); + } finally { + setFlag(UNDO_IN_PROGRESS, false); + } + }//}}} + + //}}} + + //{{{ Property methods + + //{{{ getProperties() + /** + * Gets all properties associated with this document. + * @return the document's properties + */ + public Properties getProperties() { + return props; + }//}}} + + //{{{ getProperty() + /** + * Gets a property for the key given. + * @param key the key to the properties list + * @return the value of the property for the given key. + */ + public String getProperty(String key) { + return props.getProperty(key); + }//}}} + + //{{{ getProperty() + /** + * Gets a property for the key given or returns the default value + * if there is no property for the given key. + * @param key the key to the properties list + * @param defaultValue the default value for the property requested + * @return the value of the property for the given key. + */ + public String getProperty(String key, String defaultValue) { + return props.getProperty(key, defaultValue); + }//}}} + //{{{ setProperty() /** * Sets a property of the XMLDocument @@ -270,6 +378,84 @@ return oldValue; }//}}} + //{{{ getBooleanProperty() method + /** + * Returns the value of a boolean property. This method is thread-safe. + * @param name The property name + */ + public boolean getBooleanProperty(String name) { + String obj = getProperty(name); + if (obj == null) { + return false; + } + + return Boolean.valueOf(obj).booleanValue(); + } //}}} + + //{{{ setBooleanProperty() method + /** + * Sets a boolean property. + * @param name The property name + * @param value The value + */ + public void setBooleanProperty(String name, boolean value) { + setProperty(name, Boolean.toString(value)); + } //}}} + + //{{{ getIntegerProperty() method + /** + * Returns the value of an integer property. This method is thread-safe. + * @param name The property name + */ + public int getIntegerProperty(String name, int defaultValue) { + + boolean defaultValueFlag; + String obj = getProperty(name); + + if (obj == null) { + return defaultValue; + } else { + try { + return Integer.parseInt(obj); + } catch (NumberFormatException e) { + return defaultValue; + } + } + } //}}} + + //{{{ setIntegerProperty() method + /** + * Sets an integer property. + * @param name The property name + * @param value The value + */ + public void setIntegerProperty(String name, int value) { + setProperty(name, Integer.toString(value)); + } //}}} + + //}}} + + //{{{ checkWellFormedness() + /** + * Checks the wellformedness of the document and throws appropriate + * exceptions based on the errors encountered during parsing. + * @return true if the document is well formed. + * @throws SAXParseException if there was a SAX error when parsing. + * @throws SAXException if there was a problem with the SAX parser. + * @throws ParserConfigurationException if the parser is not configured properly + * @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; + } + return m_parsedMode; + }//}}} + //{{{ getDocumentCopy() /** * Gets a copy of the underlying Document object. @@ -312,37 +498,6 @@ return docType; }//}}} - //{{{ getProperties() - /** - * Gets all properties associated with this document. - * @return the document's properties - */ - public Properties getProperties() { - return props; - }//}}} - - //{{{ getProperty() - /** - * Gets a property for the key given. - * @param key the key to the properties list - * @return the value of the property for the given key. - */ - public String getProperty(String key) { - return props.getProperty(key); - }//}}} - - //{{{ getProperty() - /** - * Gets a property for the key given or returns the default value - * if there is no property for the given key. - * @param key the key to the properties list - * @param defaultValue the default value for the property requested - * @return the value of the property for the given key. - */ - public String getProperty(String key, String defaultValue) { - return props.getProperty(key, defaultValue); - }//}}} - //{{{ getRootElementNode() /** * A convenience method that returns the root element node of the document. @@ -765,12 +920,14 @@ */ 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; - //may have some algorithm to determine the modified node(s) in the - //future + if (!getFlag(UNDO_IN_PROGRESS)) { + addUndoableEdit(new InsertEdit(this, offset, text)); + } fireStructureChanged(null); } }//}}} @@ -784,12 +941,14 @@ */ public void removeText(int offset, int length) throws IOException { if (length > 0) { - syncContentWithDOM(); + String text = getText(offset,length); + Log.log(Log.DEBUG, this, "removeText: "+offset+": "+text); m_content.remove(offset, length); m_parsedMode = false; m_adapterNode = null; - //may have some algorithm to determine the modified node(s) in the - //future + if (!getFlag(UNDO_IN_PROGRESS)) { + addUndoableEdit(new RemoveEdit(this, offset, text)); + } fireStructureChanged(null); } }//}}} @@ -1021,6 +1180,31 @@ //{{{ Private members + //{{{ Flags + + //{{{ setFlag() method + private void setFlag(int flag, boolean value) { + if(value) { + flags |= (1 << flag); + } else { + flags &= ~(1 << flag); + } + } //}}} + + //{{{ getFlag() method + private boolean getFlag(int flag) { + int mask = (1 << flag); + return (flags & mask) == mask; + } //}}} + + //{{{ Flag values + private static final int UNDO_IN_PROGRESS = 9; + //}}} + + private int flags; + + //}}} + //{{{ setDefaultProperties() private void setDefaultProperties() { @@ -2073,6 +2257,10 @@ */ private HashMap m_mappings; + private UndoManager m_undoManager = new UndoManager(); + private Stack m_compoundEdits = new Stack(); + private boolean m_addedToCompoundEdits = false; + // private XMLDocAdapterListener docAdapterListener = new XMLDocAdapterListener(); //}}} Added: trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/InsertEdit.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/InsertEdit.java (rev 0) +++ trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/InsertEdit.java 2006-08-08 00:07:37 UTC (rev 1110) @@ -0,0 +1,84 @@ +/* +InsertEdit.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.undo; + +//{{{ imports + +//{{{ jsXe classes +import net.sourceforge.jsxe.dom.XMLDocument; +//}}} + +//{{{ Swing classes +import javax.swing.undo.*; +//}}} + +import java.io.IOException; + +//}}} + +/** + * An undoable edit sigifying an insert into an XMLDocument. + * + * @author Ian Lewis (<a href="mailto:Ian...@me...">Ian...@me...</a>) + * @version $Id$ + * @see net.sourceforge.jsxe.dom.XMLDocument + */ +public class InsertEdit extends AbstractUndoableEdit { + + private XMLDocument m_document; + private String m_text; + private int m_offset; + + //{{{ InsertEdit constructor + + public InsertEdit(XMLDocument document, int offset, String text) { + m_document = document; + m_offset = offset; + m_text = text; + }//}}} + + //{{{ undo() + + public void undo() throws CannotUndoException { + super.undo(); + try { + m_document.removeText(m_offset, m_text.length()); + } catch (IOException ioe) { + throw new CannotUndoException(); + } + }//}}} + + //{{{ redo() + + public void redo() throws CannotRedoException { + super.redo(); + try { + m_document.insertText(m_offset, m_text); + } catch (IOException ioe) { + throw new CannotRedoException(); + } + }//}}} + +} \ No newline at end of file Property changes on: trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/InsertEdit.java ___________________________________________________________________ Name: svn:executable + * Added: trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/RemoveEdit.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/RemoveEdit.java (rev 0) +++ trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/RemoveEdit.java 2006-08-08 00:07:37 UTC (rev 1110) @@ -0,0 +1,84 @@ +/* +RemoveEdit.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.undo; + +//{{{ imports + +//{{{ jsXe classes +import net.sourceforge.jsxe.dom.XMLDocument; +//}}} + +//{{{ Swing classes +import javax.swing.undo.*; +//}}} + +import java.io.IOException; + +//}}} + +/** + * An undoable edit sigifying a removal from an XMLDocument. + * + * @author Ian Lewis (<a href="mailto:Ian...@me...">Ian...@me...</a>) + * @version $Id$ + * @see net.sourceforge.jsxe.dom.XMLDocument + */ +public class RemoveEdit extends AbstractUndoableEdit { + + private XMLDocument m_document; + private String m_text; + private int m_offset; + + //{{{ RemoveEdit constructor + + public RemoveEdit(XMLDocument document, int offset, String text) { + m_document = document; + m_offset = offset; + m_text = text; + }//}}} + + //{{{ undo() + + public void undo() throws CannotUndoException { + super.undo(); + try { + m_document.insertText(m_offset, m_text); + } catch (IOException ioe) { + throw new CannotUndoException(); + } + }//}}} + + //{{{ redo() + + public void redo() throws CannotRedoException { + super.redo(); + try { + m_document.removeText(m_offset, m_text.length()); + } catch (IOException ioe) { + throw new CannotUndoException(); + } + }//}}} + +} \ No newline at end of file Property changes on: trunk/jsxe/src/net/sourceforge/jsxe/dom/undo/RemoveEdit.java ___________________________________________________________________ Name: svn:executable + * Modified: trunk/jsxe/src/net/sourceforge/jsxe/gui/TabbedView.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/gui/TabbedView.java 2006-08-07 22:38:19 UTC (rev 1109) +++ trunk/jsxe/src/net/sourceforge/jsxe/gui/TabbedView.java 2006-08-08 00:07:37 UTC (rev 1110) @@ -427,7 +427,9 @@ updateRecentFilesMenu(); menubar.add(m_fileMenu); - + + menubar.add(m_editMenu); + //Add View Specific Menus JMenu[] menus = currentDocView.getMenus(); if (menus != null) { @@ -603,6 +605,27 @@ m_fileMenu.add( menuItem ); //}}} + //{{{ Create Edit Menu + m_editMenu = new JMenu(Messages.getMessage("Edit.Menu")); + m_editMenu.setMnemonic('E'); + menuItem = new JMenuItem(ActionManager.getAction("undo")); + m_editMenu.add(menuItem); + menuItem = new JMenuItem(ActionManager.getAction("redo")); + m_editMenu.add(menuItem); + m_editMenu.addSeparator(); + menuItem = new JMenuItem(ActionManager.getAction("cut")); + m_editMenu.add(menuItem); + menuItem = new JMenuItem(ActionManager.getAction("copy")); + m_editMenu.add(menuItem); + menuItem = new JMenuItem(ActionManager.getAction("paste")); + m_editMenu.add(menuItem); + m_editMenu.addSeparator(); + menuItem = new JMenuItem(ActionManager.getAction("find")); + m_editMenu.add(menuItem); + menuItem = new JMenuItem(ActionManager.getAction("findnext")); + m_editMenu.add(menuItem); + //}}} + //{{{ Create View Menu m_viewMenu = new JMenu(Messages.getMessage("View.Menu")); m_viewMenu.setMnemonic('V'); @@ -797,6 +820,7 @@ }//}}} private JMenu m_fileMenu; + private JMenu m_editMenu; private JMenu m_viewMenu; private JMenu m_toolsMenu; private JMenu m_helpMenu; Modified: trunk/jsxe/src/net/sourceforge/jsxe/msg/PropertyChanged.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/msg/PropertyChanged.java 2006-08-07 22:38:19 UTC (rev 1109) +++ trunk/jsxe/src/net/sourceforge/jsxe/msg/PropertyChanged.java 2006-08-08 00:07:37 UTC (rev 1110) @@ -39,7 +39,6 @@ //{{{ PropertyChanged constructor /** * Creates a new PropertyChanged message. - * @param source the object that changed the properties * @param */ public PropertyChanged(String key, String oldValue) { Modified: trunk/jsxe/src/net/sourceforge/jsxe/properties =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/properties 2006-08-07 22:38:19 UTC (rev 1109) +++ trunk/jsxe/src/net/sourceforge/jsxe/properties 2006-08-08 00:07:37 UTC (rev 1110) @@ -13,6 +13,8 @@ # Resource Cache xml.cache=true +undo.limit=100 + #{{{ 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-08-07 22:38:25
|
Revision: 1109 Author: ian_lewis Date: 2006-08-07 15:38:19 -0700 (Mon, 07 Aug 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1109&view=rev Log Message: ----------- Removed debug Modified Paths: -------------- trunk/jsxe/src/net/sourceforge/jsxe/ActionManager.java Modified: trunk/jsxe/src/net/sourceforge/jsxe/ActionManager.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/ActionManager.java 2006-08-07 21:53:57 UTC (rev 1108) +++ trunk/jsxe/src/net/sourceforge/jsxe/ActionManager.java 2006-08-07 22:38:19 UTC (rev 1109) @@ -79,8 +79,6 @@ public static final String PASTE_SUFFIX = ".paste"; public static final String FIND_SUFFIX = ".find"; public static final String FIND_NEXT_SUFFIX = ".findnext"; - public static final String UNDO_SUFFIX = ".undo"; - public static final String REDO_SUFFIX = ".redo"; //}}} @@ -216,9 +214,9 @@ KeyEventTranslator.Key key = KeyEventTranslator.parseKey(keyBinding); m_keyBindingMap.put(key, wrapper); - Log.log(Log.DEBUG, ActionManager.class, "Adding binding: "+key.toString()); - Log.log(Log.DEBUG, ActionManager.class, "key.key: "+key.key); - Log.log(Log.DEBUG, ActionManager.class, "key.input: "+key.input); + // Log.log(Log.DEBUG, ActionManager.class, "Adding binding: "+key.toString()); + // Log.log(Log.DEBUG, ActionManager.class, "key.key: "+key.key); + // Log.log(Log.DEBUG, ActionManager.class, "key.input: "+key.input); //need to do this so that the accelerator key is rendered on menu items wrapper.putValue(Action.ACCELERATOR_KEY, KeyEventTranslator.getKeyStroke(keyBinding)); @@ -252,14 +250,14 @@ */ public static void handleKey(KeyEvent event) { KeyEventTranslator.Key key = KeyEventTranslator.translateKeyEvent(event); - Log.log(Log.DEBUG, ActionManager.class, "Key: "+key.toString()); - Log.log(Log.DEBUG, ActionManager.class, "key.key: "+key.key); - Log.log(Log.DEBUG, ActionManager.class, "key.input: "+key.input); + // Log.log(Log.DEBUG, ActionManager.class, "Key: "+key.toString()); + // Log.log(Log.DEBUG, ActionManager.class, "key.key: "+key.key); + // Log.log(Log.DEBUG, ActionManager.class, "key.input: "+key.input); //Gets the action for the Key. Action action = (Action)m_keyBindingMap.get(key); if (action != null) { - Log.log(Log.DEBUG, ActionManager.class, "Key mapping match for "+((Wrapper)action).getName()); + // Log.log(Log.DEBUG, ActionManager.class, "Key mapping match for "+((Wrapper)action).getName()); action.actionPerformed(translateKeyEvent(event)); event.consume(); } @@ -274,9 +272,7 @@ actionName.endsWith(COPY_SUFFIX) || actionName.endsWith(PASTE_SUFFIX) || actionName.endsWith(FIND_SUFFIX) || - actionName.endsWith(FIND_NEXT_SUFFIX) || - actionName.endsWith(UNDO_SUFFIX) || - actionName.endsWith(REDO_SUFFIX)); + actionName.endsWith(FIND_NEXT_SUFFIX)); }//}}} //{{{ Wrapper class @@ -353,7 +349,7 @@ private static void removeKeyBinding(KeyEventTranslator.Key key) { Action action = (Action)m_keyBindingMap.get(key); if (action != null) { - Log.log(Log.DEBUG, ActionManager.class, "removing key binding: "+key.toString()); + // Log.log(Log.DEBUG, ActionManager.class, "removing key binding: "+key.toString()); action.putValue(Action.ACCELERATOR_KEY, null); m_keyBindingMap.remove(key); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ian...@us...> - 2006-08-07 21:54:12
|
Revision: 1108 Author: ian_lewis Date: 2006-08-07 14:53:57 -0700 (Mon, 07 Aug 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1108&view=rev Log Message: ----------- Backed out changes for undo in the source view Modified Paths: -------------- trunk/sourceview/Changelog trunk/sourceview/src/sourceview/SourceView.java trunk/sourceview/src/sourceview/SourceViewDocument.java trunk/sourceview/src/sourceview/SourceViewPlugin.java Removed Paths: ------------- trunk/sourceview/src/sourceview/action/RedoAction.java trunk/sourceview/src/sourceview/action/UndoAction.java Modified: trunk/sourceview/Changelog =================================================================== --- trunk/sourceview/Changelog 2006-08-07 19:50:51 UTC (rev 1107) +++ trunk/sourceview/Changelog 2006-08-07 21:53:57 UTC (rev 1108) @@ -1,7 +1,3 @@ -08/05/2006 Ian Lewis <Ian...@me...> - - * Added undo to the source view - 07/26/2006 Ian Lewis <Ian...@me...> * Addded support for the findnext action Modified: trunk/sourceview/src/sourceview/SourceView.java =================================================================== --- trunk/sourceview/src/sourceview/SourceView.java 2006-08-07 19:50:51 UTC (rev 1107) +++ trunk/sourceview/src/sourceview/SourceView.java 2006-08-07 21:53:57 UTC (rev 1108) @@ -155,11 +155,13 @@ m_editMenu = new JMenu(Messages.getMessage("Edit.Menu")); m_editMenu.setMnemonic('E'); // These don't do anything yet. - menuItem = new JMenuItem(ActionManager.getAction("undo")); - m_editMenu.add( menuItem ); - menuItem = new JMenuItem(ActionManager.getAction("redo")); - m_editMenu.add(menuItem); - m_editMenu.addSeparator(); + // JMenuItem menuItem = new JMenuItem("Undo"); + // menuItem.addActionListener( new EditUndoAction() ); + // menu.add( menuItem ); + // menuItem = new JMenuItem("Redo"); + // menuItem.addActionListener( new EditRedoAction() ); + // menu.add(menuItem); + // menu.addSeparator(); menuItem = new JMenuItem(ActionManager.getAction("cut")); m_editMenu.add(menuItem); menuItem = new JMenuItem(ActionManager.getAction("copy")); Modified: trunk/sourceview/src/sourceview/SourceViewDocument.java =================================================================== --- trunk/sourceview/src/sourceview/SourceViewDocument.java 2006-08-07 19:50:51 UTC (rev 1107) +++ trunk/sourceview/src/sourceview/SourceViewDocument.java 2006-08-07 21:53:57 UTC (rev 1108) @@ -55,10 +55,6 @@ import javax.swing.text.GapContent; import javax.swing.text.SimpleAttributeSet; import javax.swing.text.StyleContext; -import javax.swing.event.DocumentEvent; -import javax.swing.event.UndoableEditListener; -import javax.swing.event.UndoableEditEvent; -import javax.swing.undo.*; //}}} //{{{ DOM classes @@ -100,103 +96,50 @@ //buffer is actually loaded in the text area at any //given time(?) super.insertString(0, document.getText(0,document.getLength()), null); - m_initialized = true; } catch (BadLocationException ble) { Log.log(Log.ERROR, this, ble); } } - - addUndoableEditListener(new UndoableEditListener() { - public void undoableEditHappened(UndoableEditEvent e) { - m_undoManager.addEdit(e.getEdit()); - } - }); }//}}} //{{{ DefaultStyledDocument methods - // //{{{ insertString() + //{{{ insertString() - // public void insertString(int offs, String str, AttributeSet a) throws BadLocationException { - // Log.log(Log.DEBUG, this, "insert: "+str); - // try { - // super.insertString(offs, str, a); - // m_document.insertText(offs, str); - // } catch (DOMException dome) { - // Log.log(Log.ERROR, this, dome); - // Toolkit.getDefaultToolkit().beep(); - // } catch (IOException ioe) { - // Log.log(Log.ERROR, this, ioe); - // } - - // }//}}} - - // //{{{ remove() - - // public void remove(int offs, int len) throws BadLocationException { - // Log.log(Log.DEBUG, this, "remove"); - // try { - // super.remove(offs, len); - // m_document.removeText(offs, len); - // } catch (DOMException dome) { - // Log.log(Log.ERROR, this, dome); - // Toolkit.getDefaultToolkit().beep(); - // } catch (IOException ioe) { - // Log.log(Log.ERROR, this, ioe); - // } + public void insertString(int offs, String str, AttributeSet a) throws BadLocationException { - // }//}}} - - protected void fireInsertUpdate(DocumentEvent e) { try { - Log.log(Log.DEBUG, this, "insert: "+getText(e.getOffset(), e.getLength())); - if (m_initialized) { - m_document.insertText(e.getOffset(), getText(e.getOffset(), e.getLength())); - } - super.fireInsertUpdate(e); + super.insertString(offs, str, a); + m_document.insertText(offs, str); + } catch (DOMException dome) { + Log.log(Log.ERROR, this, dome); + Toolkit.getDefaultToolkit().beep(); } catch (IOException ioe) { Log.log(Log.ERROR, this, ioe); - } catch (BadLocationException ble) { - Log.log(Log.ERROR, this, ble); } - } + + }//}}} + + //{{{ remove() - protected void fireRemoveUpdate(DocumentEvent e) { + public void remove(int offs, int len) throws BadLocationException { + try { - Log.log(Log.DEBUG, this, "remove: "+e.getOffset()+":"+e.getLength()); - if (m_initialized) { - m_document.removeText(e.getOffset(), e.getLength()); - } - super.fireRemoveUpdate(e); + super.remove(offs, len); + m_document.removeText(offs, len); + } catch (DOMException dome) { + Log.log(Log.ERROR, this, dome); + Toolkit.getDefaultToolkit().beep(); } catch (IOException ioe) { Log.log(Log.ERROR, this, ioe); } - } - + + }//}}} + //}}} - //{{{ undo() - public void undo() { - try { - m_undoManager.undo(); - } catch (CannotUndoException e) { - Log.log(Log.WARNING, this, "Cannot undo"); - } - }//}}} - - //{{{ redo() - public void redo() throws CannotUndoException { - try { - m_undoManager.redo(); - } catch (CannotUndoException e) { - Log.log(Log.WARNING, this, "Cannot redo"); - } - }//}}} - //{{{ Private members - private boolean m_initialized = false; private XMLDocument m_document; - private UndoManager m_undoManager = new UndoManager(); //}}} } Modified: trunk/sourceview/src/sourceview/SourceViewPlugin.java =================================================================== --- trunk/sourceview/src/sourceview/SourceViewPlugin.java 2006-08-07 19:50:51 UTC (rev 1107) +++ trunk/sourceview/src/sourceview/SourceViewPlugin.java 2006-08-07 21:53:57 UTC (rev 1108) @@ -65,8 +65,6 @@ addAction(new EditPasteAction()); addAction(new EditFindAction()); addAction(new EditFindNextAction()); - addAction(new UndoAction()); - addAction(new RedoAction()); }//}}} //{{{ newDocumentView() Deleted: trunk/sourceview/src/sourceview/action/RedoAction.java =================================================================== --- trunk/sourceview/src/sourceview/action/RedoAction.java 2006-08-07 19:50:51 UTC (rev 1107) +++ trunk/sourceview/src/sourceview/action/RedoAction.java 2006-08-07 21:53:57 UTC (rev 1108) @@ -1,74 +0,0 @@ -/* -RedoAction.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 sourceview.action; - -//{{{ imports - -import sourceview.*; - -//{{{ jsXe classes -import net.sourceforge.jsxe.jsXe; -import net.sourceforge.jsxe.ActionManager; -import net.sourceforge.jsxe.LocalizedAction; -import net.sourceforge.jsxe.gui.TabbedView; -import net.sourceforge.jsxe.gui.Messages; -import net.sourceforge.jsxe.gui.DocumentView; -import net.sourceforge.jsxe.util.Log; -//}}} - -//{{{ AWT classes -import java.awt.event.ActionEvent; -//}}} - -//}}} - -/** - * This action that redoes the last action made in the source view. - * - * @author Ian Lewis (<a href="mailto:Ian...@me...">Ian...@me...</a>) - * @version $Id$ - */ -public class RedoAction extends LocalizedAction { - - //{{{ RedoAction constructor - public RedoAction() { - super(SourceViewPlugin.PLUGIN_NAME+ActionManager.REDO_SUFFIX); - }//}}} - - //{{{ getLabel() - public String getLabel() { - return Messages.getMessage("common.redo"); - }//}}} - - //{{{ invoke() - public void invoke(TabbedView view, ActionEvent evt) { - DocumentView docView = view.getDocumentView(); - if (docView instanceof SourceView) { - SourceView sourceView = (SourceView)docView; - ((SourceViewDocument)sourceView.getTextArea().getDocument()).redo(); - } - }//}}} - -} Deleted: trunk/sourceview/src/sourceview/action/UndoAction.java =================================================================== --- trunk/sourceview/src/sourceview/action/UndoAction.java 2006-08-07 19:50:51 UTC (rev 1107) +++ trunk/sourceview/src/sourceview/action/UndoAction.java 2006-08-07 21:53:57 UTC (rev 1108) @@ -1,74 +0,0 @@ -/* -UndoAction.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 sourceview.action; - -//{{{ imports - -import sourceview.*; - -//{{{ jsXe classes -import net.sourceforge.jsxe.jsXe; -import net.sourceforge.jsxe.ActionManager; -import net.sourceforge.jsxe.LocalizedAction; -import net.sourceforge.jsxe.gui.TabbedView; -import net.sourceforge.jsxe.gui.Messages; -import net.sourceforge.jsxe.gui.DocumentView; -import net.sourceforge.jsxe.util.Log; -//}}} - -//{{{ AWT classes -import java.awt.event.ActionEvent; -//}}} - -//}}} - -/** - * This action that undoes the last action made in the source view. - * - * @author Ian Lewis (<a href="mailto:Ian...@me...">Ian...@me...</a>) - * @version $Id$ - */ -public class UndoAction extends LocalizedAction { - - //{{{ UndoAction constructor - public UndoAction() { - super(SourceViewPlugin.PLUGIN_NAME+ActionManager.UNDO_SUFFIX); - }//}}} - - //{{{ getLabel() - public String getLabel() { - return Messages.getMessage("common.undo"); - }//}}} - - //{{{ invoke() - public void invoke(TabbedView view, ActionEvent evt) { - DocumentView docView = view.getDocumentView(); - if (docView instanceof SourceView) { - SourceView sourceView = (SourceView)docView; - ((SourceViewDocument)sourceView.getTextArea().getDocument()).undo(); - } - }//}}} - -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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-05 21:41:22
|
Revision: 1106 Author: ian_lewis Date: 2006-08-05 14:41:13 -0700 (Sat, 05 Aug 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1106&view=rev Log Message: ----------- Added Undo to the source view Modified Paths: -------------- trunk/sourceview/Changelog trunk/sourceview/src/sourceview/SourceView.java trunk/sourceview/src/sourceview/SourceViewDocument.java trunk/sourceview/src/sourceview/SourceViewPlugin.java Added Paths: ----------- trunk/sourceview/src/sourceview/action/RedoAction.java trunk/sourceview/src/sourceview/action/UndoAction.java Modified: trunk/sourceview/Changelog =================================================================== --- trunk/sourceview/Changelog 2006-08-05 20:24:09 UTC (rev 1105) +++ trunk/sourceview/Changelog 2006-08-05 21:41:13 UTC (rev 1106) @@ -1,3 +1,7 @@ +08/05/2006 Ian Lewis <Ian...@me...> + + * Added undo to the source view + 07/26/2006 Ian Lewis <Ian...@me...> * Addded support for the findnext action Modified: trunk/sourceview/src/sourceview/SourceView.java =================================================================== --- trunk/sourceview/src/sourceview/SourceView.java 2006-08-05 20:24:09 UTC (rev 1105) +++ trunk/sourceview/src/sourceview/SourceView.java 2006-08-05 21:41:13 UTC (rev 1106) @@ -155,13 +155,11 @@ m_editMenu = new JMenu(Messages.getMessage("Edit.Menu")); m_editMenu.setMnemonic('E'); // These don't do anything yet. - // JMenuItem menuItem = new JMenuItem("Undo"); - // menuItem.addActionListener( new EditUndoAction() ); - // menu.add( menuItem ); - // menuItem = new JMenuItem("Redo"); - // menuItem.addActionListener( new EditRedoAction() ); - // menu.add(menuItem); - // menu.addSeparator(); + menuItem = new JMenuItem(ActionManager.getAction("undo")); + m_editMenu.add( menuItem ); + menuItem = new JMenuItem(ActionManager.getAction("redo")); + m_editMenu.add(menuItem); + m_editMenu.addSeparator(); menuItem = new JMenuItem(ActionManager.getAction("cut")); m_editMenu.add(menuItem); menuItem = new JMenuItem(ActionManager.getAction("copy")); Modified: trunk/sourceview/src/sourceview/SourceViewDocument.java =================================================================== --- trunk/sourceview/src/sourceview/SourceViewDocument.java 2006-08-05 20:24:09 UTC (rev 1105) +++ trunk/sourceview/src/sourceview/SourceViewDocument.java 2006-08-05 21:41:13 UTC (rev 1106) @@ -55,6 +55,10 @@ import javax.swing.text.GapContent; import javax.swing.text.SimpleAttributeSet; import javax.swing.text.StyleContext; +import javax.swing.event.DocumentEvent; +import javax.swing.event.UndoableEditListener; +import javax.swing.event.UndoableEditEvent; +import javax.swing.undo.*; //}}} //{{{ DOM classes @@ -96,50 +100,103 @@ //buffer is actually loaded in the text area at any //given time(?) super.insertString(0, document.getText(0,document.getLength()), null); + m_initialized = true; } catch (BadLocationException ble) { Log.log(Log.ERROR, this, ble); } } + + addUndoableEditListener(new UndoableEditListener() { + public void undoableEditHappened(UndoableEditEvent e) { + m_undoManager.addEdit(e.getEdit()); + } + }); }//}}} //{{{ DefaultStyledDocument methods - //{{{ insertString() + // //{{{ insertString() - public void insertString(int offs, String str, AttributeSet a) throws BadLocationException { + // public void insertString(int offs, String str, AttributeSet a) throws BadLocationException { + // Log.log(Log.DEBUG, this, "insert: "+str); + // try { + // super.insertString(offs, str, a); + // m_document.insertText(offs, str); + // } catch (DOMException dome) { + // Log.log(Log.ERROR, this, dome); + // Toolkit.getDefaultToolkit().beep(); + // } catch (IOException ioe) { + // Log.log(Log.ERROR, this, ioe); + // } + + // }//}}} + + // //{{{ remove() + + // public void remove(int offs, int len) throws BadLocationException { + // Log.log(Log.DEBUG, this, "remove"); + // try { + // super.remove(offs, len); + // m_document.removeText(offs, len); + // } catch (DOMException dome) { + // Log.log(Log.ERROR, this, dome); + // Toolkit.getDefaultToolkit().beep(); + // } catch (IOException ioe) { + // Log.log(Log.ERROR, this, ioe); + // } + // }//}}} + + protected void fireInsertUpdate(DocumentEvent e) { try { - super.insertString(offs, str, a); - m_document.insertText(offs, str); - } catch (DOMException dome) { - Log.log(Log.ERROR, this, dome); - Toolkit.getDefaultToolkit().beep(); + Log.log(Log.DEBUG, this, "insert: "+getText(e.getOffset(), e.getLength())); + if (m_initialized) { + m_document.insertText(e.getOffset(), getText(e.getOffset(), e.getLength())); + } + super.fireInsertUpdate(e); } catch (IOException ioe) { Log.log(Log.ERROR, this, ioe); + } catch (BadLocationException ble) { + Log.log(Log.ERROR, this, ble); } - - }//}}} - - //{{{ remove() + } - public void remove(int offs, int len) throws BadLocationException { - + protected void fireRemoveUpdate(DocumentEvent e) { try { - super.remove(offs, len); - m_document.removeText(offs, len); - } catch (DOMException dome) { - Log.log(Log.ERROR, this, dome); - Toolkit.getDefaultToolkit().beep(); + Log.log(Log.DEBUG, this, "remove: "+e.getOffset()+":"+e.getLength()); + if (m_initialized) { + m_document.removeText(e.getOffset(), e.getLength()); + } + super.fireRemoveUpdate(e); } catch (IOException ioe) { Log.log(Log.ERROR, this, ioe); } - - }//}}} - + } + //}}} + //{{{ undo() + public void undo() { + try { + m_undoManager.undo(); + } catch (CannotUndoException e) { + Log.log(Log.WARNING, this, "Cannot undo"); + } + }//}}} + + //{{{ redo() + public void redo() throws CannotUndoException { + try { + m_undoManager.redo(); + } catch (CannotUndoException e) { + Log.log(Log.WARNING, this, "Cannot redo"); + } + }//}}} + //{{{ Private members + private boolean m_initialized = false; private XMLDocument m_document; + private UndoManager m_undoManager = new UndoManager(); //}}} } Modified: trunk/sourceview/src/sourceview/SourceViewPlugin.java =================================================================== --- trunk/sourceview/src/sourceview/SourceViewPlugin.java 2006-08-05 20:24:09 UTC (rev 1105) +++ trunk/sourceview/src/sourceview/SourceViewPlugin.java 2006-08-05 21:41:13 UTC (rev 1106) @@ -65,6 +65,8 @@ addAction(new EditPasteAction()); addAction(new EditFindAction()); addAction(new EditFindNextAction()); + addAction(new UndoAction()); + addAction(new RedoAction()); }//}}} //{{{ newDocumentView() Added: trunk/sourceview/src/sourceview/action/RedoAction.java =================================================================== --- trunk/sourceview/src/sourceview/action/RedoAction.java (rev 0) +++ trunk/sourceview/src/sourceview/action/RedoAction.java 2006-08-05 21:41:13 UTC (rev 1106) @@ -0,0 +1,74 @@ +/* +RedoAction.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 sourceview.action; + +//{{{ imports + +import sourceview.*; + +//{{{ jsXe classes +import net.sourceforge.jsxe.jsXe; +import net.sourceforge.jsxe.ActionManager; +import net.sourceforge.jsxe.LocalizedAction; +import net.sourceforge.jsxe.gui.TabbedView; +import net.sourceforge.jsxe.gui.Messages; +import net.sourceforge.jsxe.gui.DocumentView; +import net.sourceforge.jsxe.util.Log; +//}}} + +//{{{ AWT classes +import java.awt.event.ActionEvent; +//}}} + +//}}} + +/** + * This action that redoes the last action made in the source view. + * + * @author Ian Lewis (<a href="mailto:Ian...@me...">Ian...@me...</a>) + * @version $Id$ + */ +public class RedoAction extends LocalizedAction { + + //{{{ RedoAction constructor + public RedoAction() { + super(SourceViewPlugin.PLUGIN_NAME+ActionManager.REDO_SUFFIX); + }//}}} + + //{{{ getLabel() + public String getLabel() { + return Messages.getMessage("common.redo"); + }//}}} + + //{{{ invoke() + public void invoke(TabbedView view, ActionEvent evt) { + DocumentView docView = view.getDocumentView(); + if (docView instanceof SourceView) { + SourceView sourceView = (SourceView)docView; + ((SourceViewDocument)sourceView.getTextArea().getDocument()).redo(); + } + }//}}} + +} Property changes on: trunk/sourceview/src/sourceview/action/RedoAction.java ___________________________________________________________________ Name: svn:executable + * Added: trunk/sourceview/src/sourceview/action/UndoAction.java =================================================================== --- trunk/sourceview/src/sourceview/action/UndoAction.java (rev 0) +++ trunk/sourceview/src/sourceview/action/UndoAction.java 2006-08-05 21:41:13 UTC (rev 1106) @@ -0,0 +1,74 @@ +/* +UndoAction.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 sourceview.action; + +//{{{ imports + +import sourceview.*; + +//{{{ jsXe classes +import net.sourceforge.jsxe.jsXe; +import net.sourceforge.jsxe.ActionManager; +import net.sourceforge.jsxe.LocalizedAction; +import net.sourceforge.jsxe.gui.TabbedView; +import net.sourceforge.jsxe.gui.Messages; +import net.sourceforge.jsxe.gui.DocumentView; +import net.sourceforge.jsxe.util.Log; +//}}} + +//{{{ AWT classes +import java.awt.event.ActionEvent; +//}}} + +//}}} + +/** + * This action that undoes the last action made in the source view. + * + * @author Ian Lewis (<a href="mailto:Ian...@me...">Ian...@me...</a>) + * @version $Id$ + */ +public class UndoAction extends LocalizedAction { + + //{{{ UndoAction constructor + public UndoAction() { + super(SourceViewPlugin.PLUGIN_NAME+ActionManager.UNDO_SUFFIX); + }//}}} + + //{{{ getLabel() + public String getLabel() { + return Messages.getMessage("common.undo"); + }//}}} + + //{{{ invoke() + public void invoke(TabbedView view, ActionEvent evt) { + DocumentView docView = view.getDocumentView(); + if (docView instanceof SourceView) { + SourceView sourceView = (SourceView)docView; + ((SourceViewDocument)sourceView.getTextArea().getDocument()).undo(); + } + }//}}} + +} Property changes on: trunk/sourceview/src/sourceview/action/UndoAction.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-08-05 20:24:20
|
Revision: 1105 Author: ian_lewis Date: 2006-08-05 13:24:09 -0700 (Sat, 05 Aug 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1105&view=rev Log Message: ----------- Added core support for Undo/Redo Modified Paths: -------------- trunk/jsxe/Changelog trunk/jsxe/build.xml trunk/jsxe/messages/messages trunk/jsxe/src/net/sourceforge/jsxe/ActionManager.java trunk/jsxe/src/net/sourceforge/jsxe/gui/TabbedView.java trunk/jsxe/src/net/sourceforge/jsxe/properties Added Paths: ----------- trunk/jsxe/src/net/sourceforge/jsxe/action/RedoAction.java trunk/jsxe/src/net/sourceforge/jsxe/action/UndoAction.java Modified: trunk/jsxe/Changelog =================================================================== --- trunk/jsxe/Changelog 2006-08-04 19:17:41 UTC (rev 1104) +++ trunk/jsxe/Changelog 2006-08-05 20:24:09 UTC (rev 1105) @@ -1,3 +1,9 @@ +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 Segrer. Modified: trunk/jsxe/build.xml =================================================================== --- trunk/jsxe/build.xml 2006-08-04 19:17:41 UTC (rev 1104) +++ trunk/jsxe/build.xml 2006-08-05 20:24:09 UTC (rev 1105) @@ -459,4 +459,4 @@ <ant inheritAll="false" dir="${plugin.dir}/sourceview/" target="clean"/> </target>--> <!-- }}} --> -</project> +</project> \ No newline at end of file Modified: trunk/jsxe/messages/messages =================================================================== --- trunk/jsxe/messages/messages 2006-08-04 19:17:41 UTC (rev 1104) +++ trunk/jsxe/messages/messages 2006-08-05 20:24:09 UTC (rev 1105) @@ -25,6 +25,8 @@ common.paste=Paste common.find=Find common.findnext=Find Next +common.undo=Undo +common.redo=Redo common.ctrl=Ctrl common.alt=Alt Modified: trunk/jsxe/src/net/sourceforge/jsxe/ActionManager.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/ActionManager.java 2006-08-04 19:17:41 UTC (rev 1104) +++ trunk/jsxe/src/net/sourceforge/jsxe/ActionManager.java 2006-08-05 20:24:09 UTC (rev 1105) @@ -79,6 +79,8 @@ public static final String PASTE_SUFFIX = ".paste"; public static final String FIND_SUFFIX = ".find"; public static final String FIND_NEXT_SUFFIX = ".findnext"; + public static final String UNDO_SUFFIX = ".undo"; + public static final String REDO_SUFFIX = ".redo"; //}}} @@ -272,7 +274,9 @@ actionName.endsWith(COPY_SUFFIX) || actionName.endsWith(PASTE_SUFFIX) || actionName.endsWith(FIND_SUFFIX) || - actionName.endsWith(FIND_NEXT_SUFFIX)); + actionName.endsWith(FIND_NEXT_SUFFIX) || + actionName.endsWith(UNDO_SUFFIX) || + actionName.endsWith(REDO_SUFFIX)); }//}}} //{{{ Wrapper class Added: trunk/jsxe/src/net/sourceforge/jsxe/action/RedoAction.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/action/RedoAction.java (rev 0) +++ trunk/jsxe/src/net/sourceforge/jsxe/action/RedoAction.java 2006-08-05 20:24:09 UTC (rev 1105) @@ -0,0 +1,77 @@ +/* +RedoAction.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.action; + +//{{{ imports + +//{{{ jsXe classes +import net.sourceforge.jsxe.jsXe; +import net.sourceforge.jsxe.JARClassLoader; +import net.sourceforge.jsxe.ActionManager; +import net.sourceforge.jsxe.LocalizedAction; +import net.sourceforge.jsxe.gui.TabbedView; +import net.sourceforge.jsxe.gui.Messages; +//}}} + +//{{{ Java classes +import java.io.IOException; +//}}} + +//{{{ AWT components +import java.awt.event.ActionEvent; +//}}} + +//}}} + +/** + * The redo action invokes a DocumentView specific action defined for redo. + * The action should be defined by the view as <i>viewname</i>.redo + * + * @author Ian Lewis (<a href="mailto:Ian...@me...">Ian...@me...</a>) + * @version $Id$ + * @since jsXe 0.5 pre3 + */ +public class RedoAction extends LocalizedAction { + + //{{{ RedoAction constructor + public RedoAction() { + super("redo"); + }//}}} + + //{{{ getLabel() + public String getLabel() { + return Messages.getMessage("common.redo"); + }//}}} + + //{{{ invoke() + public void invoke(TabbedView view, ActionEvent evt) { + /* + invoke the action registered for the current DocumentView named + viewname.redo if there is one. + */ + ActionManager.invokeAction(jsXe.getPluginLoader().getPluginProperty(view.getDocumentView().getViewPlugin(), JARClassLoader.PLUGIN_NAME)+ActionManager.REDO_SUFFIX, evt); + }//}}} + +} Added: trunk/jsxe/src/net/sourceforge/jsxe/action/UndoAction.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/action/UndoAction.java (rev 0) +++ trunk/jsxe/src/net/sourceforge/jsxe/action/UndoAction.java 2006-08-05 20:24:09 UTC (rev 1105) @@ -0,0 +1,77 @@ +/* +UndoAction.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.action; + +//{{{ imports + +//{{{ jsXe classes +import net.sourceforge.jsxe.jsXe; +import net.sourceforge.jsxe.JARClassLoader; +import net.sourceforge.jsxe.ActionManager; +import net.sourceforge.jsxe.LocalizedAction; +import net.sourceforge.jsxe.gui.TabbedView; +import net.sourceforge.jsxe.gui.Messages; +//}}} + +//{{{ Java classes +import java.io.IOException; +//}}} + +//{{{ AWT components +import java.awt.event.ActionEvent; +//}}} + +//}}} + +/** + * The undo action invokes a DocumentView specific action defined for undo. + * The action should be defined by the view as <i>viewname</i>.undo + * + * @author Ian Lewis (<a href="mailto:Ian...@me...">Ian...@me...</a>) + * @version $Id$ + * @since jsXe 0.5 pre3 + */ +public class UndoAction extends LocalizedAction { + + //{{{ UndoAction constructor + public UndoAction() { + super("undo"); + }//}}} + + //{{{ getLabel() + public String getLabel() { + return Messages.getMessage("common.undo"); + }//}}} + + //{{{ invoke() + public void invoke(TabbedView view, ActionEvent evt) { + /* + invoke the action registered for the current DocumentView named + viewname.undo if there is one. + */ + ActionManager.invokeAction(jsXe.getPluginLoader().getPluginProperty(view.getDocumentView().getViewPlugin(), JARClassLoader.PLUGIN_NAME)+ActionManager.UNDO_SUFFIX, evt); + }//}}} + +} Modified: trunk/jsxe/src/net/sourceforge/jsxe/gui/TabbedView.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/gui/TabbedView.java 2006-08-04 19:17:41 UTC (rev 1104) +++ trunk/jsxe/src/net/sourceforge/jsxe/gui/TabbedView.java 2006-08-05 20:24:09 UTC (rev 1105) @@ -512,6 +512,8 @@ set.addAction(new PasteAction()); set.addAction(new FindAction()); set.addAction(new FindNextAction()); + set.addAction(new UndoAction()); + set.addAction(new RedoAction()); ActionManager.addActionSet(set); //}}} Modified: trunk/jsxe/src/net/sourceforge/jsxe/properties =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/properties 2006-08-04 19:17:41 UTC (rev 1104) +++ trunk/jsxe/src/net/sourceforge/jsxe/properties 2006-08-05 20:24:09 UTC (rev 1105) @@ -62,4 +62,6 @@ paste.shortcut=C+v find.shortcut=C+v findnext.shortcut=C+g +undo.shortcut=C+z +redo.shortcut=C+y #}}} 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-08-03 19:18:41
|
Revision: 1103 Author: ian_lewis Date: 2006-08-03 12:18:36 -0700 (Thu, 03 Aug 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1103&view=rev Log Message: ----------- restored links.php so that it redirects to the right page Added Paths: ----------- trunk/web/htdocs/links.php Added: trunk/web/htdocs/links.php =================================================================== --- trunk/web/htdocs/links.php (rev 0) +++ trunk/web/htdocs/links.php 2006-08-03 19:18:36 UTC (rev 1103) @@ -0,0 +1,57 @@ +<?php +// func: redirect($to,$code=307) +// spec: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html +function redirect($to,$code=301) +{ + $location = null; + $sn = $_SERVER['SCRIPT_NAME']; + $cp = dirname($sn); + if (substr($to,0,4)=='http') $location = $to; // Absolute URL + else + { + $schema = $_SERVER['SERVER_PORT']=='443'?'https':'http'; + $host = strlen($_SERVER['HTTP_HOST'])?$_SERVER['HTTP_HOST']:$_SERVER['SERVER_NAME']; + if (substr($to,0,1)=='/') $location = "$schema://$host$to"; + elseif (substr($to,0,1)=='.') // Relative Path + { + $location = "$schema://$host"; + $pu = parse_url($to); + $cd = dirname($_SERVER['SCRIPT_FILENAME']).'/'; + $np = realpath($cd.$pu['path']); + $np = str_replace($_SERVER['DOCUMENT_ROOT'],'',$np); + $location.= $np; + if ((isset($pu['query'])) && (strlen($pu['query'])>0)) $location.= '?'.$pu['query']; + } + } + + $hs = headers_sent(); + if ($hs==false) + { + if ($code==301) header("301 Moved Permanently HTTP/1.1"); // Convert to GET + elseif ($code==302) header("302 Found HTTP/1.1"); // Conform re-POST + elseif ($code==303) header("303 See Other HTTP/1.1"); // dont cache, always use GET + elseif ($code==304) header("304 Not Modified HTTP/1.1"); // use cache + elseif ($code==305) header("305 Use Proxy HTTP/1.1"); + elseif ($code==306) header("306 Not Used HTTP/1.1"); + elseif ($code==307) header("307 Temorary Redirect HTTP/1.1"); + else trigger_error("Unhandled redirect() HTTP Code: $code",E_USER_ERROR); + header("Location: $location"); + header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0'); + } + elseif (($hs==true) || ($code==302) || ($code==303)) + { + // todo: draw some javascript to redirect + $cover_div_style = 'background-color: #ccc; height: 100%; left: 0px; position: absolute; top: 0px; width: 100%;'; + echo "<div style='$cover_div_style'>\n"; + $link_div_style = 'background-color: #fff; border: 2px solid #f00; left: 0px; margin: 5px; padding: 3px; '; + $link_div_style.= 'position: absolute; text-align: center; top: 0px; width: 95%; z-index: 99;'; + echo "<div style='$link_div_style'>\n"; + echo "<p>Please See: <a href='$to'>".htmlspecialchars($location)."</a></p>\n"; + echo "</div>\n</div>\n"; + } + exit(0); +} + +// Do stuff here before sending headers +redirect('./get-involved.php') +?> Property changes on: trunk/web/htdocs/links.php ___________________________________________________________________ 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-08-03 16:52:53
|
Revision: 1102 Author: ian_lewis Date: 2006-08-03 09:52:48 -0700 (Thu, 03 Aug 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1102&view=rev Log Message: ----------- Added note about contributers and real names Modified Paths: -------------- trunk/web/htdocs/get-involved.php Modified: trunk/web/htdocs/get-involved.php =================================================================== --- trunk/web/htdocs/get-involved.php 2006-08-03 15:40:34 UTC (rev 1101) +++ trunk/web/htdocs/get-involved.php 2006-08-03 16:52:48 UTC (rev 1102) @@ -22,6 +22,8 @@ you can become involved in the project. The easiest is probably by subscribing to the mailing lists, however there are many methods at your disposal.</p> + + <p>Note: Contributers will be expected to give their real names.</p> <h3>Developers</h3> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ian...@us...> - 2006-08-03 15:40:44
|
Revision: 1101 Author: ian_lewis Date: 2006-08-03 08:40:34 -0700 (Thu, 03 Aug 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1101&view=rev Log Message: ----------- Added english tooltips for some global options Modified Paths: -------------- trunk/treeview/Changelog trunk/treeview/messages/messages Modified: trunk/treeview/Changelog =================================================================== --- trunk/treeview/Changelog 2006-08-03 15:25:48 UTC (rev 1100) +++ trunk/treeview/Changelog 2006-08-03 15:40:34 UTC (rev 1101) @@ -1,3 +1,8 @@ +08/03/2006 Ian Lewis <Ian...@me...> + + * Added some English tooltip messages to the Global Options Pane for the + tree view. + 07/20/2006 Ian Lewis <Ian...@me...> * Updated actions and messages for options. Modified: trunk/treeview/messages/messages =================================================================== --- trunk/treeview/messages/messages 2006-08-03 15:25:48 UTC (rev 1100) +++ trunk/treeview/messages/messages 2006-08-03 15:40:34 UTC (rev 1101) @@ -7,8 +7,11 @@ TreeView.Options.Title=Tree View TreeView.Options.Show.Comments=Show comment nodes +TreeView.Options.Show.Comments.ToolTip=If this checkbox is checked then comment nodes will be shown in the tree. TreeView.Options.Continuous.Layout=Continuous layout for split-panes +TreeView.Options.Continuous.Layout.ToolTip=<html>If this checkbox is checked then split panes will continuously repaint as you resize them.<br>Otherwise a black line is drawn to show the resize.</html> TreeView.Options.Show.Attributes=Show element attributes in tree: +TreeView.Options.Show.Attributes.ToolTip=<html>This option specifies what attributes are shown in the tree.<ul><li><strong>None</strong> - No attrributes are shown.</li><li><strong>ID only</strong> - Only the attribute specified as the ID is shown.</li><li><strong>All</strong> - All attributes are shown.</li></ul></html> Show.Attributes.None=None Show.Attributes.ID.Only=ID only Show.Attributes.All=All This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ian...@us...> - 2006-08-03 15:25:54
|
Revision: 1100 Author: ian_lewis Date: 2006-08-03 08:25:48 -0700 (Thu, 03 Aug 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1100&view=rev Log Message: ----------- Updated the Changelog to include note about Russian translation Modified Paths: -------------- trunk/jsxe/Changelog Modified: trunk/jsxe/Changelog =================================================================== --- trunk/jsxe/Changelog 2006-08-03 15:23:42 UTC (rev 1099) +++ trunk/jsxe/Changelog 2006-08-03 15:25:48 UTC (rev 1100) @@ -1,3 +1,7 @@ +08/03/2006 Ian Lewis <Ian...@me...> + + * Added Russian translation thanks to Segrer. + 07/26/2006 Ian Lewis <Ian...@me...> * Updated the find and findnext actions to use proper messages This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ian...@us...> - 2006-08-03 15:23:50
|
Revision: 1099 Author: ian_lewis Date: 2006-08-03 08:23:42 -0700 (Thu, 03 Aug 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1099&view=rev Log Message: ----------- Added Document Root to the messages list Modified Paths: -------------- trunk/treeview/messages/messages trunk/treeview/src/treeview/TreeViewTree.java Modified: trunk/treeview/messages/messages =================================================================== --- trunk/treeview/messages/messages 2006-08-03 15:23:15 UTC (rev 1098) +++ trunk/treeview/messages/messages 2006-08-03 15:23:42 UTC (rev 1099) @@ -13,6 +13,7 @@ Show.Attributes.ID.Only=ID only Show.Attributes.All=All +treeview.document.root=Document Root treeview.rename.node.label=Rename Node treeview.remove.node.label=Remove Node Modified: trunk/treeview/src/treeview/TreeViewTree.java =================================================================== --- trunk/treeview/src/treeview/TreeViewTree.java 2006-08-03 15:23:15 UTC (rev 1098) +++ trunk/treeview/src/treeview/TreeViewTree.java 2006-08-03 15:23:42 UTC (rev 1099) @@ -376,7 +376,7 @@ private static String toString(AdapterNode node) { StringBuffer s = new StringBuffer(); if (node.getNodeType() == Node.DOCUMENT_NODE) - return "Document Root"; + return Messages.getMessage("treeview.document.root"); String nodeName = node.getNodeName(); if (! nodeName.startsWith("#")) { s.append(nodeName); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ian...@us...> - 2006-08-03 15:23:23
|
Revision: 1098 Author: ian_lewis Date: 2006-08-03 08:23:15 -0700 (Thu, 03 Aug 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1098&view=rev Log Message: ----------- Added debug code for russian Modified Paths: -------------- trunk/jsxe/src/net/sourceforge/jsxe/gui/Messages.java Modified: trunk/jsxe/src/net/sourceforge/jsxe/gui/Messages.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/gui/Messages.java 2006-08-03 14:57:41 UTC (rev 1097) +++ trunk/jsxe/src/net/sourceforge/jsxe/gui/Messages.java 2006-08-03 15:23:15 UTC (rev 1098) @@ -93,7 +93,8 @@ // static { // // Locale.setDefault(new Locale("sv")); // // Locale.setDefault(Locale.GERMANY); - // Locale.setDefault(Locale.JAPAN); + // // Locale.setDefault(Locale.JAPAN); + // Locale.setDefault(new Locale("ru", "RU")); // } private static Locale m_locale = Locale.getDefault(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |