This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Summary: | SQL Command tab is more descriptive of connection | ||
---|---|---|---|
Product: | db | Reporter: | borlak |
Component: | Code | Assignee: | Jaroslav Havlin <jhavlin> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | jrechtacek, matthias42, pjiricka |
Priority: | P2 | Keywords: | NETFIX, UI |
Version: | 6.x | ||
Hardware: | PC | ||
OS: | Windows 7 | ||
Issue Type: | ENHANCEMENT | Exception Reporter: | |
Attachments: |
Proposed Patch
Proposed Patch v2 proposed patch v1 (mb) |
Description
borlak
2011-02-23 17:10:38 UTC
Right, it's RFE makes sense to me. Will be consider while planning phase of the next NetBeans release. *** Bug 212583 has been marked as a duplicate of this bug. *** Created attachment 131737 [details]
Proposed Patch
The proposed patch changes format of SQL tab names (and file names), examples:
SQL SCH.TABLE_NAME - if catalog/schema and table name are available
SQL SCH.TABLE_NAME (2) - as above, plus number if more tabs exist
SQL MyConnectionName - if connection name contains only letters and numbers (*)
SQL Command 1 - otherwise
(*) Because tab names are also used as file names, instead of using letters that could be unsafe on some filesystems, legacy "SQL Command {n}" is used.
Created attachment 131739 [details]
Proposed Patch v2
Updated spec. version for library.
The following changes are in APIs that are not public, but if you are interested, please review them. db.metadata.model (friend private API, compatible change) ----------------- specification version increased to 1.1 packge org.netbeans.modules.db.metadata.model.api: - new method MetadataElementHandle#getNonNullNames() db (changes in non-public packages only, one incompatible change) -- specification version increased to 1.54 package org.netbeans.modules.db.explorer.sql.editor: - new method SQLEditorSupport#openSQLEditor( DatabaseConnection, String, boolean, MetadataElementHandle<?>) package org.netbeans.modules.db.spi.sql.editor: - changed interface method SQLEditorProvider#openSQLEditor( DatabaseConnection, String, boolean execute, MetadataElementHandle<?>) Created attachment 131785 [details]
proposed patch v1 (mb)
I had a look at it and had another idea. I think its a bit closer to the the title "more descriptive of connection". I think passing around the metadata element is not such a good idea, you can switch the connection at runtime and at latest after a netbeans restart, your connection is gone. What is more I got away without changing api :-).
The change in "SQL Editor" module is minimal (-> produce a shorter name for the console title, as it will get longer anyway). This could be dropped or changed to another label, but it should be short.
The SQL Editor TopComponent has knowledge about it's associated DatabaseConnection. It's therefore possible to extract the connection info and display it. The display name is constructed as "SQL CON <Number> [<ConnectionName>]". In the tooltip window I display: The "name" (SQL CON <Number>, the name of the connection and the full JDBC URL).
The realwork is done in SQLEditorSupport#messageToolTip and SQLEditorSupport#messageName, the change in SQLClonabelEditor is needed to update TopComponent name after restart.
(In reply to comment #6) > Created attachment 131785 [details] > proposed patch v1 (mb) Thank you! > I had a look at it and had another idea. I think its a bit closer to the the > title "more descriptive of connection". I think passing around the metadata > element is not such a good idea, you can switch the connection at runtime > and at latest after a netbeans restart, your connection is gone. What is > more I got away without changing api :-). Very good idea, let's use it. > The change in "SQL Editor" module is minimal (-> produce a shorter name for > the console title, as it will get longer anyway). This could be dropped or > changed to another label, but it should be short. What about using only "SQL n.sql" for file name? Is it too minimalistic? Integrated as http://hg.netbeans.org/core-main/rev/f0fae2a401b7 (In reply to comment #7) > > The change in "SQL Editor" module is minimal (-> produce a shorter name for > > the console title, as it will get longer anyway). This could be dropped or > > changed to another label, but it should be short. > What about using only "SQL n.sql" for file name? Is it too minimalistic? I like it - basicly everything wasted for additional characters takes screen space. The potential conflict with a local name seems to be negligible. If a user really saves saves as "SQL 1.sql" he most probably gets worse problems than potential visual conflicts. (In reply to comment #8) > > What about using only "SQL n.sql" for file name? Is it too minimalistic? > I like it - basicly everything wasted for additional characters takes screen > space. The potential conflict with a local name seems to be negligible. If a > user really saves saves as "SQL 1.sql" he most probably gets worse problems > than potential visual conflicts. Changed in http://hg.netbeans.org/core-main/rev/e765529286dd Thank you, Matthias. Integrated into 'main-golden', will be available in build *201302270948* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/f0fae2a401b7 User: Jaroslav Havlin <jhavlin@netbeans.org> Log: #195880: SQL Command tab is more descriptive of connection Integrated into 'main-golden', will be available in build *201302282300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/e765529286dd User: Jaroslav Havlin <jhavlin@netbeans.org> Log: #195880: Shorter file names for SQL commands |