Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Add Database Connection dialog for SQLite and DuckDB #8189

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion ide/db/nbproject/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,21 @@
# specific language governing permissions and limitations
# under the License.

auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.expand-tabs=true
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.indent-shift-width=2
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.spaces-per-tab=2
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.tab-size=4
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width=100
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-line-wrap=none
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.usedProfile=project
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.expand-tabs=true
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.indent-shift-width=4
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaces-per-tab=4
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.tab-size=4
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.text-limit-width=100
Comment on lines +18 to +29
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably not intended to commit module specific indentation settings?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's intentional, because it influences how Matisse form builder code is generated. The settings stored here ensure the code is generated with the same settings as earlier, simplifying diffs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I see some settings that seem specific to my own IDE though. But removing any of them seemed to make them ineffective. I can just remove the file.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting. I haven't considered global ide settings messing with codegen - but it makes sense of course.

we should still try to avoid adding those module specific settings since NB has ~800 projects. Would be good to have a central place for this and let everything inherit it - but I don't think this is possible, otherwise we likely would have a central formatter file somewhere already. (I did see hint settings though)

javac.compilerargs=-Xlint -Xlint:-serial
javac.source=1.8
javac.source=11
javac.release=11
eirikbakke marked this conversation as resolved.
Show resolved Hide resolved
javadoc.arch=${basedir}/arch.xml
javadoc.apichanges=${basedir}/apichanges.xml

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import java.awt.event.ActionListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.lang.reflect.InvocationTargetException;
import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import java.sql.SQLException;
Expand All @@ -41,6 +40,7 @@
import javax.swing.Action;
import javax.swing.JComponent;
import javax.swing.SwingUtilities;
import org.netbeans.api.db.explorer.JDBCDriver;
import org.netbeans.api.progress.ProgressHandle;
import org.netbeans.api.progress.ProgressHandleFactory;
import org.netbeans.lib.ddl.DDLException;
Expand All @@ -54,6 +54,8 @@
import org.netbeans.modules.db.explorer.dlg.ConnectionDialog;
import org.netbeans.modules.db.explorer.dlg.ConnectionDialogMediator;
import org.netbeans.modules.db.explorer.dlg.SchemaPanel;
import org.netbeans.modules.db.util.DriverListUtil;
import org.netbeans.modules.db.util.JdbcUrl;
import org.openide.DialogDescriptor;
import org.openide.DialogDisplayer;
import org.openide.NotifyDescriptor;
Expand All @@ -62,7 +64,6 @@
import org.openide.awt.ActionRegistration;
import org.openide.awt.ActionState;
import org.openide.util.ContextAwareAction;
import org.openide.util.Exceptions;
import org.openide.util.HelpCtx;
import org.openide.util.Lookup;
import org.openide.util.Mutex;
Expand Down Expand Up @@ -370,13 +371,20 @@ protected boolean retrieveSchemas(SchemaPanel schemaPanel, DatabaseConnection db
}

private boolean supportsConnectWithoutUsername(DatabaseConnection dc) {
try {
return dc.findJDBCDriver().getClassName().equals("org.sqlite.JDBC") //NOI18N
|| dc.findJDBCDriver().getClassName().equals("org.h2.Driver"); //NOI18N
} catch (NullPointerException ex) {
// Most probably findJDBCDriver failed to find a driver
JDBCDriver driver = dc.findJDBCDriver();
if (driver == null) {
return false;
}
List<JdbcUrl> urls = DriverListUtil.getJdbcUrls(driver);
if (urls.isEmpty()) {
return false;
}
for (JdbcUrl url : urls) {
if (url.isUsernamePasswordDisplayed()) {
return false;
}
}
return true;
}

private void connectWithNewInfo(DatabaseConnection dbcon, Credentials input) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ ACS_AddDriverProgressBarA11yDesc=Progress bar showing the progress of searching
# Select driver file chooser
AddDriver_Chooser_Title=Select Driver
AddDriver_Chooser_Filter=Archive Files (*.jar, *.zip)
# Select database file chooser
NewConnectionFile_Chooser_Title=Select Database File

NewConnectionDialogTitle=New Database Connection
NewConnectionDriverName=Driver &Name:
Expand All @@ -66,6 +68,7 @@ NewConnectionSID=Service ID (SID):
NewConnectionServiceName=Service:
NewConnectionTNSName=TNS Name:
NewConnectionDSN=DSN:
NewConnectionFile=&File:
NewConnectionInstanceName=Instance Name:
NewCOnnectionInputMode=Data Input &Mode:
NewConnectionFieldEntryMode=&Field Entry
Expand Down Expand Up @@ -105,6 +108,8 @@ ACS_NewConnectionTNSNameA11yDesc=The TNS name for this connection
ACS_NewConnectionTNSNameTextFieldA11yName=Database server TNS text field
ACS_NewConnectionDSNA11yDesc=The data source name for this connection
ACS_NewConnectionDSNTextFieldA11yName=Database server data source name (DSN) text field
ACS_NewConnectionFileA11yDesc=The database file for this connection
ACS_NewConnectionFileTextFieldA11yName=Database file name text field
ACS_NewConnectionInstanceNameA11yDesc=The instance name for this connection
ACS_NewConnectionInstanceNameTextFieldA11yName=Database server instance name text field
ACS_NewConnectionFieldEntryModeA11yDesc=Select this mode to enter individual field values.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
<Component id="instanceLabel" alignment="0" max="32767" attributes="1"/>
<Component id="serverNameLabel" alignment="0" max="32767" attributes="1"/>
<Component id="dsnLabel" alignment="0" max="32767" attributes="1"/>
<Component id="fileLabel" alignment="0" max="32767" attributes="1"/>
<Component id="tnsLabel" alignment="0" max="32767" attributes="1"/>
<Component id="serviceLabel" alignment="0" max="32767" attributes="1"/>
<Component id="sidLabel" alignment="0" max="32767" attributes="1"/>
Expand All @@ -73,7 +74,7 @@
<Component id="bConnectionProperties" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="bTestConnection" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="100" max="32767" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
<Component id="userField" alignment="1" max="32767" attributes="2"/>
<Component id="sidField" alignment="0" max="32767" attributes="2"/>
Expand All @@ -97,6 +98,11 @@
<Component id="passwordCheckBox" min="-2" pref="256" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Component id="fileField" max="32767" attributes="2"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="fileBrowseButton" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
</Group>
Expand Down Expand Up @@ -149,6 +155,12 @@
<Component id="dsnField" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="fileLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="fileField" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="fileBrowseButton" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="serverNameLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="serverNameField" alignment="3" min="-2" max="-2" attributes="0"/>
Expand Down Expand Up @@ -400,6 +412,31 @@
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="fileLabel">
<Properties>
<Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
<ComponentRef name="fileField"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/netbeans/modules/db/explorer/dlg/Bundle.properties" key="NewConnectionFile" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="fileField">
<Properties>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/netbeans/modules/db/explorer/dlg/Bundle.properties" key="ACS_NewConnectionFileA11yDesc" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="fileBrowseButton">
<Properties>
<Property name="text" type="java.lang.String" value="&amp;Browse..."/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="fileBrowseButtonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JTextField" name="urlField">
<Properties>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
Expand Down
Loading
Loading