[Jsxe-cvs] SF.net SVN: jsxe: [1234] branches/treeview2
Status: Inactive
Brought to you by:
ian_lewis
|
From: <ian...@us...> - 2006-09-05 15:47:35
|
Revision: 1234
http://svn.sourceforge.net/jsxe/?rev=1234&view=rev
Author: ian_lewis
Date: 2006-09-05 08:47:20 -0700 (Tue, 05 Sep 2006)
Log Message:
-----------
Merge from trunk/treeview of rev. 1232
Modified Paths:
--------------
branches/treeview2/Changelog
branches/treeview2/dependency.props
branches/treeview2/src/treeview/DefaultView.java
branches/treeview2/src/treeview/TreeViewPlugin.java
branches/treeview2/src/treeview/TreeViewTree.java
branches/treeview2/src/treeview/action/AddNodeAction.java
branches/treeview2/src/treeview/action/CopyNodeAction.java
branches/treeview2/src/treeview/action/CutNodeAction.java
branches/treeview2/src/treeview/action/EditNodeAction.java
branches/treeview2/src/treeview/action/PasteNodeAction.java
branches/treeview2/src/treeview/treeview.props
Added Paths:
-----------
branches/treeview2/messages/messages.properties
branches/treeview2/messages/messages_de.properties
branches/treeview2/messages/messages_ja.properties
branches/treeview2/messages/messages_ru.properties
branches/treeview2/messages/messages_sv.properties
Removed Paths:
-------------
branches/treeview2/messages/messages
branches/treeview2/messages/messages.de
branches/treeview2/messages/messages.ja
branches/treeview2/messages/messages.sv
Modified: branches/treeview2/Changelog
===================================================================
--- branches/treeview2/Changelog 2006-09-05 15:46:47 UTC (rev 1233)
+++ branches/treeview2/Changelog 2006-09-05 15:47:20 UTC (rev 1234)
@@ -1,3 +1,34 @@
+08/31/2006 Ian Lewis <Ian...@me...>
+
+ * Updated the sourceview actions to use the new ContextSpecificActions in
+ jsXe.
+
+08/30/2006 Ian Lewis <Ian...@me...>
+
+ * Fixed null pointer exception when trying to cut a node that can't be
+ cut.
+
+08/29/2006 Ian Lewis <Ian...@me...>
+
+ * Updated japanese translation
+
+08/21/2006 Ian Lewis <Ian...@me...>
+
+ * Updated russian translation.
+
+08/08/2006 Ian Lewis <Ian...@me...>
+
+ * Fixed undo when adding/editing a node that is specified in a DTD/Schema.
+
+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
+ tree view.
+
07/20/2006 Ian Lewis <Ian...@me...>
* Updated actions and messages for options.
Modified: branches/treeview2/dependency.props
===================================================================
--- branches/treeview2/dependency.props 2006-09-05 15:46:47 UTC (rev 1233)
+++ branches/treeview2/dependency.props 2006-09-05 15:47:20 UTC (rev 1234)
@@ -1 +1 @@
-dependency.0=jsxe 00.05.03.00
+dependency.0=jsxe 00.05.04.00
Deleted: branches/treeview2/messages/messages
===================================================================
--- branches/treeview2/messages/messages 2006-09-05 15:46:47 UTC (rev 1233)
+++ branches/treeview2/messages/messages 2006-09-05 15:47:20 UTC (rev 1234)
@@ -1,30 +0,0 @@
-# JSXE tree view English properties file
-# $Id$
-#:mode=properties:
-#:tabSize=4:indentSize=4:noTabs=true:
-#:folding=explicit:collapseFolds=1:
-
-TreeView.Options.Title=Tree View
-
-TreeView.Options.Show.Comments=Show comment nodes
-TreeView.Options.Continuous.Layout=Continuous layout for split-panes
-TreeView.Options.Show.Attributes=Show element attributes in tree:
-Show.Attributes.None=None
-Show.Attributes.ID.Only=ID only
-Show.Attributes.All=All
-
-
-treeview.rename.node.label=Rename Node
-treeview.remove.node.label=Remove Node
-treeview.add.attribute.label=Add Attribute
-treeview.remove.attribute.label=Remove Attribute
-treeview.edit.node.label=Edit Node
-TreeView.EditDocType.Title=Edit Document Type Definition
-Edit.Node.Dialog.Title=Edit Node
-
-treeview.add.doctype.node.label=Add Document Type Definition
-treeview.add.element.node.label=Add Element Node
-treeview.add.text.node.label=Add Text Node
-treeview.add.cdata.node.label=Add CDATA Node
-treeview.add.pi.node.label=Add Processing Instruction
-treeview.add.comment.node.label=Add Comment
Deleted: branches/treeview2/messages/messages.de
===================================================================
--- branches/treeview2/messages/messages.de 2006-09-05 15:46:47 UTC (rev 1233)
+++ branches/treeview2/messages/messages.de 2006-09-05 15:47:20 UTC (rev 1234)
@@ -1,22 +0,0 @@
-# JSXE tree view German properties file
-# $Id$
-# Maintained by Bianca Shöen
-#:mode=properties:
-#:tabSize=4:indentSize=4:noTabs=true:
-#:folding=explicit:collapseFolds=1:
-
-# ä Ä é ö Ö ü Ü ß
-
-TreeView.Options.Title=Tree View Optionen
-TreeView.Options.Show.Comments=Kommentar Knoten anzeigen
-TreeView.Options.Show.Comments.ToolTip=Beim Deaktivieren werden sämtliche Kommentare in der momentan geöffneten XML Datei ausgeblendet.
-TreeView.Options.Continuous.Layout=Durchgängiges Layout für split-panes
-TreeView.Options.Continuous.Layout.ToolTip=<HTML>Dies beeinflusst das Aussehen des vertikalen Balkens in der Mitte des jsXE Screens.<BR>Ist dieses Auswahlkästchen nicht ausgewählt während der vertikale Balken vor und zurück über den Screen <BR>gezogen wird, bewegt er sich ohne Umstände.<BR>Ist dieses Auswahlkästchen nicht aktiviert während der vertikale Balken verschoben wird, verändert er sich in <BR>eine dicke schwarze Linie.</HTML>
-TreeView.Options.Show.Attributes=Show element attributes in tree:
-TreeView.Options.Show.Attributes.ToolTip=<HTML>Diese Option verlaubt es, die XML Datei auf verschiedene Arten anzuzeigen. <ul><li><strong>Keine</strong> - blendet alle Attribut-Informationen der Datei aus. </li><li><strong>Nur ID</strong> - nur Attribut-Informationen, die zu einem XML Element mit ID gehören, werden angezeigt.</li><li><strong>Alle</strong> - alle Attribut-Informationen werden angezeigt.</li></ul><HTML>
-TreeView.RenameNode=Knoten umbenennen
-TreeView.RemoveNode=Knoten entfernen
-TreeView.AddAttribute=Attribut hinzufügen
-TreeView.RemoveAttribute=Attribut entfernen
-TreeView.EditNode=Knoten bearbeiten
-Edit.Node.Dialog.Title=Knoten bearbeitenn
Deleted: branches/treeview2/messages/messages.ja
===================================================================
--- branches/treeview2/messages/messages.ja 2006-09-05 15:46:47 UTC (rev 1233)
+++ branches/treeview2/messages/messages.ja 2006-09-05 15:47:20 UTC (rev 1234)
@@ -1,29 +0,0 @@
-# JSXE tree view Japanese properties file
-# $Id$
-# Maintained by Ian Lewis
-#:mode=properties:
-#:tabSize=4:indentSize=4:noTabs=true:
-#:folding=explicit:collapseFolds=1:
-
-TreeView.Options.Title=ツリー表示
-
-TreeView.Options.Show.Comments=コメントノードを表示する
-TreeView.Options.Show.Attributes=要素の属性を表示する:
-Show.Attributes.None=なし
-Show.Attributes.ID.Only=IDだけ
-Show.Attributes.All=全て
-
-treeview.rename.node.label=ノードをリネーム
-treeview.remove.node.label=ノードを削除
-treeview.add.attribute.label=属性を追加
-treeview.remove.attribute.label=属性を削除
-treeview.add.doctype.node.label=DTDを追加
-treeview.edit.node.label=ノードを編集
-TreeView.EditDocType.Title=DTDを編集
-Edit.Node.Dialog.Title=ノードを編集
-
-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=コメントを追加
Copied: branches/treeview2/messages/messages.properties (from rev 1232, trunk/treeview/messages/messages.properties)
===================================================================
--- branches/treeview2/messages/messages.properties (rev 0)
+++ branches/treeview2/messages/messages.properties 2006-09-05 15:47:20 UTC (rev 1234)
@@ -0,0 +1,34 @@
+# JSXE tree view English properties file
+# $Id$
+#:mode=properties:
+#:tabSize=4:indentSize=4:noTabs=true:
+#:folding=explicit:collapseFolds=1:
+
+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
+
+treeview.document.root=Document Root
+
+treeview.rename.node.label=Rename Node
+treeview.remove.node.label=Remove Node
+treeview.add.attribute.label=Add Attribute
+treeview.remove.attribute.label=Remove Attribute
+treeview.edit.node.label=Edit Node
+TreeView.EditDocType.Title=Edit Document Type Definition
+Edit.Node.Dialog.Title=Edit Node
+
+treeview.add.doctype.node.label=Add Document Type Definition
+treeview.add.element.node.label=Add Element Node
+treeview.add.text.node.label=Add Text Node
+treeview.add.cdata.node.label=Add CDATA Node
+treeview.add.pi.node.label=Add Processing Instruction
+treeview.add.comment.node.label=Add Comment
Deleted: branches/treeview2/messages/messages.sv
===================================================================
--- branches/treeview2/messages/messages.sv 2006-09-05 15:46:47 UTC (rev 1233)
+++ branches/treeview2/messages/messages.sv 2006-09-05 15:47:20 UTC (rev 1234)
@@ -1,12 +0,0 @@
-# JSXE tree view Swedish properties file
-# $Id$
-# Currently maintained by Patrik Johansson <pa...@it...>
-#:mode=properties:
-#:tabSize=4:indentSize=4:noTabs=true:
-#:folding=explicit:collapseFolds=1:
-
-TreeView.RenameNode=Ta bort nod
-TreeView.RemoveNode=Ta bort nod
-TreeView.AddAttribute=Lägg till attribut
-TreeView.RemoveAttribute=Ta bort attribut
-TreeView.EditNode=Redigera nod
Copied: branches/treeview2/messages/messages_de.properties (from rev 1232, trunk/treeview/messages/messages_de.properties)
===================================================================
--- branches/treeview2/messages/messages_de.properties (rev 0)
+++ branches/treeview2/messages/messages_de.properties 2006-09-05 15:47:20 UTC (rev 1234)
@@ -0,0 +1,22 @@
+# JSXE tree view German properties file
+# $Id$
+# Maintained by Bianca Shöen
+#:mode=properties:
+#:tabSize=4:indentSize=4:noTabs=true:
+#:folding=explicit:collapseFolds=1:
+
+# ä Ä é ö Ö ü Ü ß
+
+TreeView.Options.Title=Tree View Optionen
+TreeView.Options.Show.Comments=Kommentar Knoten anzeigen
+TreeView.Options.Show.Comments.ToolTip=Beim Deaktivieren werden sämtliche Kommentare in der momentan geöffneten XML Datei ausgeblendet.
+TreeView.Options.Continuous.Layout=Durchgängiges Layout für split-panes
+TreeView.Options.Continuous.Layout.ToolTip=<HTML>Dies beeinflusst das Aussehen des vertikalen Balkens in der Mitte des jsXE Screens.<BR>Ist dieses Auswahlkästchen nicht ausgewählt während der vertikale Balken vor und zurück über den Screen <BR>gezogen wird, bewegt er sich ohne Umstände.<BR>Ist dieses Auswahlkästchen nicht aktiviert während der vertikale Balken verschoben wird, verändert er sich in <BR>eine dicke schwarze Linie.</HTML>
+TreeView.Options.Show.Attributes=Show element attributes in tree:
+TreeView.Options.Show.Attributes.ToolTip=<HTML>Diese Option verlaubt es, die XML Datei auf verschiedene Arten anzuzeigen. <ul><li><strong>Keine</strong> - blendet alle Attribut-Informationen der Datei aus. </li><li><strong>Nur ID</strong> - nur Attribut-Informationen, die zu einem XML Element mit ID gehören, werden angezeigt.</li><li><strong>Alle</strong> - alle Attribut-Informationen werden angezeigt.</li></ul><HTML>
+TreeView.RenameNode=Knoten umbenennen
+TreeView.RemoveNode=Knoten entfernen
+TreeView.AddAttribute=Attribut hinzufügen
+TreeView.RemoveAttribute=Attribut entfernen
+TreeView.EditNode=Knoten bearbeiten
+Edit.Node.Dialog.Title=Knoten bearbeitenn
Copied: branches/treeview2/messages/messages_ja.properties (from rev 1232, trunk/treeview/messages/messages_ja.properties)
===================================================================
--- branches/treeview2/messages/messages_ja.properties (rev 0)
+++ branches/treeview2/messages/messages_ja.properties 2006-09-05 15:47:20 UTC (rev 1234)
@@ -0,0 +1,31 @@
+# JSXE tree view Japanese properties file
+# $Id$
+# Maintained by Ian Lewis
+#:mode=properties:
+#:tabSize=4:indentSize=4:noTabs=true:
+#:folding=explicit:collapseFolds=1:
+
+TreeView.Options.Title=ツリー表示
+
+TreeView.Options.Show.Comments=コメントノードを表示する
+TreeView.Options.Show.Attributes=要素の属性を表示する:
+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.add.doctype.node.label=DTDを追加
+treeview.edit.node.label=ノードを編集
+TreeView.EditDocType.Title=DTDを編集
+Edit.Node.Dialog.Title=ノードを編集
+
+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=コメントを追加
Copied: branches/treeview2/messages/messages_ru.properties (from rev 1232, trunk/treeview/messages/messages_ru.properties)
===================================================================
--- branches/treeview2/messages/messages_ru.properties (rev 0)
+++ branches/treeview2/messages/messages_ru.properties 2006-09-05 15:47:20 UTC (rev 1234)
@@ -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=Добавить комментарий
Copied: branches/treeview2/messages/messages_sv.properties (from rev 1232, trunk/treeview/messages/messages_sv.properties)
===================================================================
--- branches/treeview2/messages/messages_sv.properties (rev 0)
+++ branches/treeview2/messages/messages_sv.properties 2006-09-05 15:47:20 UTC (rev 1234)
@@ -0,0 +1,12 @@
+# JSXE tree view Swedish properties file
+# $Id$
+# Currently maintained by Patrik Johansson <pa...@it...>
+#:mode=properties:
+#:tabSize=4:indentSize=4:noTabs=true:
+#:folding=explicit:collapseFolds=1:
+
+TreeView.RenameNode=Ta bort nod
+TreeView.RemoveNode=Ta bort nod
+TreeView.AddAttribute=Lägg till attribut
+TreeView.RemoveAttribute=Ta bort attribut
+TreeView.EditNode=Redigera nod
Modified: branches/treeview2/src/treeview/DefaultView.java
===================================================================
--- branches/treeview2/src/treeview/DefaultView.java 2006-09-05 15:46:47 UTC (rev 1233)
+++ branches/treeview2/src/treeview/DefaultView.java 2006-09-05 15:47:20 UTC (rev 1234)
@@ -32,10 +32,14 @@
import net.sourceforge.jsxe.dom.*;
import net.sourceforge.jsxe.dom.completion.ElementDecl;
import net.sourceforge.jsxe.*;
+import net.sourceforge.jsxe.action.ContextSpecificAction;
import net.sourceforge.jsxe.gui.DocumentView;
import net.sourceforge.jsxe.gui.Messages;
+import net.sourceforge.jsxe.gui.TabbedView;
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
@@ -118,6 +122,7 @@
m_valueTextArea.setFont(new Font("Monospaced", 0, 12));
m_valueTextArea.setLineWrap(false);
JScrollPane htmlView = new JScrollPane(m_valueTextArea);
+
//}}}
//{{{ init attributes table
@@ -136,6 +141,11 @@
JScrollPane treeView = new JScrollPane(tree);
tree.addTreeSelectionListener(new DefaultTreeSelectionListener(this));
+ //add context specific actions for the tree.
+ ActionManager.addActionImplementation("cut", tree, new CutNodeAction());
+ ActionManager.addActionImplementation("copy", tree, new CopyNodeAction());
+ ActionManager.addActionImplementation("paste", tree, new PasteNodeAction());
+
//starts editing if the user start typing on one of the nodes
//seems to catch user shortcuts too. Not sure how to resolve that.
@@ -163,19 +173,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);
@@ -244,6 +241,10 @@
}
}
+ ActionManager.removeActionImplementation("cut", tree);
+ ActionManager.removeActionImplementation("copy", tree);
+ ActionManager.removeActionImplementation("paste", tree);
+
EditBus.removeFromBus(this);
return true;
@@ -264,7 +265,7 @@
//{{{ getMenus()
public JMenu[] getMenus() {
- return new JMenu[] { m_editMenu };
+ return null;
}//}}}
//{{{ getDocumentBuffer()
@@ -342,6 +343,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()));
+ }
}
}//}}}
@@ -531,7 +537,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();
Modified: branches/treeview2/src/treeview/TreeViewPlugin.java
===================================================================
--- branches/treeview2/src/treeview/TreeViewPlugin.java 2006-09-05 15:46:47 UTC (rev 1233)
+++ branches/treeview2/src/treeview/TreeViewPlugin.java 2006-09-05 15:47:20 UTC (rev 1234)
@@ -63,9 +63,6 @@
addAction(new RemoveAttributeAction());
addAction(new EditNodeAction());
addAction(new AddDocTypeAction());
- addAction(new CutNodeAction());
- addAction(new CopyNodeAction());
- addAction(new PasteNodeAction());
}//}}}
//{{{ newDocumentView()
Modified: branches/treeview2/src/treeview/TreeViewTree.java
===================================================================
--- branches/treeview2/src/treeview/TreeViewTree.java 2006-09-05 15:46:47 UTC (rev 1233)
+++ branches/treeview2/src/treeview/TreeViewTree.java 2006-09-05 15:47:20 UTC (rev 1234)
@@ -196,8 +196,8 @@
Clipboard clipBoard = getToolkit().getSystemClipboard();
if (selectedNode != null) {
try {
- clipBoard.setContents(new TransferableNode(selectedNode), this);
selectedNode.getParentNode().remove(selectedNode);
+ clipBoard.setContents(new TransferableNode(selectedNode), this);
updateUI();
return true;
} catch (IllegalStateException e) {
@@ -205,7 +205,6 @@
} catch (HeadlessException e) {
Log.log(Log.ERROR, this, e);
} catch (DOMException e) {
- clipBoard.setContents(null, this);
throw e;
}
}
@@ -376,7 +375,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);
@@ -451,8 +450,8 @@
if (selectedNode.getNodeType() == Node.ELEMENT_NODE) {
- JMenu addElement = new WrappingMenu(Messages.getMessage("xml.element"), 20);
- addNodeItem.add(addElement);
+ WrappingMenu addElement = new WrappingMenu(Messages.getMessage("xml.element"), 20);
+ addNodeItem.add(addElement.getJMenu());
addElement.add(ActionManager.getAction("treeview.add.element.node"));
Iterator allowedElements = selectedNode.getAllowedElements().iterator();
@@ -463,8 +462,8 @@
//Add the allowed entities even if no matter what
- JMenu addEntity = new WrappingMenu(Messages.getMessage("xml.entity.reference"), 20);
- addNodeItem.add(addEntity);
+ WrappingMenu addEntity = new WrappingMenu(Messages.getMessage("xml.entity.reference"), 20);
+ addNodeItem.add(addEntity.getJMenu());
Iterator allowedEntities = ownerDocument.getAllowedEntities().iterator();
while (allowedEntities.hasNext()) {
@@ -685,48 +684,48 @@
}//}}}
- //{{{ ElementTreeCellRenderer class
+ // //{{{ ElementTreeCellRenderer class
- private class ElementTreeCellRenderer extends DefaultTreeCellRenderer {
+ // private class ElementTreeCellRenderer extends DefaultTreeCellRenderer {
- //{{{ ElementTreeCellRenderer constructor
+ // //{{{ ElementTreeCellRenderer constructor
- public ElementTreeCellRenderer() {
- m_defaultLeafIcon = getLeafIcon();
- }//}}}
+ // public ElementTreeCellRenderer() {
+ // m_defaultLeafIcon = getLeafIcon();
+ // }//}}}
- //{{{ getTreeCellRendererComponent
+ // //{{{ getTreeCellRendererComponent
- public Component getTreeCellRendererComponent(JTree tree,
- Object value, boolean selected, boolean expanded,
- boolean leaf, int row, boolean hasFocus)
- {
- AdapterNode node = (AdapterNode)value;
+ // public Component getTreeCellRendererComponent(JTree tree,
+ // Object value, boolean selected, boolean expanded,
+ // boolean leaf, int row, boolean hasFocus)
+ // {
+ // AdapterNode node = (AdapterNode)value;
- // We can rename processing instruction nodes here too.
- if (node.getNodeType() == AdapterNode.PROCESSING_INSTRUCTION_NODE) {
- setIcon(m_defaultLeafIcon);
- setLeafIcon(m_defaultLeafIcon);
- setOpenIcon(m_defaultLeafIcon);
- setClosedIcon(m_defaultLeafIcon);
- setToolTipText(Messages.getMessage("xml.processing.instruction"));
- } else {
- setIcon(m_elementIcon);
- setLeafIcon(m_elementIcon);
- setOpenIcon(m_elementIcon);
- setClosedIcon(m_elementIcon);
- setToolTipText(Messages.getMessage("xml.element"));
- }
+ // // We can rename processing instruction nodes here too.
+ // if (node.getNodeType() == AdapterNode.PROCESSING_INSTRUCTION_NODE) {
+ // setIcon(m_defaultLeafIcon);
+ // setLeafIcon(m_defaultLeafIcon);
+ // setOpenIcon(m_defaultLeafIcon);
+ // setClosedIcon(m_defaultLeafIcon);
+ // setToolTipText(Messages.getMessage("xml.processing.instruction"));
+ // } else {
+ // setIcon(m_elementIcon);
+ // setLeafIcon(m_elementIcon);
+ // setOpenIcon(m_elementIcon);
+ // setClosedIcon(m_elementIcon);
+ // setToolTipText(Messages.getMessage("xml.element"));
+ // }
- //just use the node name, we don't want attributes and such.
- setText(((AdapterNode)value).getNodeName());
- return this;
+ // //just use the node name, we don't want attributes and such.
+ // setText(((AdapterNode)value).getNodeName());
+ // return this;
- }//}}}
+ // }//}}}
- private Icon m_defaultLeafIcon;
+ // private Icon m_defaultLeafIcon;
- }//}}}
+ // }//}}}
//{{{ ElementCellEditor class
Modified: branches/treeview2/src/treeview/action/AddNodeAction.java
===================================================================
--- branches/treeview2/src/treeview/action/AddNodeAction.java 2006-09-05 15:46:47 UTC (rev 1233)
+++ branches/treeview2/src/treeview/action/AddNodeAction.java 2006-09-05 15:47:20 UTC (rev 1234)
@@ -52,6 +52,7 @@
import net.sourceforge.jsxe.LocalizedAction;
import net.sourceforge.jsxe.gui.DocumentView;
import net.sourceforge.jsxe.gui.TabbedView;
+import net.sourceforge.jsxe.dom.XMLDocument;
import net.sourceforge.jsxe.dom.AdapterNode;
import net.sourceforge.jsxe.dom.completion.ElementDecl;
import net.sourceforge.jsxe.dom.completion.EntityDecl;
@@ -116,27 +117,42 @@
AdapterNode addedNode = null;
if (selectedNode != null) {
try {
+ boolean isOk = true;
if (m_element != null) {
- if (m_element.getAttributes().size() > 0) {
- EditTagDialog dialog = new EditTagDialog(jsXe.getActiveView(),
- m_element,
- new HashMap(),
- m_element.empty,
- m_element.completionInfo.getEntityHash(),
- new ArrayList(), //don't support IDs for now.
- selectedNode.getOwnerDocument());
- dialog.show();
- addedNode = selectedNode.addAdapterNode(dialog.getNewNode());
- } else {
- addedNode = selectedNode.addAdapterNode(m_element.name, null, AdapterNode.ELEMENT_NODE, selectedNode.childCount());
+ XMLDocument document = selectedNode.getOwnerDocument();
+ try {
+ document.beginCompoundEdit();
+ if (m_element.getAttributes().size() > 0) {
+ EditTagDialog dialog = new EditTagDialog(jsXe.getActiveView(),
+ m_element,
+ new HashMap(),
+ m_element.empty,
+ m_element.completionInfo.getEntityHash(),
+ new ArrayList(), //don't support IDs for now.
+ document);
+ dialog.show();
+ isOk = (dialog.getNewNode() != null);
+ if (isOk) {
+ addedNode = selectedNode.addAdapterNode(dialog.getNewNode());
+ }
+ } else {
+ addedNode = selectedNode.addAdapterNode(m_element.name, null, AdapterNode.ELEMENT_NODE, selectedNode.childCount());
+ }
+ } finally {
+ document.endCompoundEdit();
}
} else {
//add the node of the correct type to the end of the children of this node
addedNode = selectedNode.addAdapterNode(m_name, m_value, m_nodeType, selectedNode.childCount());
}
- tree.expandPath(tree.getLeadSelectionPath());
- //The TreeModel doesn't automatically call treeNodesInserted() yet
- tree.updateUI();
+
+ //if we hit cancel in the dialog we don't want to do this.
+ if (isOk) {
+ tree.expandPath(tree.getLeadSelectionPath());
+ //The TreeModel doesn't automatically call treeNodesInserted() yet
+ tree.updateUI();
+ }
+
} catch (DOMException dome) {
JOptionPane.showMessageDialog(tree, dome, "XML Error", JOptionPane.WARNING_MESSAGE);
Modified: branches/treeview2/src/treeview/action/CopyNodeAction.java
===================================================================
--- branches/treeview2/src/treeview/action/CopyNodeAction.java 2006-09-05 15:46:47 UTC (rev 1233)
+++ branches/treeview2/src/treeview/action/CopyNodeAction.java 2006-09-05 15:47:20 UTC (rev 1234)
@@ -29,10 +29,8 @@
import treeview.*;
//{{{ AWT classes
-import java.awt.datatransfer.Clipboard;
import java.awt.event.ActionEvent;
-import java.awt.Toolkit;
-import java.awt.HeadlessException;
+import java.awt.Component;
//}}}
//{{{ Swing classes
@@ -43,7 +41,7 @@
//{{{ jsXe classes
import net.sourceforge.jsxe.jsXe;
-import net.sourceforge.jsxe.LocalizedAction;
+import net.sourceforge.jsxe.action.ContextSpecificAction;
import net.sourceforge.jsxe.gui.DocumentView;
import net.sourceforge.jsxe.gui.Messages;
import net.sourceforge.jsxe.gui.TabbedView;
@@ -60,24 +58,10 @@
* @author Ian Lewis (<a href="mailto:Ian...@me...">Ian...@me...</a>)
* @version $Id$
*/
-public class CopyNodeAction extends LocalizedAction {
+public class CopyNodeAction implements ContextSpecificAction.ActionImplementation {
- //{{{ CopyNodeAction constructor
- /**
- * Creates a action that copies the current node out of the tree and into
- * the clipboard.
- */
- public CopyNodeAction() {
- super(TreeViewPlugin.PLUGIN_NAME+".copy");
- }//}}}
-
- //{{{ getLabel()
- public String getLabel() {
- return Messages.getMessage("common.copy");
- }//}}}
-
//{{{ invoke()
- public void invoke(TabbedView view, ActionEvent evt) {
+ public void invoke(TabbedView view, Component comp, ActionEvent evt) {
DocumentView docView = view.getDocumentView();
if (docView instanceof DefaultView) {
DefaultView defView = (DefaultView)docView;
Modified: branches/treeview2/src/treeview/action/CutNodeAction.java
===================================================================
--- branches/treeview2/src/treeview/action/CutNodeAction.java 2006-09-05 15:46:47 UTC (rev 1233)
+++ branches/treeview2/src/treeview/action/CutNodeAction.java 2006-09-05 15:47:20 UTC (rev 1234)
@@ -29,10 +29,8 @@
import treeview.*;
//{{{ AWT classes
-import java.awt.datatransfer.Clipboard;
import java.awt.event.ActionEvent;
-import java.awt.Toolkit;
-import java.awt.HeadlessException;
+import java.awt.Component;
//}}}
//{{{ Swing classes
@@ -48,10 +46,11 @@
//{{{ jsXe classes
import net.sourceforge.jsxe.jsXe;
-import net.sourceforge.jsxe.LocalizedAction;
+import net.sourceforge.jsxe.action.ContextSpecificAction;
import net.sourceforge.jsxe.gui.DocumentView;
import net.sourceforge.jsxe.gui.Messages;
import net.sourceforge.jsxe.gui.TabbedView;
+import net.sourceforge.jsxe.gui.GUIUtilities;
import net.sourceforge.jsxe.dom.AdapterNode;
import net.sourceforge.jsxe.util.Log;
//}}}
@@ -65,25 +64,10 @@
* @author Ian Lewis (<a href="mailto:Ian...@me...">Ian...@me...</a>)
* @version $Id$
*/
-public class CutNodeAction extends LocalizedAction {
+public class CutNodeAction implements ContextSpecificAction.ActionImplementation {
- //{{{ CutNodeAction constructor
- /**
- * Creates a action that cuts the current node out of the tree and into
- * the clipboard.
- */
- public CutNodeAction() {
- super(TreeViewPlugin.PLUGIN_NAME+".cut");
- // putValue(Action.ACCELERATOR_KEY,KeyStroke.getKeyStroke("ctrl X"));
- }//}}}
-
- //{{{ getLabel()
- public String getLabel() {
- return Messages.getMessage("common.cut");
- }//}}}
-
//{{{ invoke()
- public void invoke(TabbedView view, ActionEvent evt) {
+ public void invoke(TabbedView view, Component comp, ActionEvent evt) {
DocumentView docView = view.getDocumentView();
if (docView instanceof DefaultView) {
DefaultView defView = (DefaultView)docView;
@@ -91,7 +75,7 @@
try {
tree.cut();
} catch (DOMException dome) {
- JOptionPane.showMessageDialog(tree, dome, "XML Error", JOptionPane.WARNING_MESSAGE);
+ GUIUtilities.error(tree, "XML.Error", new Object[] { dome });
}
}
}//}}}
Modified: branches/treeview2/src/treeview/action/EditNodeAction.java
===================================================================
--- branches/treeview2/src/treeview/action/EditNodeAction.java 2006-09-05 15:46:47 UTC (rev 1233)
+++ branches/treeview2/src/treeview/action/EditNodeAction.java 2006-09-05 15:47:20 UTC (rev 1234)
@@ -54,6 +54,7 @@
import net.sourceforge.jsxe.gui.Messages;
import net.sourceforge.jsxe.gui.TabbedView;
import net.sourceforge.jsxe.dom.AdapterNode;
+import net.sourceforge.jsxe.dom.XMLDocument;
import net.sourceforge.jsxe.dom.completion.ElementDecl;
//}}}
@@ -86,18 +87,24 @@
AdapterNode addedNode = null;
if (selectedNode != null && selectedNode.getNodeType() == AdapterNode.ELEMENT_NODE) {
try {
- ElementDecl element = selectedNode.getOwnerDocument().getElementDecl(selectedNode.getNodeName());
+ XMLDocument document = selectedNode.getOwnerDocument();
+ ElementDecl element = document.getElementDecl(selectedNode.getNodeName());
if (element != null) {
- //Edit tag dialog needs to be reworked
- EditTagDialog dialog = new EditTagDialog(jsXe.getActiveView(),
- element,
- new HashMap(),
- element.empty,
- element.completionInfo.getEntityHash(),
- new ArrayList(), //don't support IDs for now.
- selectedNode.getOwnerDocument(),
- selectedNode);
- dialog.show();
+
+ try {
+ document.beginCompoundEdit();
+ EditTagDialog dialog = new EditTagDialog(jsXe.getActiveView(),
+ element,
+ new HashMap(),
+ element.empty,
+ element.completionInfo.getEntityHash(),
+ new ArrayList(), //don't support IDs for now.
+ selectedNode.getOwnerDocument(),
+ selectedNode);
+ dialog.show();
+ } finally {
+ document.endCompoundEdit();
+ }
//The TreeModel doesn't automatically call treeNodesInserted() yet
tree.updateUI();
}
Modified: branches/treeview2/src/treeview/action/PasteNodeAction.java
===================================================================
--- branches/treeview2/src/treeview/action/PasteNodeAction.java 2006-09-05 15:46:47 UTC (rev 1233)
+++ branches/treeview2/src/treeview/action/PasteNodeAction.java 2006-09-05 15:47:20 UTC (rev 1234)
@@ -29,10 +29,8 @@
import treeview.*;
//{{{ AWT classes
-import java.awt.datatransfer.Clipboard;
import java.awt.event.ActionEvent;
-import java.awt.Toolkit;
-import java.awt.HeadlessException;
+import java.awt.Component;
//}}}
//{{{ Swing classes
@@ -48,7 +46,7 @@
//{{{ jsXe classes
import net.sourceforge.jsxe.jsXe;
-import net.sourceforge.jsxe.LocalizedAction;
+import net.sourceforge.jsxe.action.ContextSpecificAction;
import net.sourceforge.jsxe.gui.DocumentView;
import net.sourceforge.jsxe.gui.Messages;
import net.sourceforge.jsxe.gui.TabbedView;
@@ -65,24 +63,10 @@
* @author Ian Lewis (<a href="mailto:Ian...@me...">Ian...@me...</a>)
* @version $Id$
*/
-public class PasteNodeAction extends LocalizedAction {
+public class PasteNodeAction implements ContextSpecificAction.ActionImplementation {
- //{{{ PasteNodeAction constructor
- /**
- * Creates an action that pastes the node in the clipboard to the currently
- * selected node in the tree.
- */
- public PasteNodeAction() {
- super(TreeViewPlugin.PLUGIN_NAME+".paste");
- }//}}}
-
- //{{{ getLabel()
- public String getLabel() {
- return Messages.getMessage("common.paste");
- }//}}}
-
//{{{ invoke()
- public void invoke(TabbedView view, ActionEvent evt) {
+ public void invoke(TabbedView view, Component comp, ActionEvent evt) {
DocumentView docView = view.getDocumentView();
if (docView instanceof DefaultView) {
DefaultView defView = (DefaultView)docView;
Modified: branches/treeview2/src/treeview/treeview.props
===================================================================
--- branches/treeview2/src/treeview/treeview.props 2006-09-05 15:46:47 UTC (rev 1233)
+++ branches/treeview2/src/treeview/treeview.props 2006-09-05 15:47:20 UTC (rev 1234)
@@ -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.
|