Skip to content

Commit

Permalink
Fix: the file name was not displayed in the titles of the SQL console
Browse files Browse the repository at this point in the history
tabs
  • Loading branch information
Ralf Wisser committed Dec 5, 2024
1 parent 46dd6ab commit 5c45283
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
16 changes: 14 additions & 2 deletions src/main/gui/net/sf/jailer/ui/databrowser/BrowserContentPane.java
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,7 @@ private void updateERCounts(Table table, boolean limitExceeded, int numRowsRead)
/**
* {@link RowIdSupport} for data model.
*/
RowIdSupport rowIdSupport;
private RowIdSupport rowIdSupport;

/**
* {@link Association} with parent row, or <code>null</code>.
Expand Down Expand Up @@ -855,7 +855,7 @@ private void updateERCounts(Table table, boolean limitExceeded, int numRowsRead)
/**
* DB session.
*/
Session session;
private Session session;

private int currentRowSelection = -1;

Expand Down Expand Up @@ -8526,6 +8526,18 @@ protected Table getWhereClauseEditorBaseTable() {

private int currentEditState;

public void reset(Session session, DataModel dataModel) {
this.session = session;
this.rowIdSupport = new RowIdSupport(dataModel, session.dbms, executionContext);;
this.rows.clear();
}

public void reset(Session session) {
this.session = session;
this.rowIdSupport = new RowIdSupport(dataModel, session.dbms, executionContext);;
this.rows.clear();
}

public void destroy() {
if (rows != null) {
rows.clear();
Expand Down
13 changes: 8 additions & 5 deletions src/main/gui/net/sf/jailer/ui/databrowser/DataBrowser.java
Original file line number Diff line number Diff line change
Expand Up @@ -2181,9 +2181,7 @@ protected boolean setConnection(DbConnectionDialog dbConnectionDialog) throws Ex
.forEach(sqlConsole -> sqlConsole.onReconnect(prevDatabaseName, currentDatabaseName));
}
for (RowBrowser rb : desktop.getBrowsers()) {
rb.browserContentPane.session = session;
rb.browserContentPane.rowIdSupport = new RowIdSupport(datamodel.get(), session.dbms, executionContext);;
rb.browserContentPane.rows.clear();
rb.browserContentPane.reset(session, datamodel.get());
}
for (RowBrowser rb : desktop.getRootBrowsers(false)) {
rb.browserContentPane.reloadRows();
Expand Down Expand Up @@ -4174,8 +4172,7 @@ public void cleanUp() {
if (desktop != null) {
desktop.updateMenu();
for (RowBrowser rb : desktop.getBrowsers()) {
rb.browserContentPane.session = session;
rb.browserContentPane.rows.clear();
rb.browserContentPane.reset(session);
}
for (RowBrowser rb : desktop.getRootBrowsers(false)) {
rb.browserContentPane.reloadRows();
Expand Down Expand Up @@ -6397,6 +6394,12 @@ private SQLConsole createNewSQLConsole(MetaDataSource metaDataSource) throws SQL

private SQLConsoleWithTitle createNewSQLConsole(MetaDataSource metaDataSource, SQLConsoleWithTitle alreadyCreatedSqlConsole) throws SQLException {
final JLabel titleLbl = new JLabel(sqlConsoleIcon);
if (alreadyCreatedSqlConsole != null) {
alreadyCreatedSqlConsole.titleLbl.addPropertyChangeListener("text", e -> {
titleLbl.setText(alreadyCreatedSqlConsole.titleLbl.getText());
titleLbl.setToolTipText(alreadyCreatedSqlConsole.titleLbl.getToolTipText());
});
}
String tabName = "SQL Console";
if (alreadyCreatedSqlConsole == null) {
++sqlConsoleNr;
Expand Down
6 changes: 0 additions & 6 deletions src/main/gui/net/sf/jailer/ui/databrowser/Desktop.java
Original file line number Diff line number Diff line change
Expand Up @@ -4630,10 +4630,4 @@ public void run() {

// TODO display names for associations? (using unique fk-column list?)

// TODO
// TODO joined-links: bg too decent. (light laf)

// TODO
// TODO !hAlign-color-vs-hAlign-Color adjustment (espe. green)

}

0 comments on commit 5c45283

Please sign in to comment.