Skip to content

Commit 23f7d49

Browse files
committed
Allow closing server connections.
1 parent 00a692d commit 23f7d49

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

qstudio/src/main/java/com/timestored/qstudio/CommonActions.java

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,7 @@ public Action getEditServerAction(ServerConfig sc) {
525525
*/
526526
public Action getAddServerAction() { return addServerAction; }
527527

528+
public Action getCloseConnServerAction(ServerConfig sc) { return new CloseConnServerAction(sc); }
528529

529530
/**
530531
* @return action that shows dialogue to allow adding a {@link ServerConfig}
@@ -609,6 +610,25 @@ public void actionPerformed(ActionEvent arg0) {
609610
}
610611
}
611612

613+
/** Close all server connections */
614+
private class CloseConnServerAction extends AbstractAction {
615+
616+
private static final long serialVersionUID = 1L;
617+
private final ServerConfig sc;
618+
619+
public CloseConnServerAction(ServerConfig sc) {
620+
super(Msg.get(Key.CLOSE_CONNECTION), Theme.CIcon.SERVER_LIGHTNING.get());
621+
putValue(SHORT_DESCRIPTION,
622+
"Close all connections to this database.");
623+
this.sc = sc;
624+
}
625+
626+
@Override public void actionPerformed(ActionEvent arg0) {
627+
connectionManager.closePool(sc);
628+
}
629+
}
630+
631+
612632
/** Clone a server to the {@link ConnectionManager} */
613633
private class CloneServerAction extends AbstractAction {
614634

@@ -633,7 +653,6 @@ public void actionPerformed(ActionEvent arg0) {
633653
}
634654
}
635655

636-
637656

638657
/**
639658
* @param serverConfig The server that should be removed

qstudio/src/main/java/com/timestored/qstudio/servertree/ServerListPanel.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ private boolean isTreeProblem() {
473473
}
474474
});
475475
menu.add(refreshMenuItem);
476-
476+
menu.add(commonActions.getCloseConnServerAction(sc));
477477

478478
JMenuItem generateTableDocs = new JMenuItem("Generate Table Docs " + serverModel.getName());
479479
generateTableDocs.setEnabled(sc.isKDB());

0 commit comments

Comments
 (0)