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.

Bug 73713 - Utility method for displaying the database connections in a combo box
Summary: Utility method for displaying the database connections in a combo box
Status: RESOLVED FIXED
Alias: None
Product: db
Classification: Unclassified
Component: Code (show other bugs)
Version: 5.x
Hardware: All All
: P2 blocker (vote)
Assignee: Andrei Badea
URL:
Keywords: API_REVIEW_FAST
Depends on:
Blocks: 73678
  Show dependency tree
 
Reported: 2006-03-17 16:26 UTC by Andrei Badea
Modified: 2006-03-29 13:21 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
Proposed change (18.37 KB, text/plain)
2006-03-17 16:34 UTC, Andrei Badea
Details
Javadoc (106.39 KB, application/x-compressed)
2006-03-17 16:37 UTC, Andrei Badea
Details
Proposed change (updated) (19.47 KB, text/plain)
2006-03-21 13:26 UTC, Andrei Badea
Details
Javadoc (updated) (112.47 KB, application/x-compressed)
2006-03-21 13:27 UTC, Andrei Badea
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrei Badea 2006-03-17 16:26:12 UTC
I would like to ask for the review of the following API change.

Some components which use the Database Explorer API usually need to display the
list of database connections in the UI, usually in a combo box. Therefore I am
proposing the introduction of a DatabaseConnectionUIHelper class containing a
static connect(JComboBox) method, which would display the database connections
as items of the passed combo box, followed by a separator item and an Add
Database Connection item. The latter item displays the New Connection dialog
when selected, allowing new database connections to be added.

Currently there are three components which will make use of the
DatabaseConnectionUIHelper class: the toolbar of the SQL editor, the Create Data
Source dialog and the Entity Classes/CMP Beans from Database wizard.

The target milestone is NetBeans 5.5. The change is compatible, so I request a
fast-track review.
Comment 1 Andrei Badea 2006-03-17 16:34:36 UTC
Created attachment 29292 [details]
Proposed change
Comment 2 Andrei Badea 2006-03-17 16:37:07 UTC
Created attachment 29293 [details]
Javadoc
Comment 3 Jaroslav Tulach 2006-03-20 07:53:45 UTC
There is missing @since tag in declaration of the connect method.

Maybe the method should take ConnectionManager as argument. I would not say 
this if the ConnectionManager had only static methods, but in fact it has 
instances and thus it makes sense to select the one to work on. If you do not 
accept this comment then please at least improve javadoc to mention that the 
method operates on ConnectionManager.getDefault().

Re. name of the class - I do not like it much, but I agree that the method 
should be in separate class and not (for example) in ConnectionManager. Maybe 
"DatabaseUIs" would be my preferred choice. However there is a more important 
aspect that probably Jesse should comment on - he likes to separate APIs into 
"necessary" and "helper" ones - this UI method is clearly just a helper which 
everyone could write by themselves, so I expect Jesse to suggest to follow 
convention of projects and to create separate package - org.nb.api.db.support 
and put all such "helper" classes there. 

PS: Why Libor is author of all changes in the diff and Andrei is submitting 
them?
Comment 4 Andrei Badea 2006-03-20 20:15:02 UTC
Re. missing @since tag: I thought that it is not necessary to add @since tags to
all methods of a new class and that it is enough to put a tag on the class
itself. Am I wrong?

Re. ConnectionManager parameter: I agree. Although ConnectionManager is a
singleton now, this could save a deprecated method if in the future I decide it
shouldn't be a singleton.

Re. class and package name: I don't like the name either, but couldn't come up
with anything better. DatabaseUIs and o.n.api.db.support seem too generic to me.
The package name suggests it could contain more database-related APIs than those
from the db module, but no other module than db would be able to add claseses to
it, since we don't like shared packages. Same for the class. Therefore I would
propose:

org.netbeans.api.db.explorer.support.DatabaseExplorerUIs

Re. other submitter than author: I should have written this class at Libor's
request, but since Libor had already created a similar one for data sources, I
asked him to write this one too. He didn't have time to ask for a review because
he was busy preparing his own review of the data sources API.

I will attach a new diff when a consensus is reached over the naming.
Comment 5 Jaroslav Tulach 2006-03-21 06:46:11 UTC
All agreed and sorry for the confusion with @since tag.
Comment 6 Andrei Badea 2006-03-21 13:26:28 UTC
Created attachment 29324 [details]
Proposed change (updated)
Comment 7 Andrei Badea 2006-03-21 13:27:16 UTC
Created attachment 29325 [details]
Javadoc (updated)
Comment 8 Andrei Badea 2006-03-24 10:47:30 UTC
If there are no more comments, the change will be commited to the release55
branch next week. Thank you for the review.
Comment 9 Libor Kotouc 2006-03-29 13:21:51 UTC
Changes were commited into release55 branch.