diff options
-rwxr-xr-x | java/src/IceGridGUI/Application/Adapter.java | 15 | ||||
-rwxr-xr-x | java/src/IceGridGUI/Application/DbEnv.java | 16 | ||||
-rwxr-xr-x | java/src/IceGridGUI/Application/PlainServer.java | 13 | ||||
-rwxr-xr-x | java/src/IceGridGUI/Application/PlainService.java | 6 | ||||
-rwxr-xr-x | java/src/IceGridGUI/Application/ServerInstance.java | 5 | ||||
-rwxr-xr-x | java/src/IceGridGUI/Application/ServerTemplate.java | 16 | ||||
-rwxr-xr-x | java/src/IceGridGUI/Application/ServiceInstance.java | 5 | ||||
-rwxr-xr-x | java/src/IceGridGUI/Application/ServiceTemplate.java | 12 |
8 files changed, 57 insertions, 31 deletions
diff --git a/java/src/IceGridGUI/Application/Adapter.java b/java/src/IceGridGUI/Application/Adapter.java index b6aea3083ea..cd82d9ba212 100755 --- a/java/src/IceGridGUI/Application/Adapter.java +++ b/java/src/IceGridGUI/Application/Adapter.java @@ -42,13 +42,16 @@ class Adapter extends TreeNode implements DescriptorHolder boolean[] actions = new boolean[ACTION_COUNT]; actions[COPY] = true; - boolean[] parentActions = ((TreeNode)_parent).getAvailableActions(); - - actions[PASTE] = parentActions[PASTE]; + Object clipboard = getCoordinator().getClipboard(); + actions[PASTE] = clipboard != null && + (clipboard instanceof AdapterDescriptor + || clipboard instanceof DbEnvDescriptor); + actions[DELETE] = true; if(!_ephemeral) { + boolean[] parentActions = ((TreeNode)_parent).getAvailableActions(); actions[SHOW_VARS] = parentActions[SHOW_VARS]; actions[SUBSTITUTE_VARS] = parentActions[SUBSTITUTE_VARS]; } @@ -58,11 +61,9 @@ class Adapter extends TreeNode implements DescriptorHolder public void copy() { getCoordinator().setClipboard(copyDescriptor(_descriptor)); - if(((TreeNode)_parent).getAvailableActions()[PASTE]) - { - getCoordinator().getActionsForMenu().get(PASTE).setEnabled(true); - } + getCoordinator().getActionsForMenu().get(PASTE).setEnabled(true); } + public void paste() { ((TreeNode)_parent).paste(); diff --git a/java/src/IceGridGUI/Application/DbEnv.java b/java/src/IceGridGUI/Application/DbEnv.java index 446cf5c4cac..9f285f5d147 100755 --- a/java/src/IceGridGUI/Application/DbEnv.java +++ b/java/src/IceGridGUI/Application/DbEnv.java @@ -51,7 +51,6 @@ class DbEnv extends TreeNode implements DescriptorHolder tree, value, sel, expanded, leaf, row, hasFocus); } - // // Actions // @@ -59,13 +58,16 @@ class DbEnv extends TreeNode implements DescriptorHolder { boolean[] actions = new boolean[ACTION_COUNT]; actions[COPY] = true; - boolean[] parentActions = ((TreeNode)_parent).getAvailableActions(); - - actions[PASTE] = parentActions[PASTE]; + + Object clipboard = getCoordinator().getClipboard(); + actions[PASTE] = clipboard != null && + (clipboard instanceof AdapterDescriptor + || clipboard instanceof DbEnvDescriptor); actions[DELETE] = true; if(!_ephemeral) { + boolean[] parentActions = ((TreeNode)_parent).getAvailableActions(); actions[SHOW_VARS] = parentActions[SHOW_VARS]; actions[SUBSTITUTE_VARS] = parentActions[SUBSTITUTE_VARS]; } @@ -75,11 +77,9 @@ class DbEnv extends TreeNode implements DescriptorHolder public void copy() { getCoordinator().setClipboard(copyDescriptor(_descriptor)); - if(((TreeNode)_parent).getAvailableActions()[PASTE]) - { - getCoordinator().getActionsForMenu().get(PASTE).setEnabled(true); - } + getCoordinator().getActionsForMenu().get(PASTE).setEnabled(true); } + public void paste() { ((TreeNode)_parent).paste(); diff --git a/java/src/IceGridGUI/Application/PlainServer.java b/java/src/IceGridGUI/Application/PlainServer.java index 050a63b1fe0..15f9ac930d1 100755 --- a/java/src/IceGridGUI/Application/PlainServer.java +++ b/java/src/IceGridGUI/Application/PlainServer.java @@ -123,7 +123,10 @@ class PlainServer extends Communicator implements Server Object clipboard = getCoordinator().getClipboard(); if(clipboard != null && (clipboard instanceof ServerDescriptor - || clipboard instanceof ServerInstanceDescriptor)) + || clipboard instanceof ServerInstanceDescriptor + || (isIceBox() && (clipboard instanceof ServiceInstanceDescriptor)) + || (!isIceBox() && (clipboard instanceof AdapterDescriptor + || clipboard instanceof DbEnvDescriptor)))) { actions[PASTE] = true; } @@ -196,15 +199,13 @@ class PlainServer extends Communicator implements Server _iceboxServerIcon = Utils.getIcon("/icons/16x16/icebox_server_inactive.png"); } - boolean icebox = _descriptor instanceof IceBoxDescriptor; - if(expanded) { - _cellRenderer.setOpenIcon(icebox ? _iceboxServerIcon : _serverIcon); + _cellRenderer.setOpenIcon(isIceBox() ? _iceboxServerIcon : _serverIcon); } else { - _cellRenderer.setClosedIcon(icebox ? _iceboxServerIcon : _serverIcon); + _cellRenderer.setClosedIcon(isIceBox() ? _iceboxServerIcon : _serverIcon); } return _cellRenderer.getTreeCellRendererComponent( tree, value, sel, expanded, leaf, row, hasFocus); @@ -479,7 +480,7 @@ class PlainServer extends Communicator implements Server if(!_ephemeral) { _adapters.init(_descriptor.adapters); - if(_descriptor instanceof IceBoxDescriptor) + if(isIceBox()) { IceBoxDescriptor iceBoxDescriptor = (IceBoxDescriptor)_descriptor; _services.init(iceBoxDescriptor.services); diff --git a/java/src/IceGridGUI/Application/PlainService.java b/java/src/IceGridGUI/Application/PlainService.java index d13a0ba12dd..bd697e44c91 100755 --- a/java/src/IceGridGUI/Application/PlainService.java +++ b/java/src/IceGridGUI/Application/PlainService.java @@ -59,7 +59,11 @@ class PlainService extends Communicator implements Service, Cloneable boolean[] actions = new boolean[ACTION_COUNT]; actions[COPY] = true; - if(((TreeNode)_parent).getAvailableActions()[PASTE]) + Object clipboard = getCoordinator().getClipboard(); + if(clipboard != null && + (clipboard instanceof ServiceInstanceDescriptor + || clipboard instanceof AdapterDescriptor + || clipboard instanceof DbEnvDescriptor)) { actions[PASTE] = true; } diff --git a/java/src/IceGridGUI/Application/ServerInstance.java b/java/src/IceGridGUI/Application/ServerInstance.java index 0a1b03336f9..52b3d134327 100755 --- a/java/src/IceGridGUI/Application/ServerInstance.java +++ b/java/src/IceGridGUI/Application/ServerInstance.java @@ -60,6 +60,11 @@ class ServerInstance extends TreeNode implements Server getCoordinator().setClipboard(copyDescriptor(_descriptor)); getCoordinator().getActionsForMenu().get(PASTE).setEnabled(true); } + + public void paste() + { + ((TreeNode)_parent).paste(); + } public Editor getEditor() { diff --git a/java/src/IceGridGUI/Application/ServerTemplate.java b/java/src/IceGridGUI/Application/ServerTemplate.java index 90a0501ece6..c418ccec73b 100755 --- a/java/src/IceGridGUI/Application/ServerTemplate.java +++ b/java/src/IceGridGUI/Application/ServerTemplate.java @@ -92,10 +92,19 @@ class ServerTemplate extends Communicator { boolean[] actions = new boolean[ACTION_COUNT]; actions[COPY] = true; + if(((TreeNode)_parent).getAvailableActions()[PASTE]) { actions[PASTE] = true; } + else + { + Object clipboard = getCoordinator().getClipboard(); + actions[PASTE] = clipboard != null && + ((isIceBox() && (clipboard instanceof ServiceInstanceDescriptor)) + || (!isIceBox() && (clipboard instanceof AdapterDescriptor + || clipboard instanceof DbEnvDescriptor))); + } actions[DELETE] = true; @@ -111,11 +120,8 @@ class ServerTemplate extends Communicator getCoordinator().setClipboard(copyDescriptor(_templateDescriptor)); getCoordinator().getActionsForMenu().get(PASTE).setEnabled(true); } - public void paste() - { - ((TreeNode)_parent).paste(); - } + public JPopupMenu getPopupMenu() { ApplicationActions actions = getCoordinator().getActionsForPopup(); @@ -304,7 +310,7 @@ class ServerTemplate extends Communicator { _adapters.init(_templateDescriptor.descriptor.adapters); - if(_templateDescriptor.descriptor instanceof IceBoxDescriptor) + if(isIceBox()) { IceBoxDescriptor iceBoxDescriptor = (IceBoxDescriptor)_templateDescriptor.descriptor; diff --git a/java/src/IceGridGUI/Application/ServiceInstance.java b/java/src/IceGridGUI/Application/ServiceInstance.java index eb31872424d..cd89f9f9eab 100755 --- a/java/src/IceGridGUI/Application/ServiceInstance.java +++ b/java/src/IceGridGUI/Application/ServiceInstance.java @@ -108,6 +108,11 @@ class ServiceInstance extends TreeNode implements Service, Cloneable getCoordinator().setClipboard(copyDescriptor(_descriptor)); getCoordinator().getActionsForMenu().get(PASTE).setEnabled(true); } + + public void paste() + { + ((TreeNode)_parent).paste(); + } public void moveUp() { diff --git a/java/src/IceGridGUI/Application/ServiceTemplate.java b/java/src/IceGridGUI/Application/ServiceTemplate.java index 4859c5b6c30..73a34a31a0e 100755 --- a/java/src/IceGridGUI/Application/ServiceTemplate.java +++ b/java/src/IceGridGUI/Application/ServiceTemplate.java @@ -65,6 +65,14 @@ class ServiceTemplate extends Communicator { actions[PASTE] = true; } + else + { + Object clipboard = getCoordinator().getClipboard(); + actions[PASTE] = clipboard != null && + (clipboard instanceof AdapterDescriptor + || clipboard instanceof DbEnvDescriptor); + } + actions[DELETE] = true; actions[NEW_ADAPTER] = !_ephemeral; @@ -77,10 +85,6 @@ class ServiceTemplate extends Communicator getCoordinator().setClipboard(copyDescriptor(_templateDescriptor)); getCoordinator().getActionsForMenu().get(PASTE).setEnabled(true); } - public void paste() - { - ((TreeNode)_parent).paste(); - } public JPopupMenu getPopupMenu() { |