Skip to content

Commit

Permalink
Allow closing server connections.
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanhamilton committed Feb 11, 2024
1 parent 00a692d commit 23f7d49
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
21 changes: 20 additions & 1 deletion qstudio/src/main/java/com/timestored/qstudio/CommonActions.java
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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 {

Expand All @@ -633,7 +653,6 @@ public void actionPerformed(ActionEvent arg0) {
}
}



/**
* @param serverConfig The server that should be removed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit 23f7d49

Please sign in to comment.