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.
The Database Explorer API (http://bits.netbeans.org/dev/javadoc/org-netbeans-modules-db/allclasses-frame.html) provides a nice way to add connections programmatically. However, when I create the DatabaseConnection object using the DatabaseConnection.create method and when I add it to the list of connections, it displays w/ a very long name corresponding to the connection url and the schema. Now, in the UI I can go to the properties and adjust the name of the connection. The DatabaseConnection itself has a method to get the displayName; however, no setter for neither name or display name is provided. Also, the class is final, so I can’t subclass the getName method to use something more reasonable. Thus, I have no way to programmatically create a DatabaseConnection that would have a nice display name.
Created attachment 103089 [details] patch to allow for setting the display name with create factory method
The patch makes sense, just a unit test is missing. Thanks
Created attachment 103114 [details] unit tests to cover the modified api
Created attachment 103175 [details] proposed API change Please, review proposed API change. Thanks
Please, review proposed API change. Thanks
The new method shall be annotated with @since tag.
Jiri - do I need to produce another patch w/ the @since tag or is this something you would do ?
Thanks for review. I'm going to integrated it tomorrow.
The patch was applied in core-main/rev/35f292b1c239 Thanks for your contribution.
Cool, thanks Jirko for the review and especially Alex for your patch. I added this RFE to our list of community fixed issues. http://wiki.netbeans.org/NetFIXIssues
Integrated into 'main-golden', will be available in build *201011270001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/35f292b1c239 User: Jiri Rechtacek <jrechtacek@netbeans.org> Log: #192150: Allow setting the display name of a database connection through the API