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.

View | Details | Raw Unified | Return to bug 144112
Collapse All | Expand All

(-)a/db.core/src/org/netbeans/modules/db/sql/execute/ui/SQLHistoryPanel.form (-2 / +5 lines)
Lines 1-6 Link Here
1
<?xml version="1.0" encoding="UTF-8" ?>
1
<?xml version="1.0" encoding="UTF-8" ?>
2
2
3
<Form version="1.6" maxVersion="1.6" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
3
<Form version="1.6" maxVersion="1.6" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
4
  <SyntheticProperties>
5
    <SyntheticProperty name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,38,0,0,2,-69"/>
6
  </SyntheticProperties>
4
  <AuxValues>
7
  <AuxValues>
5
    <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
8
    <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
6
    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
9
    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
Lines 21-27 Link Here
21
              <Group type="103" groupAlignment="0" attributes="0">
24
              <Group type="103" groupAlignment="0" attributes="0">
22
                  <Group type="102" attributes="0">
25
                  <Group type="102" attributes="0">
23
                      <Group type="103" groupAlignment="0" attributes="0">
26
                      <Group type="103" groupAlignment="0" attributes="0">
24
                          <Component id="jScrollPane1" pref="591" max="32767" attributes="0"/>
27
                          <Component id="jScrollPane1" pref="599" max="32767" attributes="0"/>
25
                          <Group type="102" attributes="0">
28
                          <Group type="102" attributes="0">
26
                              <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
29
                              <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
27
                              <EmptySpace type="unrelated" max="-2" attributes="0"/>
30
                              <EmptySpace type="unrelated" max="-2" attributes="0"/>
Lines 37-43 Link Here
37
                      <EmptySpace max="-2" attributes="0"/>
40
                      <EmptySpace max="-2" attributes="0"/>
38
                  </Group>
41
                  </Group>
39
                  <Group type="102" alignment="0" attributes="0">
42
                  <Group type="102" alignment="0" attributes="0">
40
                      <Component id="inputWarningLabel" pref="164" max="32767" attributes="0"/>
43
                      <Component id="inputWarningLabel" pref="194" max="32767" attributes="0"/>
41
                      <EmptySpace min="-2" pref="493" max="-2" attributes="0"/>
44
                      <EmptySpace min="-2" pref="493" max="-2" attributes="0"/>
42
                  </Group>
45
                  </Group>
43
                  <Group type="102" alignment="0" attributes="0">
46
                  <Group type="102" alignment="0" attributes="0">
(-)a/db.core/src/org/netbeans/modules/db/sql/execute/ui/SQLHistoryPanel.java (-7 / +66 lines)
Lines 51-62 Link Here
51
import java.awt.event.MouseAdapter;
51
import java.awt.event.MouseAdapter;
52
import java.awt.event.MouseEvent;
52
import java.awt.event.MouseEvent;
53
import java.io.File;
53
import java.io.File;
54
import java.io.IOException;
54
import java.text.DateFormat;
55
import java.text.DateFormat;
55
import java.util.ArrayList;
56
import java.util.ArrayList;
56
import java.util.Collections;
57
import java.util.Collections;
57
import java.util.Comparator;
58
import java.util.Comparator;
58
import java.util.Date;
59
import java.util.Date;
60
import java.util.HashMap;
59
import java.util.List;
61
import java.util.List;
62
import java.util.Map;
60
import java.util.logging.Level;
63
import java.util.logging.Level;
61
import java.util.logging.Logger;
64
import java.util.logging.Logger;
62
import javax.swing.DefaultComboBoxModel;
65
import javax.swing.DefaultComboBoxModel;
Lines 90-98 Link Here
90
import org.netbeans.modules.db.sql.history.SQLHistoryPersistenceManager;
93
import org.netbeans.modules.db.sql.history.SQLHistoryPersistenceManager;
91
import org.openide.filesystems.FileObject;
94
import org.openide.filesystems.FileObject;
92
import org.openide.filesystems.FileUtil;
95
import org.openide.filesystems.FileUtil;
96
import org.openide.loaders.DataObject;
97
import org.openide.loaders.XMLDataObject;
93
import org.openide.util.Exceptions;
98
import org.openide.util.Exceptions;
94
import org.openide.util.NbBundle;
99
import org.openide.util.NbBundle;
95
import org.openide.util.NbPreferences;
100
import org.openide.util.NbPreferences;
101
import org.w3c.dom.Node;
102
import org.xml.sax.SAXException;
96
103
97
/**
104
/**
98
 *
105
 *
Lines 115-126 Link Here
115
    private SQLHistoryView view;
122
    private SQLHistoryView view;
116
    private JEditorPane editorPane;
123
    private JEditorPane editorPane;
117
    private String currentUrl;
124
    private String currentUrl;
125
    private Map<String,String> urlAliasMap = new HashMap<String, String>();
126
    private Map<String,String> aliasUrlMap = new HashMap<String, String>();
118
127
119
    /** Creates new form SQLHistoryPanel */
128
    /** Creates new form SQLHistoryPanel */
120
    public SQLHistoryPanel(final JEditorPane editorPane) {
129
    public SQLHistoryPanel(final JEditorPane editorPane) {
121
        this.editorPane = editorPane;
130
        this.editorPane = editorPane;
122
        historyFilePath = FileUtil.getFileDisplayName(historyRoot) + File.separator + SQL_HISTORY_FILE_NAME + ".xml"; // NOI18N
131
        historyFilePath = FileUtil.getFileDisplayName(historyRoot) + File.separator + SQL_HISTORY_FILE_NAME + ".xml"; // NOI18N
123
        view = new SQLHistoryView(new SQLHistoryModelImpl());
132
        view = new SQLHistoryView(new SQLHistoryModelImpl());
133
        initKnownConnectionNames();
124
        initSQLHistoryTableData();
134
        initSQLHistoryTableData();
125
        initComponents();
135
        initComponents();
126
        initComponentData();
136
        initComponentData();
Lines 133-139 Link Here
133
            }
143
            }
134
        });
144
        });
135
    }
145
    }
136
    
146
147
    private void initKnownConnectionNames() {
148
        FileObject configFile = FileUtil.getConfigFile("Databases/Connections");
149
        for (FileObject o : configFile.getChildren()) {
150
            if ("text/xml".equals(o.getMIMEType())) {
151
                try {
152
                    XMLDataObject connectionData = DataObject.find(o).getLookup().lookup(XMLDataObject.class);
153
                    if (connectionData != null) {
154
                        String displayName = null;
155
                        String defaultName = null;
156
                        Node connectionPropertyNode = connectionData.getDocument().getFirstChild();
157
                        while (connectionPropertyNode != null) {
158
                            Node propNode = connectionPropertyNode.getFirstChild();
159
                            while (propNode != null) {
160
                                if ("database-url".equals(propNode.getNodeName())) {
161
                                    defaultName = propNode.getAttributes().getNamedItem("value").getTextContent();
162
                                } else if ("display-name".equals(propNode.getNodeName())) {
163
                                    displayName = propNode.getAttributes().getNamedItem("value").getTextContent();
164
                                }
165
                                propNode = propNode.getNextSibling();
166
                            }
167
                            connectionPropertyNode = connectionPropertyNode.getNextSibling();
168
                        }
169
                        if (displayName != null && defaultName != null) {
170
                            urlAliasMap.put(defaultName, displayName);
171
                            aliasUrlMap.put(displayName, defaultName);
172
                        }
173
                    }
174
                } catch (IOException ex) {
175
                    Exceptions.printStackTrace(ex);
176
                } catch (SAXException ex) {
177
                    Exceptions.printStackTrace(ex);
178
                }
179
            }
180
        }
181
    }
