[hg] main-silver: #222736: New Database Connection option in New...

  • From: Jaroslav Havlin < >
  • To:
  • Subject: [hg] main-silver: #222736: New Database Connection option in New...
  • Date: Mon, 26 Nov 2012 17:34:58 -0800

changeset c39af246d969 in main-silver ((none))
details: http://hg.netbeans.org/main-silver/rev/c39af246d969
description:
        #222736: New Database Connection option in New Entity Classes from 
Database wizard does nothing

diffstat:

 db/src/org/netbeans/api/db/explorer/support/DatabaseExplorerUIs.java |  17 
++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diffs (35 lines):

diff --git 
a/db/src/org/netbeans/api/db/explorer/support/DatabaseExplorerUIs.java 
b/db/src/org/netbeans/api/db/explorer/support/DatabaseExplorerUIs.java
--- a/db/src/org/netbeans/api/db/explorer/support/DatabaseExplorerUIs.java
+++ b/db/src/org/netbeans/api/db/explorer/support/DatabaseExplorerUIs.java
@@ -48,7 +48,9 @@
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.Comparator;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
 import javax.swing.AbstractListModel;
 import javax.swing.ComboBoxModel;
 import javax.swing.JComboBox;
@@ -115,6 +117,21 @@
 
         @Override
         public void newItemActionPerformed() {
+            Set oldConnections = new 
HashSet(Arrays.asList(connectionManager.getConnections()));
+            connectionManager.showAddConnectionDialog(null);
+
+            // try to find the new connection
+            DatabaseConnection[] newConnections = 
connectionManager.getConnections();
+            if (newConnections.length == oldConnections.size()) {
+                // no new connection, so...
+                return;
+            }
+            for (int i = 0; i < newConnections.length; i++) {
+                if (!oldConnections.contains(newConnections[i])) {
+                    comboBoxModel.setSelectedItem(newConnections[i]);
+                    break;
+                }
+            }
         }
 
         @Override

[hg] main-silver: #222736: New Database Connection option in New...

Jaroslav Havlin 11/27/2012

Project Features

About this Project

DB was started in November 2009, is owned by Antonin Nebuzelsky, and has 113 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20131025.e7cbc9d). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close