diff --git a/qstudio/src/main/java/com/timestored/qstudio/CommonActions.java b/qstudio/src/main/java/com/timestored/qstudio/CommonActions.java index 11cced8..8f4bd1b 100644 --- a/qstudio/src/main/java/com/timestored/qstudio/CommonActions.java +++ b/qstudio/src/main/java/com/timestored/qstudio/CommonActions.java @@ -525,6 +525,7 @@ public Action getEditServerAction(ServerConfig sc) { */ public Action getAddServerAction() { return addServerAction; } + public Action getCloseConnServerAction(ServerConfig sc) { return new CloseConnServerAction(sc); } /** * @return action that shows dialogue to allow adding a {@link ServerConfig} @@ -609,6 +610,25 @@ public void actionPerformed(ActionEvent arg0) { } } + /** Close all server connections */ + private class CloseConnServerAction extends AbstractAction { + + private static final long serialVersionUID = 1L; + private final ServerConfig sc; + + public CloseConnServerAction(ServerConfig sc) { + super(Msg.get(Key.CLOSE_CONNECTION), Theme.CIcon.SERVER_LIGHTNING.get()); + putValue(SHORT_DESCRIPTION, + "Close all connections to this database."); + this.sc = sc; + } + + @Override public void actionPerformed(ActionEvent arg0) { + connectionManager.closePool(sc); + } + } + + /** Clone a server to the {@link ConnectionManager} */ private class CloneServerAction extends AbstractAction { @@ -633,7 +653,6 @@ public void actionPerformed(ActionEvent arg0) { } } - /** * @param serverConfig The server that should be removed diff --git a/qstudio/src/main/java/com/timestored/qstudio/servertree/ServerListPanel.java b/qstudio/src/main/java/com/timestored/qstudio/servertree/ServerListPanel.java index d42a74b..a00310e 100644 --- a/qstudio/src/main/java/com/timestored/qstudio/servertree/ServerListPanel.java +++ b/qstudio/src/main/java/com/timestored/qstudio/servertree/ServerListPanel.java @@ -473,7 +473,7 @@ private boolean isTreeProblem() { } }); menu.add(refreshMenuItem); - + menu.add(commonActions.getCloseConnServerAction(sc)); JMenuItem generateTableDocs = new JMenuItem("Generate Table Docs " + serverModel.getName()); generateTableDocs.setEnabled(sc.isKDB());