182
137
    private void setupSQLSaveLimit() {
183
    private void setupSQLSaveLimit() {
138
        // SQL statments save limit
184
        // SQL statments save limit
139
        String savedLimit = NbPreferences.forModule(SQLHistoryPanel.class).get("SQL_STATEMENTS_SAVED_FOR_HISTORY", ""); // NOI18N
185
        String savedLimit = NbPreferences.forModule(SQLHistoryPanel.class).get("SQL_STATEMENTS_SAVED_FOR_HISTORY", ""); // NOI18N
Lines 565-573 Link Here
565
        public List<String> getUrlList() {
611
        public List<String> getUrlList() {
566
            List<String> urlList = new ArrayList<String>();
612
            List<String> urlList = new ArrayList<String>();
567
            for (SQLHistory sqlHistory : sqlHistoryList) {
613
            for (SQLHistory sqlHistory : sqlHistoryList) {
568
                String url = sqlHistory.getUrl();
614
                String connectionName = sqlHistory.getUrl();
569
                if (!urlList.contains(url)) {
615
                if (urlAliasMap.containsKey(connectionName)) {
570
                    urlList.add(url);
616
                    connectionName = urlAliasMap.get(connectionName);
617
                }
618
                if (!urlList.contains(connectionName)) {
619
                    urlList.add(connectionName);
571
                }
620
                }
572
            }
621
            }
573
            return urlList;
622
            return urlList;
Lines 624-631 Link Here
624
            connectionUrlComboBox.setSelectedItem(defaultSelectedItem);
673
            connectionUrlComboBox.setSelectedItem(defaultSelectedItem);
625
674
626
            for (SQLHistory sqlHistory : sqlHistoryList) {
675
            for (SQLHistory sqlHistory : sqlHistoryList) {
627
                if (!currentUrlList.contains(sqlHistory.getUrl())) {
676
                String connectionName = sqlHistory.getUrl();
628
                    currentUrlList.add(sqlHistory.getUrl());
677
                if (urlAliasMap.containsKey(connectionName)) {
678
                    connectionName = urlAliasMap.get(connectionName);
679
                }
680
                if (!currentUrlList.contains(connectionName)) {
681
                    currentUrlList.add(connectionName);
629
                }
682
                }
630
            }
683
            }
631
            // Initialize combo data
684
            // Initialize combo data
Lines 642-647 Link Here
642
            List<SQLHistory> filteredSqlHistoryList = new ArrayList<SQLHistory>();
695
            List<SQLHistory> filteredSqlHistoryList = new ArrayList<SQLHistory>();
643
            String match = searchTextField.getText();
696
            String match = searchTextField.getText();
644
            String url = (String)connectionUrlComboBox.getSelectedItem();
697
            String url = (String)connectionUrlComboBox.getSelectedItem();
698
            if (aliasUrlMap.containsKey(url)) {
699
                url = aliasUrlMap.get(url);
700
            }
645
            // modify list of SQL to reflect a selection from the Connection dropdown or if a match text entered
701
            // modify list of SQL to reflect a selection from the Connection dropdown or if a match text entered
646
            for (SQLHistory sqlHistory : sqlHistoryList) {
702
            for (SQLHistory sqlHistory : sqlHistoryList) {
647
                if (sqlHistory.getUrl().equals(url) || url.equals(NbBundle.getMessage(SQLHistoryPanel.class, "LBL_ConnectionCombo"))) {
703
                if (sqlHistory.getUrl().equals(url) || url.equals(NbBundle.getMessage(SQLHistoryPanel.class, "LBL_ConnectionCombo"))) {
Lines 691-697 Link Here
691
        List<String> dateList;
747
        List<String> dateList;
692
        int sortCol = 1;
748
        int sortCol = 1;
693
        boolean sortAsc = false;
749
        boolean sortAsc = false;
694
            
750
695
        @Override
751
        @Override
696
        public int getRowCount() {
752
        public int getRowCount() {
697
            if (sqlHistoryTable.getSelectedRow() == -1) {
753
            if (sqlHistoryTable.getSelectedRow() == -1) {
Lines 778-783 Link Here
778
            // Get the connection url from the combo box
834
            // Get the connection url from the combo box
779
            if (sqlHistoryList.size() > 0) {
835
            if (sqlHistoryList.size() > 0) {
780
                url = connectionUrlComboBox.getSelectedItem().toString();
836
                url = connectionUrlComboBox.getSelectedItem().toString();
837
                if (aliasUrlMap.containsKey(url)) {
838
                    url = aliasUrlMap.get(url);
839
                }
781
            } else {
840
            } else {
782
                url = NbBundle.getMessage(SQLHistoryPanel.class, "LBL_URLComboBoxAllConnectionsItem");
841
                url = NbBundle.getMessage(SQLHistoryPanel.class, "LBL_URLComboBoxAllConnectionsItem");
783
            }
842
            }
(-)a/db/libsrc/org/netbeans/lib/ddl/DBConnection.java (-1 / +8 lines)
Lines 1-7 Link Here
1
/*
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
3
 *
4
 * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
4
 * Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved.
5
 *
5
 *
6
 * The contents of this file are subject to the terms of either the GNU
6
 * The contents of this file are subject to the terms of either the GNU
7
 * General Public License Version 2 only ("GPL") or the Common
7
 * General Public License Version 2 only ("GPL") or the Common
Lines 56-61 Link Here
56
56
57
public interface DBConnection extends java.io.Serializable
57
public interface DBConnection extends java.io.Serializable
58
{
58
{
59
60
    /** Returns the name that is displayed for this connection. */
61
    public String getDisplayName();
62
63
    /** Set the name that is displayed for this connection. */
64
    public void setDisplayName(String name);
65
59
    /** Returns driver URL */
66
    /** Returns driver URL */
60
    public String getDriver();
67
    public String getDriver();
61
68
(-)a/db/src/org/netbeans/api/db/explorer/DatabaseConnection.java (-3 / +3 lines)
Lines 113-119 Link Here
113
     * @param user the username.
113
     * @param user the username.
114
     * @param schema the schema to use, or null for the default schema
114
     * @param schema the schema to use, or null for the default schema
115
     * @param password the password.
115
     * @param password the password.
116
     * @param rememberPassword whether to remeber the password for the current session.
116
     * @param rememberPassword whether to remember the password for the current session.
117
     *
117
     *
118
     * @return the new instance.
118
     * @return the new instance.
119
     *
119
     *
Lines 149-155 Link Here
149
     * Returns the JDBC driver instance that this connection uses.
149
     * Returns the JDBC driver instance that this connection uses.
150
     *
150
     *
151
     * @since 1.32
151
     * @since 1.32
152
     * @return the JDBC driver or null if no driver registred
152
     * @return the JDBC driver or null if no driver registered
153
     */
153
     */
154
    public JDBCDriver getJDBCDriver() {
154
    public JDBCDriver getJDBCDriver() {
155
        return delegate.findJDBCDriver ();
155
        return delegate.findJDBCDriver ();
Lines 206-212 Link Here
206
     * @return the display name
206
     * @return the display name
207
     */
207
     */
208
    public String getDisplayName() {
208
    public String getDisplayName() {
209
        return delegate.getName();
209
        return delegate.getDisplayName();
210
    }
210
    }
211
    
211
    
212
    /**
212
    /**
(-)a/db/src/org/netbeans/api/db/explorer/node/BaseNode.java (+2 lines)
Lines 84-89 Link Here
84
    protected static final String REMEMBERPWDESC = "RememberPasswordDescription"; // NOI18N
84
    protected static final String REMEMBERPWDESC = "RememberPasswordDescription"; // NOI18N
85
    protected static final String CATALOG = "Catalog"; // NOI18N
85
    protected static final String CATALOG = "Catalog"; // NOI18N
86
    protected static final String CATALOGDESC = "CatalogDescription"; // NOI18N
86
    protected static final String CATALOGDESC = "CatalogDescription"; // NOI18N
87
    protected static final String DISPLAYNAME = "DisplayName"; // NOI18N
88
    protected static final String DISPLAYNAMEDESC = "DisplayNameDescription"; // NOI18N
87
    protected static final String UNIQUE = "UniqueNoMnemonic"; // NOI18N
89
    protected static final String UNIQUE = "UniqueNoMnemonic"; // NOI18N
88
    protected static final String UNIQUEDESC = "UniqueDescription"; // NOI18N
90
    protected static final String UNIQUEDESC = "UniqueDescription"; // NOI18N
89
    protected static final String NULL = "Null"; // NOI18N
91
    protected static final String NULL = "Null"; // NOI18N
(-)a/db/src/org/netbeans/api/db/explorer/node/Bundle.properties (+2 lines)
Lines 67-72 Link Here
67
RememberPasswordDescription=Remember password
67
RememberPasswordDescription=Remember password
68
Catalog=Catalog
68
Catalog=Catalog
69
CatalogDescription=Catalog
69
CatalogDescription=Catalog
70
DisplayName=Display name
71
DisplayNameDescription=Display name
70
DefaultCatalog=Default Catalog
72
DefaultCatalog=Default Catalog
71
Schema=Schema
73
Schema=Schema
72
SchemaDescription=Schema
74
SchemaDescription=Schema
(-)a/db/src/org/netbeans/modules/db/explorer/DatabaseConnection.java (-1 / +23 lines)
Lines 138-143 Link Here
138
138
139
    /** Connection name */
139
    /** Connection name */
140
    private String name;
140
    private String name;
141
142
    /** The user-specified name that is to be displayed for this connection. */
143
    private String displayName;
141
    
144
    
142
    /** Error code */
145
    /** Error code */
143
    private int errorCode = -1;
146
    private int errorCode = -1;
Lines 166-171 Link Here
166
    public static final String PROP_DEFCATALOG = "defaultCatalog"; //NOI18N
169
    public static final String PROP_DEFCATALOG = "defaultCatalog"; //NOI18N
167
    public static final String PROP_DRIVERNAME = "drivername"; //NOI18N
170
    public static final String PROP_DRIVERNAME = "drivername"; //NOI18N
168
    public static final String PROP_NAME = "name"; //NOI18N
171
    public static final String PROP_NAME = "name"; //NOI18N
172
    public static final String PROP_DISPLAY_NAME = "displayName"; //NOI18N
169
    public static final String DRIVER_CLASS_NET = "org.apache.derby.jdbc.ClientDriver"; // NOI18N
173
    public static final String DRIVER_CLASS_NET = "org.apache.derby.jdbc.ClientDriver"; // NOI18N
170
    public static final int DERBY_UNICODE_ERROR_CODE = 20000;
174
    public static final int DERBY_UNICODE_ERROR_CODE = 20000;
171
    private OpenConnectionInterface openConnection = null;
175
    private OpenConnectionInterface openConnection = null;
Lines 448-453 Link Here
448
            propertySupport.firePropertyChange(PROP_NAME, old, name);
452
            propertySupport.firePropertyChange(PROP_NAME, old, name);
449
    }
453
    }
450
454
455
    public String getDisplayName() {
456
        return ( displayName!=null && displayName.length()>0 ) ? displayName : getName();
457
    }
458
459
    public void setDisplayName(String value) {
460
        if ( (displayName == null && value==null) ||
461
                (displayName!=null && displayName.equals(value)) )
462
            return;
463
464
        String old = displayName;
465
        displayName = value;
466
        if(propertySupport!=null)
467
            propertySupport.firePropertyChange(PROP_NAME, old, displayName);
468
    }
469
451
    /** Returns user schema name */
470
    /** Returns user schema name */
452
    public String getSchema() {
471
    public String getSchema() {
453
        if (schema == null)
472
        if (schema == null)
Lines 841-848 Link Here
841
860
842
        try {
861
        try {
843
            drvname = (String) in.readObject();
862
            drvname = (String) in.readObject();
863
            displayName = (String) in.readObject();
844
        } catch (Exception exc) {
864
        } catch (Exception exc) {
845
            //IGNORE - not stored in 3.6 and earlier
865
            //IGNORE - drvname not stored in 3.6 and earlier
866
            //IGNORE - displayName not stored in 6.7 and earlier
846
        }
867
        }
847
868
848
        // boston setting/pilsen setting?
869
        // boston setting/pilsen setting?
Lines 866-871 Link Here
866
        out.writeObject(schema);
887
        out.writeObject(schema);
867
        out.writeObject(DatabaseConnection.SUPPORT);
888
        out.writeObject(DatabaseConnection.SUPPORT);
868
        out.writeObject(drvname);
889
        out.writeObject(drvname);
890
        out.writeObject(displayName);
869
    }
891
    }
870
892
871
    @Override
893
    @Override
(-)a/db/src/org/netbeans/modules/db/explorer/DatabaseConnectionConvertor.java (-5 / +14 lines)
Lines 1-7 Link Here
1
/*
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
3
 *
4
 * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
4
 * Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved.
5
 *
5
 *
6
 * The contents of this file are subject to the terms of either the GNU
6
 * The contents of this file are subject to the terms of either the GNU
7
 * General Public License Version 2 only ("GPL") or the Common
7
 * General Public License Version 2 only ("GPL") or the Common
Lines 55-69 Link Here
55
import java.nio.charset.Charset;
55
import java.nio.charset.Charset;
56
import java.nio.charset.CharsetDecoder;
56
import java.nio.charset.CharsetDecoder;
57
import java.nio.charset.CoderResult;
57
import java.nio.charset.CoderResult;
58
import java.util.Iterator;
59
import java.util.LinkedList;
58
import java.util.LinkedList;
60
import java.util.Map;
59
import java.util.Map;
61
import java.util.Vector;
62
import java.util.WeakHashMap;
60
import java.util.WeakHashMap;
63
import java.util.concurrent.ConcurrentHashMap;
61
import java.util.concurrent.ConcurrentHashMap;
64
import java.util.logging.Level;
62
import java.util.logging.Level;
65
import java.util.logging.Logger;
63
import java.util.logging.Logger;
66
import org.netbeans.modules.db.explorer.node.RootNode;
67
import org.openide.cookies.InstanceCookie;
64
import org.openide.cookies.InstanceCookie;
68
import org.openide.filesystems.FileLock;
65
import org.openide.filesystems.FileLock;
69
import org.openide.filesystems.FileObject;
66
import org.openide.filesystems.FileObject;
Lines 82-88 Link Here
82
import org.openide.xml.EntityCatalog;
79
import org.openide.xml.EntityCatalog;
83
import org.openide.xml.XMLUtil;
80
import org.openide.xml.XMLUtil;
84
import org.netbeans.modules.db.util.Base64;
81
import org.netbeans.modules.db.util.Base64;
85
import org.openide.util.Exceptions;
86
import org.xml.sax.Attributes;
82
import org.xml.sax.Attributes;
87
import org.xml.sax.InputSource;
83
import org.xml.sax.InputSource;
88
import org.xml.sax.SAXException;
84
import org.xml.sax.SAXException;
Lines 232-237 Link Here
232
                handler.user,
228
                handler.user,
233
                handler.password, 
229
                handler.password, 
234
                handler.rememberPassword);
230
                handler.rememberPassword);
231
        if ( handler.displayName!=null ) {
232
            dbconn.setDisplayName(handler.displayName);
233
        }
235
234
236
        return dbconn;
235
        return dbconn;
237
    }
236
    }
Lines 379-384 Link Here
379
            if (instance.getUser() != null) {
378
            if (instance.getUser() != null) {
380
                pw.println("  <user value='" + XMLUtil.toAttributeValue(instance.getUser()) + "'/>"); //NOI18N
379
                pw.println("  <user value='" + XMLUtil.toAttributeValue(instance.getUser()) + "'/>"); //NOI18N
381
            }
380
            }
381
            if ( ! instance.getName().equals(instance.getDisplayName()) ) {
382
                pw.println("  <display-name value='" + XMLUtil.toAttributeValue(instance.getDisplayName()) + "'/>"); //NOI18N
383
            }
382
            if (instance.rememberPassword() ) {
384
            if (instance.rememberPassword() ) {
383
                String password = instance.getPassword();
385
                String password = instance.getPassword();
384
                
386
                
Lines 407-412 Link Here
407
        private static final String ELEMENT_SCHEMA = "schema"; // NOI18N
409
        private static final String ELEMENT_SCHEMA = "schema"; // NOI18N
408
        private static final String ELEMENT_USER = "user"; // NOI18N
410
        private static final String ELEMENT_USER = "user"; // NOI18N
409
        private static final String ELEMENT_PASSWORD = "password"; // NOI18N
411
        private static final String ELEMENT_PASSWORD = "password"; // NOI18N
412
        private static final String ELEMENT_DISPLAY_NAME = "display-name"; // NOI18N
410
        private static final String ELEMENT_REMEMBER_PASSWORD = "remember-password";
413
        private static final String ELEMENT_REMEMBER_PASSWORD = "remember-password";
411
        private static final String ATTR_PROPERTY_VALUE = "value"; // NOI18N
414
        private static final String ATTR_PROPERTY_VALUE = "value"; // NOI18N
412
        
415
        
Lines 419-435 Link Here
419
        String user;
422
        String user;
420
        String password;
423
        String password;
421
        boolean rememberPassword;
424
        boolean rememberPassword;
425
        String displayName;
422
        
426
        
423
        public Handler(String connectionFileName) {
427
        public Handler(String connectionFileName) {
424
            this.connectionFileName = connectionFileName;
428
            this.connectionFileName = connectionFileName;
425
        }
429
        }
426
430
431
        @Override
427
        public void startDocument() throws SAXException {
432
        public void startDocument() throws SAXException {
428
        }
433
        }
429
434
435
        @Override
430
        public void endDocument() throws SAXException {
436
        public void endDocument() throws SAXException {
431
        }
437
        }
432
438
439
        @Override
433
        public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
440
        public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
434
            String value = attrs.getValue(ATTR_PROPERTY_VALUE);
441
            String value = attrs.getValue(ATTR_PROPERTY_VALUE);
435
            if (ELEMENT_DRIVER_CLASS.equals(qName)) {
442
            if (ELEMENT_DRIVER_CLASS.equals(qName)) {
Lines 442-447 Link Here
442
                schema = value;
449
                schema = value;
443
            } else if (ELEMENT_USER.equals(qName)) {
450
            } else if (ELEMENT_USER.equals(qName)) {
444
                user = value;
451
                user = value;
452
            } else if (ELEMENT_DISPLAY_NAME.equals(qName)) {
453
                displayName = value;
445
            } else if (ELEMENT_PASSWORD.equals(qName)) {
454
            } else if (ELEMENT_PASSWORD.equals(qName)) {
446
                // If the password was saved, then it means the user checked
455
                // If the password was saved, then it means the user checked
447
                // the box to say the password should be remembered.
456
                // the box to say the password should be remembered.
(-)a/db/src/org/netbeans/modules/db/explorer/dataview/DataViewWindow.java (-1 / +1 lines)
Lines 124-130 Link Here
124
        //while(!(tempInfo instanceof ConnectionNodeInfo))
124
        //while(!(tempInfo instanceof ConnectionNodeInfo))
125
        //    tempInfo = tempInfo.getParent();
125
        //    tempInfo = tempInfo.getParent();
126
126
127
        String title = connection.getName(); //tempInfo.getDisplayName();
127
        String title = connection.getDisplayName(); //tempInfo.getDisplayName();
128
        int idx = title.indexOf(" ["); //NOI18N
128
        int idx = title.indexOf(" ["); //NOI18N
129
        title = title.substring(0, idx);
129
        title = title.substring(0, idx);
130
        setName(title);
130
        setName(title);
(-)a/db/src/org/netbeans/modules/db/explorer/dlg/Bundle.properties (-2 / +6 lines)
Lines 70-77 Link Here
70
AddDriver_Chooser_Filter=Archive Files (*.jar, *.zip)
70
AddDriver_Chooser_Filter=Archive Files (*.jar, *.zip)
71
71
72
NewConnectionDialogTitle=New Database Connection
72
NewConnectionDialogTitle=New Database Connection
73
NewConnectionDriverName=&Name:
73
NewConnectionDriverName=Driver &Name:
74
NewConnectionUserName=&User Name\:
74
NewConnectionDisplayName=Displa&y Name:
75
NewConnectionUserName=&User Name:
75
NewConnectionPassword=Pass&word:
76
NewConnectionPassword=Pass&word:
76
NewConnectionRememberPassword=<html>&Remember password<br>(see help for information on security risks)</html>
77
NewConnectionRememberPassword=<html>&Remember password<br>(see help for information on security risks)</html>
77
NewConnectionDatabase=&Database:
78
NewConnectionDatabase=&Database:
Lines 92-100 Link Here
92
NewConnection.ERR_FieldRequired=Please specify a value for the required field {0}
93
NewConnection.ERR_FieldRequired=Please specify a value for the required field {0}
93
NewConnection.MSG_SelectADriver=Please select a driver from the drop-down list
94
NewConnection.MSG_SelectADriver=Please select a driver from the drop-down list
94
NewConnection.MSG_SpecifyURL=Please specify a JDBC URL for this connection
95
NewConnection.MSG_SpecifyURL=Please specify a JDBC URL for this connection
96
NewConnection.MSG_DuplicateDisplayName=Display name has already been defined
95
ACS_NewConnectionDriverNameA11yDesc=Connection name.
97
ACS_NewConnectionDriverNameA11yDesc=Connection name.
96
ACS_NewConnectionDriverNameComboBoxA11yName=Connection name combo box
98
ACS_NewConnectionDriverNameComboBoxA11yName=Connection name combo box
97
ACS_NewConnectionDriverClassComboBoxA11yDesc=Combo box containing all driver classes.
99
ACS_NewConnectionDriverClassComboBoxA11yDesc=Combo box containing all driver classes.
100
ACS_NewConnectionDisplayNameA11yDesc=Display name.
101
ACS_NewConnectionDisplayNameTextFieldA11yName=Display name text field.
98
ACS_NewConnectionUserNameA11yDesc=Database user name.
102
ACS_NewConnectionUserNameA11yDesc=Database user name.
99
ACS_NewConnectionUserNameTextFieldA11yName=Database user name text field
103
ACS_NewConnectionUserNameTextFieldA11yName=Database user name text field
100
ACS_NewConnectionPasswordA11yDesc=Database password.
104
ACS_NewConnectionPasswordA11yDesc=Database password.
(-)a/db/src/org/netbeans/modules/db/explorer/dlg/NewConnectionPanel.form (-37 / +72 lines)
Lines 6-12 Link Here
6
    </Component>
6
    </Component>
7
  </NonVisualComponents>
7
  </NonVisualComponents>
8
  <SyntheticProperties>
8
  <SyntheticProperties>
9
    <SyntheticProperty name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,3,89,0,0,2,-68"/>
9
    <SyntheticProperty name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,2,-29,0,0,2,-68"/>
10
  </SyntheticProperties>
10
  </SyntheticProperties>
11
  <AuxValues>
11
  <AuxValues>
12
    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
12
    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
Lines 26-57 Link Here
26
              <EmptySpace max="-2" attributes="0"/>
26
              <EmptySpace max="-2" attributes="0"/>
27
              <Group type="103" groupAlignment="0" attributes="0">
27
              <Group type="103" groupAlignment="0" attributes="0">
28
                  <Component id="jPanel1" alignment="0" max="32767" attributes="0"/>
28
                  <Component id="jPanel1" alignment="0" max="32767" attributes="0"/>
29
                  <Group type="102" attributes="0">
29
                  <Component id="errorInfoPanel" alignment="0" pref="676" max="32767" attributes="0"/>
30
                  <Group type="102" alignment="0" attributes="0">
30
                      <Group type="103" groupAlignment="0" attributes="0">
31
                      <Group type="103" groupAlignment="0" attributes="0">
31
                          <Group type="103" alignment="0" groupAlignment="0" max="-2" attributes="0">
32
                          <Group type="103" groupAlignment="0" attributes="0">
32
                              <Component id="inputModelLabel" alignment="0" max="32767" attributes="1"/>
33
                              <Group type="102" alignment="0" attributes="0">
33
                              <Component id="templateLabel" alignment="0" max="32767" attributes="1"/>
34
                                  <Group type="103" groupAlignment="0" attributes="0">
34
                              <Component id="hostLabel" alignment="0" max="32767" attributes="1"/>
35
                                      <Component id="showUrlCheckBox" min="-2" pref="132" max="-2" attributes="1"/>
35
                              <Component id="portLabel" alignment="0" max="32767" attributes="1"/>
36
                                      <Component id="directUrlLabel" alignment="0" min="-2" max="-2" attributes="1"/>
36
                              <Component id="databaseLabel" alignment="0" max="32767" attributes="1"/>
37
                                  </Group>
37
                              <Component id="passwordLabel" alignment="0" max="32767" attributes="1"/>
38
                                  <EmptySpace min="-2" pref="12" max="-2" attributes="0"/>
38
                              <Component id="userLabel" alignment="0" max="32767" attributes="1"/>
39
                              </Group>
39
                              <Component id="instanceLabel" alignment="0" max="32767" attributes="1"/>
40
                              <Group type="102" alignment="0" attributes="0">
40
                              <Component id="serverNameLabel" alignment="0" max="32767" attributes="1"/>
41
                                  <Component id="additionalPropsLabel" pref="120" max="32767" attributes="1"/>
41
                              <Component id="dsnLabel" alignment="0" max="32767" attributes="1"/>
42
                                  <EmptySpace min="-2" pref="24" max="-2" attributes="0"/>
42
                              <Component id="tnsLabel" alignment="0" max="32767" attributes="1"/>
43
                              </Group>
43
                              <Component id="serviceLabel" alignment="0" max="32767" attributes="1"/>
44
                              <Component id="sidLabel" alignment="0" pref="119" max="32767" attributes="1"/>
45
                          </Group>
44
                          </Group>
46
                          <Group type="103" alignment="0" groupAlignment="0" max="-2" attributes="0">
45
                          <Group type="102" alignment="0" attributes="0">
47
                              <Component id="additionalPropsLabel" alignment="1" max="32767" attributes="1"/>
46
                              <Group type="103" groupAlignment="1" max="-2" attributes="0">
48
                              <Component id="directUrlLabel" alignment="0" max="32767" attributes="1"/>
47
                                  <Component id="displayNameLabel" alignment="0" max="32767" attributes="1"/>
49
                              <Component id="showUrlCheckBox" alignment="1" min="-2" pref="132" max="-2" attributes="1"/>
48
                                  <Component id="inputModelLabel" alignment="0" max="32767" attributes="1"/>
49
                                  <Component id="templateLabel" alignment="0" max="32767" attributes="1"/>
50
                                  <Component id="portLabel" alignment="0" max="32767" attributes="1"/>
51
                                  <Component id="databaseLabel" alignment="0" max="32767" attributes="1"/>
52
                                  <Component id="passwordLabel" alignment="0" max="32767" attributes="1"/>
53
                                  <Component id="userLabel" alignment="0" max="32767" attributes="1"/>
54
                                  <Component id="instanceLabel" alignment="0" max="32767" attributes="1"/>
55
                                  <Component id="serverNameLabel" alignment="0" max="32767" attributes="1"/>
56
                                  <Component id="dsnLabel" alignment="0" max="32767" attributes="1"/>
57
                                  <Component id="tnsLabel" alignment="0" max="32767" attributes="1"/>
58
                                  <Component id="serviceLabel" alignment="0" max="32767" attributes="1"/>
59
                                  <Component id="sidLabel" alignment="0" pref="119" max="32767" attributes="1"/>
60
                                  <Component id="hostLabel" alignment="0" max="32767" attributes="1"/>
61
                              </Group>
62
                              <EmptySpace min="-2" pref="25" max="-2" attributes="0"/>
50
                          </Group>
63
                          </Group>
51
                      </Group>
64
                      </Group>
52
                      <EmptySpace max="-2" attributes="0"/>
53
                      <Group type="103" groupAlignment="0" attributes="0">
65
                      <Group type="103" groupAlignment="0" attributes="0">
54
                          <Component id="urlField" alignment="0" pref="532" max="32767" attributes="1"/>
66
                          <Component id="urlField" alignment="1" pref="532" max="32767" attributes="1"/>
55
                          <Component id="additionalPropsField" alignment="1" pref="532" max="32767" attributes="1"/>
67
                          <Component id="additionalPropsField" alignment="1" pref="532" max="32767" attributes="1"/>
56
                          <Group type="102" attributes="0">
68
                          <Group type="102" attributes="0">
57
                              <Component id="fieldInputCheckBox" min="-2" max="-2" attributes="0"/>
69
                              <Component id="fieldInputCheckBox" min="-2" max="-2" attributes="0"/>
Lines 59-64 Link Here
59
                              <Component id="directInputCheckBox" min="-2" max="-2" attributes="0"/>
71
                              <Component id="directInputCheckBox" min="-2" max="-2" attributes="0"/>
60
                          </Group>
72
                          </Group>
61
                          <Component id="templateComboBox" alignment="1" pref="532" max="32767" attributes="1"/>
73
                          <Component id="templateComboBox" alignment="1" pref="532" max="32767" attributes="1"/>
74
                          <Component id="displayNameField" alignment="1" pref="532" max="32767" attributes="1"/>
62
                          <Component id="hostField" alignment="1" pref="532" max="32767" attributes="1"/>
75
                          <Component id="hostField" alignment="1" pref="532" max="32767" attributes="1"/>
63
                          <Component id="portField" alignment="1" pref="532" max="32767" attributes="1"/>
76
                          <Component id="portField" alignment="1" pref="532" max="32767" attributes="1"/>
64
                          <Component id="databaseField" alignment="1" pref="532" max="32767" attributes="1"/>
77
                          <Component id="databaseField" alignment="1" pref="532" max="32767" attributes="1"/>
Lines 70-83 Link Here
70
                          <Component id="instanceField" alignment="1" pref="532" max="32767" attributes="1"/>
83
                          <Component id="instanceField" alignment="1" pref="532" max="32767" attributes="1"/>
71
                          <Component id="userField" alignment="1" pref="532" max="32767" attributes="1"/>
84
                          <Component id="userField" alignment="1" pref="532" max="32767" attributes="1"/>
72
                          <Component id="passwordField" alignment="1" pref="532" max="32767" attributes="1"/>
85
                          <Component id="passwordField" alignment="1" pref="532" max="32767" attributes="1"/>
73
                          <Group type="102" alignment="1" attributes="0">
86
                          <Component id="passwordCheckBox" alignment="0" pref="532" max="32767" attributes="0"/>
74
                              <Component id="passwordCheckBox" pref="393" max="32767" attributes="0"/>
75
                              <EmptySpace min="-2" pref="139" max="-2" attributes="0"/>
76
                          </Group>
77
                          <Component id="directUrlScroll" alignment="1" pref="532" max="32767" attributes="0"/>
87
                          <Component id="directUrlScroll" alignment="1" pref="532" max="32767" attributes="0"/>
78
                      </Group>
88
                      </Group>
79
                  </Group>
89
                  </Group>
80
                  <Component id="errorInfoPanel" alignment="0" pref="676" max="32767" attributes="0"/>
81
              </Group>
90
              </Group>
82
              <EmptySpace max="-2" attributes="0"/>
91
              <EmptySpace max="-2" attributes="0"/>
83
          </Group>
92
          </Group>
Lines 99-104 Link Here
99
              </Group>
108
              </Group>
100
              <EmptySpace max="-2" attributes="0"/>
109
              <EmptySpace max="-2" attributes="0"/>
101
              <Group type="103" groupAlignment="3" attributes="0">
110
              <Group type="103" groupAlignment="3" attributes="0">
111
                  <Component id="displayNameField" alignment="3" min="-2" max="-2" attributes="0"/>
112
                  <Component id="displayNameLabel" alignment="3" min="-2" max="-2" attributes="0"/>
113
              </Group>
114
              <EmptySpace max="-2" attributes="0"/>
115
              <Group type="103" groupAlignment="3" attributes="0">
102
                  <Component id="hostLabel" alignment="3" min="-2" max="-2" attributes="0"/>
116
                  <Component id="hostLabel" alignment="3" min="-2" max="-2" attributes="0"/>
103
                  <Component id="hostField" alignment="3" min="-2" max="-2" attributes="0"/>
117
                  <Component id="hostField" alignment="3" min="-2" max="-2" attributes="0"/>
104
              </Group>
118
              </Group>
Lines 152-179 Link Here
152
                  <Component id="passwordLabel" alignment="3" min="-2" max="-2" attributes="0"/>
166
                  <Component id="passwordLabel" alignment="3" min="-2" max="-2" attributes="0"/>
153
                  <Component id="passwordField" alignment="3" min="-2" max="-2" attributes="0"/>
167
                  <Component id="passwordField" alignment="3" min="-2" max="-2" attributes="0"/>
154
              </Group>
168
              </Group>
155
              <EmptySpace min="-2" pref="5" max="-2" attributes="0"/>
169
              <EmptySpace type="unrelated" max="-2" attributes="0"/>
156
              <Component id="passwordCheckBox" min="-2" max="-2" attributes="0"/>
170
              <Component id="passwordCheckBox" min="-2" max="-2" attributes="0"/>
157
              <EmptySpace type="unrelated" max="-2" attributes="0"/>
171
              <EmptySpace max="-2" attributes="0"/>
158
              <Group type="103" groupAlignment="3" attributes="0">
172
              <Group type="103" groupAlignment="3" attributes="0">
173
                  <Component id="additionalPropsField" alignment="3" min="-2" max="-2" attributes="0"/>
159
                  <Component id="additionalPropsLabel" alignment="3" min="-2" max="-2" attributes="0"/>
174
                  <Component id="additionalPropsLabel" alignment="3" min="-2" max="-2" attributes="0"/>
160
                  <Component id="additionalPropsField" alignment="3" min="-2" max="-2" attributes="0"/>
161
              </Group>
175
              </Group>
162
              <EmptySpace max="-2" attributes="0"/>
176
              <EmptySpace max="-2" attributes="0"/>
163
              <Group type="103" groupAlignment="3" attributes="0">
177
              <Group type="103" groupAlignment="1" attributes="0">
164
                  <Component id="urlField" alignment="3" min="-2" max="-2" attributes="0"/>
178
                  <Component id="showUrlCheckBox" min="-2" max="-2" attributes="0"/>
165
                  <Component id="showUrlCheckBox" alignment="3" min="-2" max="-2" attributes="0"/>
179
                  <Component id="urlField" min="-2" max="-2" attributes="0"/>
166
              </Group>
180
              </Group>
167
              <EmptySpace max="-2" attributes="0"/>
181
              <EmptySpace min="-2" pref="5" max="-2" attributes="0"/>
168
              <Group type="103" groupAlignment="0" attributes="0">
182
              <Group type="103" groupAlignment="0" attributes="0">
169
                  <Component id="directUrlLabel" min="-2" max="-2" attributes="0"/>
183
                  <Component id="directUrlLabel" min="-2" max="-2" attributes="0"/>
170
                  <Component id="directUrlScroll" min="-2" pref="84" max="-2" attributes="0"/>
184
                  <Component id="directUrlScroll" min="-2" pref="84" max="-2" attributes="0"/>
171
              </Group>
185
              </Group>
186
              <EmptySpace min="-2" pref="9" max="-2" attributes="0"/>
187
              <Component id="errorInfoPanel" min="-2" max="-2" attributes="0"/>
172
              <EmptySpace max="-2" attributes="0"/>
188
              <EmptySpace max="-2" attributes="0"/>
173
              <Component id="jPanel1" min="-2" max="-2" attributes="0"/>
189
              <Component id="jPanel1" min="-2" max="-2" attributes="0"/>
174
              <EmptySpace max="-2" attributes="0"/>
190
              <EmptySpace pref="138" max="32767" attributes="0"/>
175
              <Component id="errorInfoPanel" min="-2" max="-2" attributes="0"/>
176
              <EmptySpace pref="161" max="32767" attributes="0"/>
177
          </Group>
191
          </Group>
178
      </Group>
192
      </Group>
179
    </DimensionLayout>
193
    </DimensionLayout>
Lines 355-360 Link Here
355
        </Property>
369
        </Property>
356
      </Properties>
370
      </Properties>
357
    </Component>
371
    </Component>
372
    <Component class="javax.swing.JLabel" name="displayNameLabel">
373
      <Properties>
374
        <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
375
          <ComponentRef name="displayNameField"/>
376
        </Property>
377
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
378
          <ResourceString bundle="org/netbeans/modules/db/explorer/dlg/Bundle.properties" key="NewConnectionDisplayName" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
379
        </Property>
380
      </Properties>
381
      <AccessibilityProperties>
382
        <Property name="AccessibleContext.accessibleName" type="java.lang.String" value="Displa&amp;y name."/>
383
      </AccessibilityProperties>
384
    </Component>
385
    <Component class="javax.swing.JTextField" name="displayNameField">
386
      <Properties>
387
        <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
388
          <ResourceString bundle="org/netbeans/modules/db/explorer/dlg/Bundle.properties" key="ACS_NewConnectionDisplayNameA11yDesc" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
389
        </Property>
390
        <Property name="focusCycleRoot" type="boolean" value="true"/>
391
      </Properties>
392
    </Component>
358
    <Component class="javax.swing.JLabel" name="userLabel">
393
    <Component class="javax.swing.JLabel" name="userLabel">
359
      <Properties>
394
      <Properties>
360
        <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
395
        <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
(-)a/db/src/org/netbeans/modules/db/explorer/dlg/NewConnectionPanel.java (-37 / +108 lines)
Lines 44-52 Link Here
44
import java.awt.event.FocusEvent;
44
import java.awt.event.FocusEvent;
45
import java.awt.event.FocusListener;
45
import java.awt.event.FocusListener;
46
import java.awt.event.ItemEvent;
46
import java.awt.event.ItemEvent;
47
import java.io.IOException;
47
import java.net.MalformedURLException;
48
import java.net.MalformedURLException;
49
import java.util.HashSet;
48
import java.util.LinkedHashMap;
50
import java.util.LinkedHashMap;
49
import java.util.Map.Entry;
51
import java.util.Map.Entry;
52
import java.util.Set;
50
import java.util.logging.Level;
53
import java.util.logging.Level;
51
import java.util.logging.Logger;
54
import java.util.logging.Logger;
52
import javax.swing.JComboBox;
55
import javax.swing.JComboBox;
Lines 65-72 Link Here
65
import org.netbeans.api.db.explorer.JDBCDriverManager;
68
import org.netbeans.api.db.explorer.JDBCDriverManager;
66
import org.netbeans.api.progress.ProgressHandle;
69
import org.netbeans.api.progress.ProgressHandle;
67
import org.netbeans.api.progress.ProgressHandleFactory;
70
import org.netbeans.api.progress.ProgressHandleFactory;
71
import org.netbeans.lib.ddl.DBConnection;
72
import org.netbeans.modules.db.explorer.DatabaseConnectionConvertor;
68
import org.netbeans.modules.db.util.DatabaseExplorerInternalUIs;
73
import org.netbeans.modules.db.util.DatabaseExplorerInternalUIs;
69
import org.netbeans.modules.db.util.JdbcUrl;
74
import org.netbeans.modules.db.util.JdbcUrl;
75
import org.openide.filesystems.FileObject;
76
import org.openide.filesystems.FileUtil;
77
import org.openide.loaders.DataObject;
78
import org.openide.util.Exceptions;
70
import org.openide.util.NbBundle;
79
import org.openide.util.NbBundle;
71
80
72
public class NewConnectionPanel extends ConnectionDialog.FocusablePanel {
81
public class NewConnectionPanel extends ConnectionDialog.FocusablePanel {
Lines 89-94 Link Here
89
    private final LinkedHashMap<String, UrlField> urlFields =
98
    private final LinkedHashMap<String, UrlField> urlFields =
90
            new LinkedHashMap<String, UrlField>();
99
            new LinkedHashMap<String, UrlField>();
91
100
101
    private Set<String> knownConnectionNames = new HashSet<String>();
102
92
    private static final String BUNDLE = "org.netbeans.modules.db.resources.Bundle"; //NOI18N
103
    private static final String BUNDLE = "org.netbeans.modules.db.resources.Bundle"; //NOI18N
93
104
94
    private static final Logger LOGGER = Logger.getLogger(NewConnectionPanel.class.getName());
105
    private static final Logger LOGGER = Logger.getLogger(NewConnectionPanel.class.getName());
Lines 96-101 Link Here
96
    private void initFieldMap() {
107
    private void initFieldMap() {
97
        // These should be in the order of display on the form, so that we correctly
108
        // These should be in the order of display on the form, so that we correctly
98
        // put focus on the first visible field.
109
        // put focus on the first visible field.
110
        urlFields.put(JdbcUrl.TOKEN_DISPLAY_NAME, new UrlField(displayNameField, displayNameLabel));
99
        urlFields.put(JdbcUrl.TOKEN_HOST, new UrlField(hostField, hostLabel));
111
        urlFields.put(JdbcUrl.TOKEN_HOST, new UrlField(hostField, hostLabel));
100
        urlFields.put(JdbcUrl.TOKEN_PORT, new UrlField(portField, portLabel));
112
        urlFields.put(JdbcUrl.TOKEN_PORT, new UrlField(portField, portLabel));
101
        urlFields.put(JdbcUrl.TOKEN_DB, new UrlField(databaseField, databaseLabel));
113
        urlFields.put(JdbcUrl.TOKEN_DB, new UrlField(databaseField, databaseLabel));
Lines 142-148 Link Here
142
        userField.setText(connection.getUser());
154
        userField.setText(connection.getUser());
143
        
155
        
144
        passwordField.setText(connection.getPassword());
156
        passwordField.setText(connection.getPassword());
145
        
157
158
        if (!connection.getDisplayName().equals(connection.getName())) {
159
            displayNameField.setText(connection.getDisplayName());
160
        }
161
146
        String driver = connection.getDriver();
162
        String driver = connection.getDriver();
147
        String driverName = connection.getDriverName();
163
        String driverName = connection.getDriverName();
148
        if (driver != null && driverName != null) {
164
        if (driver != null && driverName != null) {
Lines 227-232 Link Here
227
        
243
        
228
        userField.getDocument().addDocumentListener(docListener);
244
        userField.getDocument().addDocumentListener(docListener);
229
        passwordField.getDocument().addDocumentListener(docListener);
245
        passwordField.getDocument().addDocumentListener(docListener);
246
247
        initKnownConnectionNames();
248
    }
249
250
    private void initKnownConnectionNames() {
251
        FileObject configFile = FileUtil.getConfigFile(DatabaseConnectionConvertor.CONNECTIONS_PATH);
252
        for (FileObject o : configFile.getChildren()) {
253
            if ("text/xml".equals(o.getMIMEType())) {
254
                try {
255
                    DatabaseConnectionConvertor connectionWrapper = DataObject.find(o).getLookup().lookup(DatabaseConnectionConvertor.class);
256
                    if (connectionWrapper != null) {
257
                        DBConnection knownConnection = (DBConnection) connectionWrapper.instanceCreate();
258
                        String displayName = knownConnection.getDisplayName();
259
                        if (!displayName.equals(knownConnection.getName())) {
260
                            knownConnectionNames.add(displayName);
261
                        }
262
                    }
263
                } catch (IOException ex) {
264
                    Exceptions.printStackTrace(ex);
265
                } catch (ClassNotFoundException ex) {
266
                    Exceptions.printStackTrace(ex);
267
                }
268
            }
269
        }
230
    }
270
    }
231
271
232
    public void setWindow(Window window) {
272
    public void setWindow(Window window) {
Lines 236-241 Link Here
236
    private void initAccessibility() {
276
    private void initAccessibility() {
237
        templateLabel.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(NewConnectionPanel.class, "ACS_NewConnectionDriverNameA11yDesc")); //NOI18N
277
        templateLabel.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(NewConnectionPanel.class, "ACS_NewConnectionDriverNameA11yDesc")); //NOI18N
238
        templateComboBox.getAccessibleContext().setAccessibleName(NbBundle.getMessage(NewConnectionPanel.class, "ACS_NewConnectionDriverNameComboBoxA11yName")); //NOI18N
278
        templateComboBox.getAccessibleContext().setAccessibleName(NbBundle.getMessage(NewConnectionPanel.class, "ACS_NewConnectionDriverNameComboBoxA11yName")); //NOI18N
279
        displayNameLabel.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(NewConnectionPanel.class, "ACS_NewConnectionDisplayNameA11yDesc")); //NOI18N
280
        displayNameField.getAccessibleContext().setAccessibleName(NbBundle.getMessage(NewConnectionPanel.class, "ACS_NewConnectionDisplayNameTextFieldA11yName")); //NOI18N
239
        userLabel.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(NewConnectionPanel.class, "ACS_NewConnectionUserNameA11yDesc")); //NOI18N
281
        userLabel.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(NewConnectionPanel.class, "ACS_NewConnectionUserNameA11yDesc")); //NOI18N
240
        userField.getAccessibleContext().setAccessibleName(NbBundle.getMessage(NewConnectionPanel.class, "ACS_NewConnectionUserNameTextFieldA11yName")); //NOI18N
282
        userField.getAccessibleContext().setAccessibleName(NbBundle.getMessage(NewConnectionPanel.class, "ACS_NewConnectionUserNameTextFieldA11yName")); //NOI18N
241
        passwordLabel.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(NewConnectionPanel.class, "ACS_NewConnectionPasswordA11yDesc")); //NOI18N
283
        passwordLabel.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(NewConnectionPanel.class, "ACS_NewConnectionPasswordA11yDesc")); //NOI18N
Lines 295-300 Link Here
295
        serverNameField = new javax.swing.JTextField();
337
        serverNameField = new javax.swing.JTextField();
296
        instanceLabel = new javax.swing.JLabel();
338
        instanceLabel = new javax.swing.JLabel();
297
        instanceField = new javax.swing.JTextField();
339
        instanceField = new javax.swing.JTextField();
340
        displayNameLabel = new javax.swing.JLabel();
341
        displayNameField = new javax.swing.JTextField();
298
        userLabel = new javax.swing.JLabel();
342
        userLabel = new javax.swing.JLabel();
299
        userField = new javax.swing.JTextField();
343
        userField = new javax.swing.JTextField();
300
        passwordLabel = new javax.swing.JLabel();
344
        passwordLabel = new javax.swing.JLabel();
Lines 368-373 Link Here
368
412
369
        instanceField.setToolTipText(org.openide.util.NbBundle.getMessage(NewConnectionPanel.class, "ACS_NewConnectionInstanceNameA11yDesc")); // NOI18N
413
        instanceField.setToolTipText(org.openide.util.NbBundle.getMessage(NewConnectionPanel.class, "ACS_NewConnectionInstanceNameA11yDesc")); // NOI18N
370
414
415
        displayNameLabel.setLabelFor(displayNameField);
416
        org.openide.awt.Mnemonics.setLocalizedText(displayNameLabel, org.openide.util.NbBundle.getMessage(NewConnectionPanel.class, "NewConnectionDisplayName")); // NOI18N
417
418
        displayNameField.setToolTipText(org.openide.util.NbBundle.getMessage(NewConnectionPanel.class, "ACS_NewConnectionDisplayNameA11yDesc")); // NOI18N
419
        displayNameField.setFocusCycleRoot(true);
420
371
        userLabel.setLabelFor(userField);
421
        userLabel.setLabelFor(userField);
372
        org.openide.awt.Mnemonics.setLocalizedText(userLabel, org.openide.util.NbBundle.getMessage(NewConnectionPanel.class, "NewConnectionUserName")); // NOI18N
422
        org.openide.awt.Mnemonics.setLocalizedText(userLabel, org.openide.util.NbBundle.getMessage(NewConnectionPanel.class, "NewConnectionUserName")); // NOI18N
373
423
Lines 438-472 Link Here
438
                .addContainerGap()
488
                .addContainerGap()
439
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
489
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
440
                    .add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
490
                    .add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
491
                    .add(errorInfoPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 676, Short.MAX_VALUE)
441
                    .add(layout.createSequentialGroup()
492
                    .add(layout.createSequentialGroup()
442
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
493
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
443
                            .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
494
                            .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
444
                                .add(inputModelLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
495
                                .add(layout.createSequentialGroup()
445
                                .add(templateLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
496
                                    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
446
                                .add(hostLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
497
                                        .add(showUrlCheckBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 132, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
447
                                .add(portLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
498
                                        .add(directUrlLabel))
448
                                .add(databaseLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
499
                                    .add(12, 12, 12))
449
                                .add(passwordLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
500
                                .add(layout.createSequentialGroup()
450
                                .add(userLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
501
                                    .add(additionalPropsLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 120, Short.MAX_VALUE)
451
                                .add(instanceLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
502
                                    .add(24, 24, 24)))
452
                                .add(serverNameLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
503
                            .add(layout.createSequentialGroup()
453
                                .add(dsnLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
504
                                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
454
                                .add(tnsLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
505
                                    .add(org.jdesktop.layout.GroupLayout.LEADING, displayNameLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
455
                                .add(serviceLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
506
                                    .add(org.jdesktop.layout.GroupLayout.LEADING, inputModelLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
456
                                .add(sidLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 119, Short.MAX_VALUE))
507
                                    .add(org.jdesktop.layout.GroupLayout.LEADING, templateLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
457
                            .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
508
                                    .add(org.jdesktop.layout.GroupLayout.LEADING, portLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
458
                                .add(org.jdesktop.layout.GroupLayout.TRAILING, additionalPropsLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
509
                                    .add(org.jdesktop.layout.GroupLayout.LEADING, databaseLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
459
                                .add(directUrlLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
510
                                    .add(org.jdesktop.layout.GroupLayout.LEADING, passwordLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
460
                                .add(org.jdesktop.layout.GroupLayout.TRAILING, showUrlCheckBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 132, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
511
                                    .add(org.jdesktop.layout.GroupLayout.LEADING, userLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
461
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
512
                                    .add(org.jdesktop.layout.GroupLayout.LEADING, instanceLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
513
                                    .add(org.jdesktop.layout.GroupLayout.LEADING, serverNameLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
514
                                    .add(org.jdesktop.layout.GroupLayout.LEADING, dsnLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
515
                                    .add(org.jdesktop.layout.GroupLayout.LEADING, tnsLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
516
                                    .add(org.jdesktop.layout.GroupLayout.LEADING, serviceLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
517
                                    .add(org.jdesktop.layout.GroupLayout.LEADING, sidLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 119, Short.MAX_VALUE)
518
                                    .add(org.jdesktop.layout.GroupLayout.LEADING, hostLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
519
                                .add(25, 25, 25)))
462
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
520
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
463
                            .add(urlField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE)
521
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, urlField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE)
464
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, additionalPropsField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE)
522
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, additionalPropsField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE)
465
                            .add(layout.createSequentialGroup()
523
                            .add(layout.createSequentialGroup()
466
                                .add(fieldInputCheckBox)
524
                                .add(fieldInputCheckBox)
467
                                .add(18, 18, 18)
525
                                .add(18, 18, 18)
468
                                .add(directInputCheckBox))
526
                                .add(directInputCheckBox))
469
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, templateComboBox, 0, 532, Short.MAX_VALUE)
527
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, templateComboBox, 0, 532, Short.MAX_VALUE)
528
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, displayNameField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE)
470
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, hostField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE)
529
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, hostField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE)
471
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, portField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE)
530
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, portField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE)
472
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, databaseField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE)
531
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, databaseField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE)
Lines 478-488 Link Here
478
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, instanceField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE)
537
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, instanceField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE)
479
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, userField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE)
538
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, userField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE)
480
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, passwordField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE)
539
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, passwordField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE)
481
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
540
                            .add(passwordCheckBox, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE)
482
                                .add(passwordCheckBox, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 393, Short.MAX_VALUE)
541
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, directUrlScroll, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE))))
483
                                .add(139, 139, 139))
484
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, directUrlScroll, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE)))
485
                    .add(errorInfoPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 676, Short.MAX_VALUE))
486
                .addContainerGap())
542
                .addContainerGap())
487
        );
543
        );
488
        layout.setVerticalGroup(
544
        layout.setVerticalGroup(
Lines 499-504 Link Here
499
                    .add(templateComboBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
555
                    .add(templateComboBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
500
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
556
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
501
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
557
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
558
                    .add(displayNameField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
559
                    .add(displayNameLabel))
560
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
561
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
502
                    .add(hostLabel)
562
                    .add(hostLabel)
503
                    .add(hostField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
563
                    .add(hostField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
504
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
564
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
Lines 541-566 Link Here
541
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
601
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
542
                    .add(passwordLabel)
602
                    .add(passwordLabel)
543
                    .add(passwordField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
603
                    .add(passwordField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
544
                .add(5, 5, 5)
604
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
545
                .add(passwordCheckBox)
605
                .add(passwordCheckBox)
546
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
547
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
548
                    .add(additionalPropsLabel)
549
                    .add(additionalPropsField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
550
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
606
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
551
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
607
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
552
                    .add(urlField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
608
                    .add(additionalPropsField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
553
                    .add(showUrlCheckBox))
609
                    .add(additionalPropsLabel))
554
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
610
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
611
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
612
                    .add(showUrlCheckBox)
613
                    .add(urlField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
614
                .add(5, 5, 5)
555
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
615
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
556
                    .add(directUrlLabel)
616
                    .add(directUrlLabel)
557
                    .add(directUrlScroll, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 84, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
617
                    .add(directUrlScroll, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 84, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
618
                .add(9, 9, 9)
619
                .add(errorInfoPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
558
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
620
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
559
                .add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
621
                .add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
560
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
622
                .addContainerGap(138, Short.MAX_VALUE))
561
                .add(errorInfoPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
562
                .addContainerGap(161, Short.MAX_VALUE))
563
        );
623
        );
624
625
        displayNameLabel.getAccessibleContext().setAccessibleName("Displa&y name.");
564
    }
626
    }
565
627
566
    // Code for dispatching events from components to event handlers.
628
    // Code for dispatching events from components to event handlers.
Lines 698-703 Link Here
698
    private javax.swing.JTextArea directUrlField;
760
    private javax.swing.JTextArea directUrlField;
699
    private javax.swing.JLabel directUrlLabel;
761
    private javax.swing.JLabel directUrlLabel;
700
    private javax.swing.JScrollPane directUrlScroll;
762
    private javax.swing.JScrollPane directUrlScroll;
763
    private javax.swing.JTextField displayNameField;
764
    private javax.swing.JLabel displayNameLabel;
701
    private javax.swing.JTextField dsnField;
765
    private javax.swing.JTextField dsnField;
702
    private javax.swing.JLabel dsnLabel;
766
    private javax.swing.JLabel dsnLabel;
703
    private org.netbeans.modules.db.util.ErrorInfoPanel errorInfoPanel;
767
    private org.netbeans.modules.db.util.ErrorInfoPanel errorInfoPanel;
Lines 736-742 Link Here
736
            JDBCDriver driver = url.getDriver();
800
            JDBCDriver driver = url.getDriver();
737
            assert(driver != null);
801
            assert(driver != null);
738
            connection.setDriverName(driver.getName());
802
            connection.setDriverName(driver.getName());
739
           connection.setDriver(driver.getClassName());
803
            connection.setDriver(driver.getClassName());
740
        }
804
        }
741
        
805
        
742
        if (fieldEntryMode) {
806
        if (fieldEntryMode) {
Lines 748-753 Link Here
748
        connection.setUser(userField.getText());
812
        connection.setUser(userField.getText());
749
        connection.setPassword(getPassword());
813
        connection.setPassword(getPassword());
750
        connection.setRememberPassword(passwordCheckBox.isSelected());
814
        connection.setRememberPassword(passwordCheckBox.isSelected());
815
        connection.setDisplayName(displayNameField.getText());
751
    }
816
    }
752
817
753
    private void resize() {
818
    private void resize() {
Lines 841-846 Link Here
841
                entry.getValue().getLabel().setVisible(false);
906
                entry.getValue().getLabel().setVisible(false);
842
            }
907
            }
843
        }
908
        }
909
        displayNameField.setVisible(true);
910
        displayNameLabel.setVisible(true);
844
        
911
        
845
        setFocus();
912
        setFocus();
846
        checkValid();
913
        checkValid();
Lines 947-952 Link Here
947
    }
1014
    }
948
1015
949
    private void enableInput(boolean enable) {
1016
    private void enableInput(boolean enable) {
1017
        displayNameField.setEnabled(enable);
950
        fieldInputCheckBox.setEnabled(enable);
1018
        fieldInputCheckBox.setEnabled(enable);
951
        directInputCheckBox.setEnabled(enable);
1019
        directInputCheckBox.setEnabled(enable);
952
        templateComboBox.setEnabled(enable);
1020
        templateComboBox.setEnabled(enable);
Lines 1033-1038 Link Here
1033
                displayError(NbBundle.getMessage(NewConnectionPanel.class, "NewConnection.MSG_SpecifyURL"), false);
1101
                displayError(NbBundle.getMessage(NewConnectionPanel.class, "NewConnection.MSG_SpecifyURL"), false);
1034
            }
1102
            }
1035
        }
1103
        }
1104
        if (knownConnectionNames.contains(displayNameField.getText().trim())) {
1105
            displayError(NbBundle.getMessage(NewConnectionPanel.class, "NewConnection.MSG_DuplicateDisplayName"), false);
1106
        }
1036
    }
1107
    }
1037
1108
1038
    private boolean isEmpty(String str) {
1109
    private boolean isEmpty(String str) {
(-)a/db/src/org/netbeans/modules/db/explorer/node/ConnectionNode.java (-1 / +4 lines)
Lines 135-140 Link Here
135
            connection.setSchema(val.toString());
135
            connection.setSchema(val.toString());
136
        } else if (nps.getName().equals(SCHEMA)) {
136
        } else if (nps.getName().equals(SCHEMA)) {
137
            connection.setSchema(val.toString());
137
            connection.setSchema(val.toString());
138
        } else if (nps.getName().equals(DISPLAYNAME)) {
139
            connection.setDisplayName(val.toString());
138
        }
140
        }
139
141
140
        if (refreshNode) {
142
        if (refreshNode) {
Lines 153-158 Link Here
153
            addProperty(USER, USERDESC, String.class, !connected, connection.getUser());
155
            addProperty(USER, USERDESC, String.class, !connected, connection.getUser());
154
            addProperty(REMEMBERPW, REMEMBERPWDESC,
156
            addProperty(REMEMBERPW, REMEMBERPWDESC,
155
                    Boolean.class, !connected, connection.rememberPassword());
157
                    Boolean.class, !connected, connection.rememberPassword());
158
            addProperty(DISPLAYNAME, DISPLAYNAMEDESC, String.class, !connected, connection.getDisplayName());
156
159
157
            if (connected) {
160
            if (connected) {
158
                Specification spec = connection.getConnector().getDatabaseSpecification();
161
                Specification spec = connection.getConnector().getDatabaseSpecification();
Lines 336-342 Link Here
336
339
337
    @Override
340
    @Override
338
    public String getDisplayName() {
341
    public String getDisplayName() {
339
        return connection.getName();
342
        return connection.getDisplayName();
340
    }
343
    }
341
 
344
 
342
    public String getIconBase() {
345
    public String getIconBase() {
(-)a/db/src/org/netbeans/modules/db/util/JdbcUrl.java (-2 / +3 lines)
Lines 1-7 Link Here
1
/*
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 * 
3
 * 
4
 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
4
 * Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.
5
 * 
5
 * 
6
 * The contents of this file are subject to the terms of either the GNU
6
 * The contents of this file are subject to the terms of either the GNU
7
 * General Public License Version 2 only ("GPL") or the Common
7
 * General Public License Version 2 only ("GPL") or the Common
Lines 66-72 Link Here
66
    private HashSet<String> supportedTokens = new HashSet<String>();
66
    private HashSet<String> supportedTokens = new HashSet<String>();
67
    private HashSet<String> requiredTokens = new HashSet<String>();
67
    private HashSet<String> requiredTokens = new HashSet<String>();
68
    private boolean parseUrl;
68
    private boolean parseUrl;
69
        
69
70
    public static final String TOKEN_DISPLAY_NAME = "<DISPLAY_NAME>";
70
    public static final String TOKEN_DB = "<DB>";
71
    public static final String TOKEN_DB = "<DB>";
71
    public static final String TOKEN_HOST = "<HOST>";
72
    public static final String TOKEN_HOST = "<HOST>";
72
    public static final String TOKEN_PORT = "<PORT>";
73
    public static final String TOKEN_PORT = "<PORT>";

Return to bug 144112