diff options
author | Bernard Normier <bernard@zeroc.com> | 2006-12-04 17:02:43 +0000 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2006-12-04 17:02:43 +0000 |
commit | b1863fa8330d6f06b9dbddbea0c11be53320e1a5 (patch) | |
tree | 38e118544bb38b0884e85c88384c6772033480f0 /java/src/IceGridGUI/ApplicationPane.java | |
parent | Added extra proxy properties (diff) | |
download | ice-b1863fa8330d6f06b9dbddbea0c11be53320e1a5.tar.bz2 ice-b1863fa8330d6f06b9dbddbea0c11be53320e1a5.tar.xz ice-b1863fa8330d6f06b9dbddbea0c11be53320e1a5.zip |
Numerous fixes: copy/paste etc, auto-apply by default and more
Diffstat (limited to 'java/src/IceGridGUI/ApplicationPane.java')
-rwxr-xr-x | java/src/IceGridGUI/ApplicationPane.java | 74 |
1 files changed, 60 insertions, 14 deletions
diff --git a/java/src/IceGridGUI/ApplicationPane.java b/java/src/IceGridGUI/ApplicationPane.java index 6525d59d6db..6827accb31e 100755 --- a/java/src/IceGridGUI/ApplicationPane.java +++ b/java/src/IceGridGUI/ApplicationPane.java @@ -129,6 +129,14 @@ public class ApplicationPane extends JSplitPane implements Tab public void back() { + // + // Auto-apply changes + // + if(_currentEditor != null && !_currentEditor.save(false)) + { + return; + } + TreeNode previousNode = null; do { @@ -159,6 +167,11 @@ public class ApplicationPane extends JSplitPane implements Tab public void forward() { + if(_currentEditor != null && !_currentEditor.save(false)) + { + return; + } + TreeNode nextNode = null; do { @@ -247,21 +260,21 @@ public class ApplicationPane extends JSplitPane implements Tab public void save() { - if(_currentEditor == null || _currentEditor.save()) + if(_currentEditor == null || _currentEditor.save(true)) { _root.save(); } } public void saveToRegistry() { - if(_currentEditor == null || _currentEditor.save()) + if(_currentEditor == null || _currentEditor.save(true)) { _root.saveToRegistry(); } } public void saveToFile() { - if(_currentEditor == null || _currentEditor.save()) + if(_currentEditor == null || _currentEditor.save(true)) { _root.saveToFile(); } @@ -276,6 +289,18 @@ public class ApplicationPane extends JSplitPane implements Tab return true; } + private void registerAction(Coordinator c, int index) + { + Action action = c.getActionsForMenu().get(index); + + javax.swing.ActionMap am = _leftPane.getActionMap(); + javax.swing.InputMap im = _leftPane.getInputMap(); + + im.put((KeyStroke)action.getValue(Action.ACCELERATOR_KEY), (String)action.getValue(Action.NAME)); + am.put((String)action.getValue(Action.NAME), action); + } + + ApplicationPane(Root root) { super(JSplitPane.HORIZONTAL_SPLIT, true); @@ -283,7 +308,11 @@ public class ApplicationPane extends JSplitPane implements Tab _leftPane = new SimpleInternalFrame("Descriptors"); _leftPane.setPreferredSize(new Dimension(280, 350)); - + Coordinator c = root.getCoordinator(); + registerAction(c, TreeNode.COPY); + registerAction(c, TreeNode.PASTE); + registerAction(c, TreeNode.DELETE); + // // Right pane // @@ -374,25 +403,42 @@ public class ApplicationPane extends JSplitPane implements Tab { if(_root.isSelectionListenerEnabled()) { - TreePath path = null; - if(e.isAddedPath()) - { - path = e.getPath(); - } - - if(path == null) + // + // Auto-apply changes + // + if(_currentEditor != null && !_currentEditor.save(false)) { - showNode(null); + // + // Go back to this path + // + _root.disableSelectionListener(); + _root.setSelectedNode(_currentEditor.getTarget()); + _root.enableSelectionListener(); } else { - showNode((TreeNode)path.getLastPathComponent()); + if(e.isAddedPath()) + { + TreePath path = e.getPath(); + + if(path == null) + { + showNode(null); + } + else + { + showNode((TreeNode)path.getLastPathComponent()); + } + } + else + { + showNode(null); + } } } } } - private Root _root; private SimpleInternalFrame _leftPane; private SimpleInternalFrame _propertiesFrame; |