You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2021/12/08 17:06:37 UTC
[GitHub] [netbeans] jhorvath opened a new pull request #3358: Adding command for New Database Connection
jhorvath opened a new pull request #3358:
URL: https://github.com/apache/netbeans/pull/3358
Adding command for New Database Connection to java.lsp.server
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] JaroslavTulach commented on a change in pull request #3358: Adding command for New Database Connection
Posted by GitBox <gi...@apache.org>.
JaroslavTulach commented on a change in pull request #3358:
URL: https://github.com/apache/netbeans/pull/3358#discussion_r765986809
##########
File path: ide/db/src/org/netbeans/api/db/explorer/ConnectionManager.java
##########
@@ -187,6 +189,19 @@ public void removeConnection(DatabaseConnection dbconn) throws DatabaseException
ConnectionList.getDefault().remove(dbconn.getDelegate());
}
+
+ /**
+ * Retrieves a list of database schemas available for given connection.
+ *
+ * @param dbconn
+ * @return List of schemas or null if connection failed
Review comment:
I usually use `{@code null}` to print it in a different font. Shouldn't an exception be raised if the connection fails?
##########
File path: ide/db/src/org/netbeans/api/db/explorer/ConnectionManager.java
##########
@@ -187,6 +189,19 @@ public void removeConnection(DatabaseConnection dbconn) throws DatabaseException
ConnectionList.getDefault().remove(dbconn.getDelegate());
}
+
+ /**
+ * Retrieves a list of database schemas available for given connection.
+ *
+ * @param dbconn
+ * @return List of schemas or null if connection failed
+ */
+ public List<String> getSchemas(DatabaseConnection dbconn) {
Review comment:
This is an API change. It needs `@since` tag, it needs a note in `apichanges.xml`.
##########
File path: ide/db/src/org/netbeans/api/db/explorer/ConnectionManager.java
##########
@@ -187,6 +189,19 @@ public void removeConnection(DatabaseConnection dbconn) throws DatabaseException
ConnectionList.getDefault().remove(dbconn.getDelegate());
}
+
+ /**
+ * Retrieves a list of database schemas available for given connection.
+ *
+ * @param dbconn
+ * @return List of schemas or null if connection failed
+ */
+ public List<String> getSchemas(DatabaseConnection dbconn) {
+ if (SwingUtilities.isEventDispatchThread()) {
+ throw new IllegalStateException("This method can not be called on the event dispatch thread."); // NOI18N
Review comment:
_cannot_ is a single word - maybe you want to spell this (unusual?) restriction in the Javadoc of the method.
##########
File path: java/java.lsp.server/vscode/src/nbcode.ts
##########
@@ -97,7 +97,9 @@ if (typeof process === 'object' && process.argv0 === 'node') {
let clusters = fs.readdirSync(nbcode).filter(c => c !== 'bin' && c !== 'etc').map(c => path.join(nbcode, c));
let args = process.argv.slice(2);
let json = JSON.parse("" + fs.readFileSync(path.join(extension, 'package.json')));
- let globalStorage = path.join(os.homedir(), '.config', 'Code', 'User', 'globalStorage', json.publisher + '.' + json.name);
+ let globalStorage = os.platform() === 'darwin' ?
+ path.join(os.homedir(), 'Library', 'Application Support', 'Code', 'User', 'globalStorage', json.publisher + '.' + json.name) :
Review comment:
Thanks! Glad to have Mac developer who cares about debugging support!
##########
File path: java/java.lsp.server/nbcode/nbproject/platform.properties
##########
@@ -310,153 +373,90 @@ disabled.modules=\
org.netbeans.modules.versioning.system.cvss.installer,\
org.netbeans.modules.versioning.ui,\
org.netbeans.modules.versioning.util,\
- org.netbeans.modules.web.client.kit,\
- org.netbeans.modules.web.client.samples,\
- org.netbeans.modules.web.inspect,\
- org.netbeans.modules.web.javascript.debugger,\
- org.netbeans.modules.web.webkit.debugging,\
- org.netbeans.modules.web.webkit.tooling,\
- org.netbeans.modules.websvc.jaxws21,\
- org.netbeans.modules.websvc.jaxws21api,\
- org.netbeans.modules.websvc.saas.codegen.java,\
- org.netbeans.modules.welcome,\
- org.netbeans.modules.xml,\
- org.netbeans.modules.xml.axi,\
- org.netbeans.modules.xml.catalog.ui,\
- org.netbeans.modules.xml.jaxb,\
- org.netbeans.modules.xml.jaxb.api,\
- org.netbeans.modules.xml.multiview,\
- org.netbeans.modules.xml.retriever,\
- org.netbeans.modules.xml.schema.completion,\
- org.netbeans.modules.xml.schema.model,\
- org.netbeans.modules.xml.tax,\
- org.netbeans.modules.xml.text,\
- org.netbeans.modules.xml.text.obsolete90,\
- org.netbeans.modules.xml.tools,\
- org.netbeans.modules.xml.tools.java,\
- org.netbeans.modules.xml.wsdl.model,\
- org.netbeans.modules.xsl,\
- org.netbeans.spi.editor.hints.projects,\
- org.netbeans.swing.dirchooser,\
- org.netbeans.upgrader,\
- org.openide.compat,\
- org.openide.execution.compat8,\
- org.openide.options,\
- org.openide.util.enumerations,\
- org.openidex.util,\
- org.netbeans.api.web.webmodule,\
- org.netbeans.libs.amazon,\
- org.netbeans.libs.commons_fileupload,\
- org.netbeans.libs.elimpl,\
- org.netbeans.libs.glassfish_logging,\
- org.netbeans.libs.jstl,\
- org.netbeans.modules.cloud.amazon,\
- org.netbeans.modules.cloud.common,\
- org.netbeans.modules.el.lexer,\
- org.netbeans.modules.glassfish.common,\
- org.netbeans.modules.glassfish.eecommon,\
- org.netbeans.modules.glassfish.javaee,\
- org.netbeans.modules.glassfish.tooling,\
- org.netbeans.modules.gradle.javaee,\
- org.netbeans.modules.j2ee.ant,\
- org.netbeans.modules.j2ee.api.ejbmodule,\
- org.netbeans.modules.j2eeapis,\
- org.netbeans.modules.j2ee.clientproject,\
- org.netbeans.modules.j2ee.common,\
- org.netbeans.modules.j2ee.core,\
- org.netbeans.modules.j2ee.dd,\
- org.netbeans.modules.j2ee.ddloaders,\
- org.netbeans.modules.j2ee.dd.webservice,\
- org.netbeans.modules.j2ee.earproject,\
- org.netbeans.modules.j2ee.ejbcore,\
- org.netbeans.modules.j2ee.ejbjarproject,\
- org.netbeans.modules.j2ee.ejbrefactoring,\
- org.netbeans.modules.j2ee.ejbverification,\
- org.netbeans.modules.j2ee.genericserver,\
- org.netbeans.modules.j2ee.kit,\
- org.netbeans.modules.j2ee.platform,\
- org.netbeans.modules.j2eeserver,\
- org.netbeans.modules.j2ee.sun.appsrv,\
- org.netbeans.modules.j2ee.sun.dd,\
- org.netbeans.modules.j2ee.sun.ddui,\
- org.netbeans.modules.jakartaee8.api,\
- org.netbeans.modules.jakartaee8.platform,\
- org.netbeans.modules.javaee7.api,\
- org.netbeans.modules.javaee8.api,\
- org.netbeans.modules.javaee.api,\
- org.netbeans.modules.javaee.beanvalidation,\
- org.netbeans.modules.javaee.project,\
- org.netbeans.modules.javaee.resources,\
- org.netbeans.modules.javaee.specs.support,\
- org.netbeans.modules.javaee.wildfly,\
- org.netbeans.modules.jellytools.enterprise,\
- org.netbeans.modules.jsp.lexer,\
- org.netbeans.modules.maven.j2ee,\
- org.netbeans.modules.maven.jaxws,\
- org.netbeans.modules.payara.common,\
- org.netbeans.modules.payara.eecommon,\
- org.netbeans.modules.payara.jakartaee,\
- org.netbeans.modules.payara.micro,\
- org.netbeans.modules.payara.tooling,\
- org.netbeans.modules.profiler.j2ee,\
- org.netbeans.modules.projectimport.eclipse.web,\
- org.netbeans.modules.servletjspapi,\
- org.netbeans.modules.spring.webmvc,\
- org.netbeans.modules.tomcat5,\
org.netbeans.modules.web.beans,\
org.netbeans.modules.web.bootsfaces,\
+ org.netbeans.modules.web.client.kit,\
org.netbeans.modules.web.client.rest,\
+ org.netbeans.modules.web.client.samples,\
org.netbeans.modules.web.core,\
org.netbeans.modules.web.core.syntax,\
org.netbeans.modules.web.debug,\
org.netbeans.modules.web.el,\
org.netbeans.modules.web.freeform,\
- org.netbeans.modules.web.jsf12,\
- org.netbeans.modules.web.jsf12ri,\
- org.netbeans.modules.web.jsf20,\
- org.netbeans.modules.web.jsfapi,\
+ org.netbeans.modules.web.inspect,\
+ org.netbeans.modules.web.javascript.debugger,\
+ org.netbeans.modules.web.jsf,\
org.netbeans.modules.web.jsf.editor,\
org.netbeans.modules.web.jsf.icefaces,\
- org.netbeans.modules.web.jsf,\
org.netbeans.modules.web.jsf.kit,\
org.netbeans.modules.web.jsf.navigation,\
org.netbeans.modules.web.jsf.richfaces,\
+ org.netbeans.modules.web.jsf12,\
+ org.netbeans.modules.web.jsf12ri,\
+ org.netbeans.modules.web.jsf20,\
+ org.netbeans.modules.web.jsfapi,\
org.netbeans.modules.web.jspparser,\
org.netbeans.modules.web.kit,\
- org.netbeans.modules.weblogic.common,\
org.netbeans.modules.web.monitor,\
org.netbeans.modules.web.primefaces,\
org.netbeans.modules.web.project,\
org.netbeans.modules.web.refactoring,\
- org.netbeans.modules.websocket,\
org.netbeans.modules.web.struts,\
+ org.netbeans.modules.web.webkit.debugging,\
+ org.netbeans.modules.web.webkit.tooling,\
+ org.netbeans.modules.weblogic.common,\
+ org.netbeans.modules.websocket,\
org.netbeans.modules.websvc.clientapi,\
org.netbeans.modules.websvc.core,\
org.netbeans.modules.websvc.customization,\
org.netbeans.modules.websvc.design,\
org.netbeans.modules.websvc.editor.hints,\
- org.netbeans.modules.websvc.jaxwsapi,\
org.netbeans.modules.websvc.jaxws.lightapi,\
+ org.netbeans.modules.websvc.jaxws21,\
+ org.netbeans.modules.websvc.jaxws21api,\
+ org.netbeans.modules.websvc.jaxwsapi,\
org.netbeans.modules.websvc.jaxwsmodel,\
org.netbeans.modules.websvc.kit,\
org.netbeans.modules.websvc.manager,\
org.netbeans.modules.websvc.metro.lib,\
org.netbeans.modules.websvc.owsm,\
org.netbeans.modules.websvc.projectapi,\
- org.netbeans.modules.websvc.restapi,\
org.netbeans.modules.websvc.rest,\
+ org.netbeans.modules.websvc.restapi,\
org.netbeans.modules.websvc.restkit,\
org.netbeans.modules.websvc.restlib,\
org.netbeans.modules.websvc.saas.codegen.j2ee,\
+ org.netbeans.modules.websvc.saas.codegen.java,\
org.netbeans.modules.websvc.utilities,\
org.netbeans.modules.websvc.websvcapi,\
org.netbeans.modules.websvc.wsstackapi,\
- org.netbeans.modules.groovy.antproject,\
- org.netbeans.modules.groovy.gsp,\
- org.netbeans.modules.groovy.kit,\
- org.netbeans.modules.groovy.refactoring,\
- org.netbeans.modules.groovy.samples
-nbplatform.active=nball
+ org.netbeans.modules.welcome,\
+ org.netbeans.modules.xml,\
+ org.netbeans.modules.xml.axi,\
+ org.netbeans.modules.xml.catalog.ui,\
+ org.netbeans.modules.xml.jaxb,\
+ org.netbeans.modules.xml.jaxb.api,\
+ org.netbeans.modules.xml.multiview,\
+ org.netbeans.modules.xml.retriever,\
+ org.netbeans.modules.xml.schema.completion,\
+ org.netbeans.modules.xml.schema.model,\
+ org.netbeans.modules.xml.tax,\
+ org.netbeans.modules.xml.text,\
+ org.netbeans.modules.xml.text.obsolete90,\
+ org.netbeans.modules.xml.tools,\
+ org.netbeans.modules.xml.tools.java,\
+ org.netbeans.modules.xml.wsdl.model,\
+ org.netbeans.modules.xsl,\
+ org.netbeans.spi.editor.hints.projects,\
+ org.netbeans.swing.dirchooser,\
+ org.netbeans.upgrader,\
+ org.openide.compat,\
+ org.openide.execution.compat8,\
+ org.openide.options,\
+ org.openide.util.enumerations,\
+ org.openidex.util
+nbjdk.active=JDK_11
Review comment:
Avoid `nbjdk.active` and `nbplatform.active`.
##########
File path: java/java.lsp.server/vscode/package.json
##########
@@ -401,6 +401,11 @@
"command": "foundProjects.deleteEntry",
"title": "Delete"
},
+ {
+ "command": "micronaut.add.db.connection",
+ "title": "Add Database Connection",
+ "category": "Micronaut"
Review comment:
It'd be better if Micronaut extension were in `enterprise/micronaut` module, not here.
##########
File path: java/java.lsp.server/nbcode/nbproject/platform.properties
##########
@@ -30,7 +30,6 @@ cluster.path=\
disabled.modules=\
Review comment:
So many changes! However most of them are just reorderings, right? Hard to guess what was the real intent, can you revert the changes and start once again and create a minimal diff?
##########
File path: java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/ShowInputBoxParams.java
##########
@@ -83,6 +93,22 @@ public String getValue() {
public void setValue(@NonNull final String value) {
this.value = Preconditions.checkNotNull(value, "value");
}
+
+ /**
+ * Controls if a password input is shown. Password input hides the typed text.
+ */
+ @Pure
+ @NonNull
+ public boolean isPassword() {
+ return password;
+ }
+
+ /**
+ * Controls if a password input is shown. Password input hides the typed text.
+ */
+ public void setPassword(boolean password) {
+ this.password = password;
Review comment:
Expanding the NetBeans LSP protocol extensions. Brave!
Ideally we should version the changes, but it is a gray area so far. Consider at least increasing spec version of the `java.lsp.server` module and leaving a `@since` note on the new methods/field.
##########
File path: ide/db/src/org/netbeans/modules/db/explorer/DbSchemasQuery.java
##########
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.db.explorer;
+
+import java.sql.DatabaseMetaData;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+import org.netbeans.api.db.explorer.DatabaseException;
+import org.openide.util.Exceptions;
+
+/**
+ *
+ * @author Jan Horvath
+ */
+public class DbSchemasQuery {
+
+ /**
+ * Retrieves a list of database schemas available for given connection.
+ *
+ * @param dbconn
+ * @return List of schemas or null if connection failed
+ */
+ public static List<String> getSchemasForConnection(org.netbeans.api.db.explorer.DatabaseConnection dbconn) {
+ List<String> schemas = null;
+ try {
+ DatabaseConnection databaseConnection = new DatabaseConnection();
+ databaseConnection.setDriver(dbconn.getDriverClass());
+ databaseConnection.setDatabase(dbconn.getDatabaseURL());
+ databaseConnection.setUser(dbconn.getUser());
+ databaseConnection.setPassword(dbconn.getPassword());
+ databaseConnection.setSchema(dbconn.getSchema());
+ databaseConnection.setConnectionProperties(dbconn.getConnectionProperties());
+
+ databaseConnection.connectSync();
+ if (databaseConnection.getState() == DatabaseConnection.State.connected) {
+ DatabaseMetaData dbMetaData = databaseConnection.getJDBCConnection().getMetaData();
+ if (dbMetaData.supportsSchemasInTableDefinitions()) {
+ ResultSet rs = dbMetaData.getSchemas();
+ if (rs != null) {
+ while (rs.next()) {
+ if (schemas == null) {
+ schemas = new ArrayList<>();
+ }
+ schemas.add(rs.getString(1).trim());
+ }
+ }
+ }
+ }
+ } catch (DatabaseException | SQLException ex) {
Review comment:
Why not propagate the exception to the caller?
##########
File path: java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/Server.java
##########
@@ -858,6 +859,7 @@ protected LanguageClient client() {
public static final String JAVA_SUPER_IMPLEMENTATION = "java.super.implementation";
public static final String JAVA_SOURCE_FOR = "java.source.for";
public static final String GRAALVM_PAUSE_SCRIPT = "graalvm.pause.script";
+ public static final String DB_ADD_CONNECTION = "micronaut.add.db.connection";
Review comment:
Why is this command prefixed by `micronaut`? The DB explorer is completely micronaut unrelated, right?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] sdedic commented on a change in pull request #3358: Adding command for New Database Connection
Posted by GitBox <gi...@apache.org>.
sdedic commented on a change in pull request #3358:
URL: https://github.com/apache/netbeans/pull/3358#discussion_r772174109
##########
File path: java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/db/DatabaseCommands.java
##########
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.java.lsp.server.db;
+
+import java.net.URL;
+import java.sql.DatabaseMetaData;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.CompletableFuture;
+import java.util.stream.Collectors;
+import org.eclipse.lsp4j.MessageParams;
+import org.eclipse.lsp4j.MessageType;
+import org.netbeans.api.db.explorer.ConnectionManager;
+import org.netbeans.api.db.explorer.DatabaseConnection;
+import org.netbeans.api.db.explorer.DatabaseException;
+import org.netbeans.api.db.explorer.JDBCDriver;
+import org.netbeans.api.db.explorer.JDBCDriverManager;
+import org.netbeans.modules.java.lsp.server.protocol.NbCodeLanguageClient;
+import org.netbeans.modules.java.lsp.server.protocol.QuickPickItem;
+import org.netbeans.modules.java.lsp.server.protocol.ShowInputBoxParams;
+import org.netbeans.modules.java.lsp.server.protocol.ShowQuickPickParams;
+import org.openide.awt.StatusDisplayer;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.URLMapper;
+import org.openide.util.NbBundle;
+
+/**
+ *
+ * @author Jan Horvath
+ */
+@NbBundle.Messages({
+ "MSG_EnterDbUrl=Enter DB URL",
+ "MSG_EnterUsername=Enter Username",
+ "MSG_EnterPassword=Enter Password",
+ "MSG_SelectDriver=Select db driver",
+ "MSG_DriverNotFound=Driver not found",
+ "MSG_ConnectionAdded=Connection added",
+ "MSG_ConnectionFailed=Connection failed",
+ "MSG_SelectSchema=Select Database Schema"
+})
+public class DatabaseCommands {
+
+ public static CompletableFuture<Object> addDbConnection(NbCodeLanguageClient client) {
+ JDBCDriver[] drivers = JDBCDriverManager.getDefault().getDrivers();
+ List<QuickPickItem> items = new ArrayList<>();
+ for (int i = 0; i < drivers.length; i++) {
+ URL[] jars = drivers[i].getURLs();
+ if (jars != null && jars.length > 0) {
+ FileObject jarFO = URLMapper.findFileObject(jars[0]);
+ if (jarFO != null && jarFO.isValid()) {
+ items.add(
+ new QuickPickItem(drivers[i].getName(), null, drivers[i].getDisplayName() + " (" + drivers[i].getClassName() + ")", false, i) // NOI18N
+ );
+ }
+ }
+ }
+
+ return client.showQuickPick(new ShowQuickPickParams(Bundle.MSG_SelectDriver(), false, items))
+ .thenApply(selectedItems -> {
+ if (selectedItems == null) {
+ return null;
+ }
+ if (!selectedItems.isEmpty()) {
+ int i = ((Double) selectedItems.get(0).getUserData()).intValue();
+ JDBCDriver driver = drivers[i];
+ client.showInputBox(new ShowInputBoxParams(
+ Bundle.MSG_EnterDbUrl(), "")).thenAccept((u) -> {
+ if (u == null) {
+ return;
+ }
+ client.showInputBox(new ShowInputBoxParams(
+ Bundle.MSG_EnterUsername(), "")).thenAccept((username) -> { //NOI18N
+ if (username == null) {
+ return;
+ }
+ client.showInputBox(new ShowInputBoxParams(
+ Bundle.MSG_EnterPassword(), "", true)).thenAccept((password) -> { //NOI18N
+ if (password == null) {
Review comment:
Is password required for all databases ? E.g. for `mysql`, password-less logins can be allowed (?)
##########
File path: java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/db/DatabaseCommands.java
##########
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.java.lsp.server.db;
+
+import java.net.URL;
+import java.sql.DatabaseMetaData;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.CompletableFuture;
+import java.util.stream.Collectors;
+import org.eclipse.lsp4j.MessageParams;
+import org.eclipse.lsp4j.MessageType;
+import org.netbeans.api.db.explorer.ConnectionManager;
+import org.netbeans.api.db.explorer.DatabaseConnection;
+import org.netbeans.api.db.explorer.DatabaseException;
+import org.netbeans.api.db.explorer.JDBCDriver;
+import org.netbeans.api.db.explorer.JDBCDriverManager;
+import org.netbeans.modules.java.lsp.server.protocol.NbCodeLanguageClient;
+import org.netbeans.modules.java.lsp.server.protocol.QuickPickItem;
+import org.netbeans.modules.java.lsp.server.protocol.ShowInputBoxParams;
+import org.netbeans.modules.java.lsp.server.protocol.ShowQuickPickParams;
+import org.openide.awt.StatusDisplayer;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.URLMapper;
+import org.openide.util.NbBundle;
+
+/**
+ *
+ * @author Jan Horvath
+ */
+@NbBundle.Messages({
+ "MSG_EnterDbUrl=Enter DB URL",
+ "MSG_EnterUsername=Enter Username",
+ "MSG_EnterPassword=Enter Password",
+ "MSG_SelectDriver=Select db driver",
+ "MSG_DriverNotFound=Driver not found",
+ "MSG_ConnectionAdded=Connection added",
+ "MSG_ConnectionFailed=Connection failed",
+ "MSG_SelectSchema=Select Database Schema"
+})
+public class DatabaseCommands {
+
+ public static CompletableFuture<Object> addDbConnection(NbCodeLanguageClient client) {
+ JDBCDriver[] drivers = JDBCDriverManager.getDefault().getDrivers();
+ List<QuickPickItem> items = new ArrayList<>();
+ for (int i = 0; i < drivers.length; i++) {
+ URL[] jars = drivers[i].getURLs();
+ if (jars != null && jars.length > 0) {
+ FileObject jarFO = URLMapper.findFileObject(jars[0]);
+ if (jarFO != null && jarFO.isValid()) {
+ items.add(
+ new QuickPickItem(drivers[i].getName(), null, drivers[i].getDisplayName() + " (" + drivers[i].getClassName() + ")", false, i) // NOI18N
+ );
+ }
+ }
+ }
+
+ return client.showQuickPick(new ShowQuickPickParams(Bundle.MSG_SelectDriver(), false, items))
+ .thenApply(selectedItems -> {
+ if (selectedItems == null) {
+ return null;
+ }
+ if (!selectedItems.isEmpty()) {
+ int i = ((Double) selectedItems.get(0).getUserData()).intValue();
+ JDBCDriver driver = drivers[i];
+ client.showInputBox(new ShowInputBoxParams(
+ Bundle.MSG_EnterDbUrl(), "")).thenAccept((u) -> {
+ if (u == null) {
+ return;
+ }
+ client.showInputBox(new ShowInputBoxParams(
+ Bundle.MSG_EnterUsername(), "")).thenAccept((username) -> { //NOI18N
+ if (username == null) {
+ return;
+ }
+ client.showInputBox(new ShowInputBoxParams(
+ Bundle.MSG_EnterPassword(), "", true)).thenAccept((password) -> { //NOI18N
+ if (password == null) {
+ return;
+ }
+ DatabaseConnection dbconn = DatabaseConnection.create(driver, u, username, null, password, true);
+ try {
Review comment:
If you would like to limit that deep nesting, this is the point where the `CompletableFuture` can yield a ` DatabaseConnection` instance and we can with `thenAccept` at top level again :)
##########
File path: java/java.lsp.server/vscode/src/extension.ts
##########
@@ -756,7 +756,7 @@ function doActivateWithJDK(specifiedJDK: string | null, context: ExtensionContex
return selected ? Array.isArray(selected) ? selected : [selected] : undefined;
});
c.onRequest(InputBoxRequest.type, async param => {
- return await window.showInputBox({ prompt: param.prompt, value: param.value });
+ return await window.showInputBox({ prompt: param.prompt, value: param.value, password: param.password });
Review comment:
Bump required spec version in `nbcode/integration` module.
##########
File path: java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/Server.java
##########
@@ -712,7 +712,8 @@ private InitializeResult constructInitResponse(JavaSource src) {
JAVA_SUPER_IMPLEMENTATION,
JAVA_SOURCE_FOR,
JAVA_CLEAR_PROJECT_CACHES,
- NATIVE_IMAGE_FIND_DEBUG_PROCESS_TO_ATTACH));
+ NATIVE_IMAGE_FIND_DEBUG_PROCESS_TO_ATTACH,
+ DB_ADD_CONNECTION));
Review comment:
Given you've already created `DatabaseCommands` I would suggest to split DB stuff from core `Server` or `WorkspaceServiceImp` by using `CodeActionsProvider`. There's a `DBCommandProvider` for this in `lsp.server.db` package.
##########
File path: java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/ShowInputBoxParams.java
##########
@@ -83,6 +93,26 @@ public String getValue() {
public void setValue(@NonNull final String value) {
this.value = Preconditions.checkNotNull(value, "value");
}
+
+ /**
+ * Controls if a password input is shown. Password input hides the typed text.
+ *
+ * @since 1.14
Review comment:
LSP module has `1.15` in `master` already.
##########
File path: java/java.lsp.server/vscode/src/protocol.ts
##########
@@ -79,6 +79,10 @@ export interface ShowInputBoxParams {
* The value to prefill in the input box.
*/
value: string;
+ /**
+ * Controls if a password input is shown. Password input hides the typed text.
+ */
+ password: boolean;
Review comment:
I'd recommend to make this property optional. If done then change [params.password](https://github.com/apache/netbeans/pull/3358/files#diff-89cb5a563e47f4b486e013fecb1bf18faa68e1f38fc146e7426c04647e71006bR759) to `params?.password`
##########
File path: java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/ShowInputBoxParams.java
##########
@@ -42,14 +42,24 @@
*/
@NonNull
private String value;
+
+ /**
+ * Controls if a password input is shown. Password input hides the typed text.
+ */
+ private boolean password = false;
Review comment:
Increase LSP module spec version
##########
File path: java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/db/DatabaseCommands.java
##########
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.java.lsp.server.db;
+
+import java.net.URL;
+import java.sql.DatabaseMetaData;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.CompletableFuture;
+import java.util.stream.Collectors;
+import org.eclipse.lsp4j.MessageParams;
+import org.eclipse.lsp4j.MessageType;
+import org.netbeans.api.db.explorer.ConnectionManager;
+import org.netbeans.api.db.explorer.DatabaseConnection;
+import org.netbeans.api.db.explorer.DatabaseException;
+import org.netbeans.api.db.explorer.JDBCDriver;
+import org.netbeans.api.db.explorer.JDBCDriverManager;
+import org.netbeans.modules.java.lsp.server.protocol.NbCodeLanguageClient;
+import org.netbeans.modules.java.lsp.server.protocol.QuickPickItem;
+import org.netbeans.modules.java.lsp.server.protocol.ShowInputBoxParams;
+import org.netbeans.modules.java.lsp.server.protocol.ShowQuickPickParams;
+import org.openide.awt.StatusDisplayer;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.URLMapper;
+import org.openide.util.NbBundle;
+
+/**
+ *
+ * @author Jan Horvath
+ */
+@NbBundle.Messages({
+ "MSG_EnterDbUrl=Enter DB URL",
+ "MSG_EnterUsername=Enter Username",
+ "MSG_EnterPassword=Enter Password",
+ "MSG_SelectDriver=Select db driver",
+ "MSG_DriverNotFound=Driver not found",
+ "MSG_ConnectionAdded=Connection added",
+ "MSG_ConnectionFailed=Connection failed",
+ "MSG_SelectSchema=Select Database Schema"
+})
+public class DatabaseCommands {
+
+ public static CompletableFuture<Object> addDbConnection(NbCodeLanguageClient client) {
+ JDBCDriver[] drivers = JDBCDriverManager.getDefault().getDrivers();
+ List<QuickPickItem> items = new ArrayList<>();
+ for (int i = 0; i < drivers.length; i++) {
+ URL[] jars = drivers[i].getURLs();
+ if (jars != null && jars.length > 0) {
+ FileObject jarFO = URLMapper.findFileObject(jars[0]);
+ if (jarFO != null && jarFO.isValid()) {
+ items.add(
+ new QuickPickItem(drivers[i].getName(), null, drivers[i].getDisplayName() + " (" + drivers[i].getClassName() + ")", false, i) // NOI18N
Review comment:
Hm; on the second thought, consider to send `drivers[i].getName()` to identify the selected driver in `then` clause. Not necessary, unless another `vscode` instance adds a driver.
##########
File path: java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/db/DatabaseCommands.java
##########
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.java.lsp.server.db;
+
+import java.net.URL;
+import java.sql.DatabaseMetaData;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.CompletableFuture;
+import java.util.stream.Collectors;
+import org.eclipse.lsp4j.MessageParams;
+import org.eclipse.lsp4j.MessageType;
+import org.netbeans.api.db.explorer.ConnectionManager;
+import org.netbeans.api.db.explorer.DatabaseConnection;
+import org.netbeans.api.db.explorer.DatabaseException;
+import org.netbeans.api.db.explorer.JDBCDriver;
+import org.netbeans.api.db.explorer.JDBCDriverManager;
+import org.netbeans.modules.java.lsp.server.protocol.NbCodeLanguageClient;
+import org.netbeans.modules.java.lsp.server.protocol.QuickPickItem;
+import org.netbeans.modules.java.lsp.server.protocol.ShowInputBoxParams;
+import org.netbeans.modules.java.lsp.server.protocol.ShowQuickPickParams;
+import org.openide.awt.StatusDisplayer;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.URLMapper;
+import org.openide.util.NbBundle;
+
+/**
+ *
+ * @author Jan Horvath
+ */
+@NbBundle.Messages({
+ "MSG_EnterDbUrl=Enter DB URL",
+ "MSG_EnterUsername=Enter Username",
+ "MSG_EnterPassword=Enter Password",
+ "MSG_SelectDriver=Select db driver",
+ "MSG_DriverNotFound=Driver not found",
+ "MSG_ConnectionAdded=Connection added",
+ "MSG_ConnectionFailed=Connection failed",
+ "MSG_SelectSchema=Select Database Schema"
+})
+public class DatabaseCommands {
+
+ public static CompletableFuture<Object> addDbConnection(NbCodeLanguageClient client) {
+ JDBCDriver[] drivers = JDBCDriverManager.getDefault().getDrivers();
+ List<QuickPickItem> items = new ArrayList<>();
+ for (int i = 0; i < drivers.length; i++) {
+ URL[] jars = drivers[i].getURLs();
+ if (jars != null && jars.length > 0) {
+ FileObject jarFO = URLMapper.findFileObject(jars[0]);
+ if (jarFO != null && jarFO.isValid()) {
+ items.add(
+ new QuickPickItem(drivers[i].getName(), null, drivers[i].getDisplayName() + " (" + drivers[i].getClassName() + ")", false, i) // NOI18N
+ );
+ }
+ }
+ }
+
+ return client.showQuickPick(new ShowQuickPickParams(Bundle.MSG_SelectDriver(), false, items))
+ .thenApply(selectedItems -> {
+ if (selectedItems == null) {
+ return null;
+ }
+ if (!selectedItems.isEmpty()) {
+ int i = ((Double) selectedItems.get(0).getUserData()).intValue();
+ JDBCDriver driver = drivers[i];
+ client.showInputBox(new ShowInputBoxParams(
+ Bundle.MSG_EnterDbUrl(), "")).thenAccept((u) -> {
+ if (u == null) {
+ return;
+ }
+ client.showInputBox(new ShowInputBoxParams(
+ Bundle.MSG_EnterUsername(), "")).thenAccept((username) -> { //NOI18N
+ if (username == null) {
+ return;
+ }
+ client.showInputBox(new ShowInputBoxParams(
+ Bundle.MSG_EnterPassword(), "", true)).thenAccept((password) -> { //NOI18N
+ if (password == null) {
+ return;
+ }
+ DatabaseConnection dbconn = DatabaseConnection.create(driver, u, username, null, password, true);
+ try {
+ ConnectionManager.getDefault().addConnection(dbconn);
+ List<String> schemas = getSchemas(dbconn);
+ if (schemas.isEmpty()) {
+ client.showMessage(new MessageParams(MessageType.Info, Bundle.MSG_ConnectionAdded()));
+ } else {
+ List<QuickPickItem> schemaItems = schemas.stream().map(schema -> new QuickPickItem(schema)).collect(Collectors.toList());
+ client.showQuickPick(new ShowQuickPickParams(Bundle.MSG_SelectSchema(), schemaItems)).thenAccept((s) -> {
+ if (s == null) {
+ try {
+ // Command was interrupted, we don't want the connection to be added
+ ConnectionManager.getDefault().removeConnection(dbconn);
+ } catch (DatabaseException ex) {
+ StatusDisplayer.getDefault().setStatusText(ex.getMessage());
+ }
+ return;
+ }
+ String schema = s.get(0).getLabel();
+ DatabaseConnection dbconn1 = DatabaseConnection.create(driver, u, username, schema, password, true);
+ try {
+ ConnectionManager.getDefault().removeConnection(dbconn);
+ ConnectionManager.getDefault().addConnection(dbconn1);
+ } catch (DatabaseException ex) {
+ client.showMessage(new MessageParams(MessageType.Error, ex.getMessage()));
+ return;
+ }
+ client.showMessage(new MessageParams(MessageType.Info, Bundle.MSG_ConnectionAdded()));
+ });
+ }
+ } catch (SQLException | DatabaseException ex) {
+ client.showMessage(new MessageParams(MessageType.Error, ex.getMessage()));
+ }
+ });
+ });
+
+ });
+
+ } else {
+ client.showMessage(new MessageParams(MessageType.Error, Bundle.MSG_DriverNotFound()));
+ }
+ return null;
+ });
+ }
+
+ private static List<String> getSchemas(DatabaseConnection dbconn) throws SQLException, DatabaseException {
+ List<String> schemas = new ArrayList<>();
+ if (ConnectionManager.getDefault().connect(dbconn)) {
+ DatabaseMetaData dbMetaData = dbconn.getJDBCConnection().getMetaData();
+ if (dbMetaData.supportsSchemasInTableDefinitions()) {
+ ResultSet rs = dbMetaData.getSchemas();
+ if (rs != null) {
+ while (rs.next()) {
+ schemas.add(rs.getString(1).trim());
Review comment:
is index safer than column name in this case ?
##########
File path: java/java.lsp.server/nbcode/nbproject/platform.properties
##########
@@ -116,8 +116,6 @@ disabled.modules=\
org.netbeans.modules.css.model,\
org.netbeans.modules.css.prep,\
org.netbeans.modules.css.visual,\
- org.netbeans.modules.db.core,\
Review comment:
Please check if those modules are actually needed - I couldn't find a reference to `db.core` or `db.dataview` APIs.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] sdedic merged pull request #3358: Adding command for New Database Connection
Posted by GitBox <gi...@apache.org>.
sdedic merged pull request #3358:
URL: https://github.com/apache/netbeans/pull/3358
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] sdedic commented on a change in pull request #3358: Adding command for New Database Connection
Posted by GitBox <gi...@apache.org>.
sdedic commented on a change in pull request #3358:
URL: https://github.com/apache/netbeans/pull/3358#discussion_r765065738
##########
File path: java/java.lsp.server/nbproject/project.xml
##########
@@ -126,7 +132,15 @@
<compile-dependency/>
<run-dependency>
<release-version>1</release-version>
- <specification-version>1.82</specification-version>
+ <specification-version>1.81</specification-version>
Review comment:
Old version, was `1.82`. In fact this PR adds an API to db.explorer, so should even increase + apichanges & etc.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] jhorvath commented on pull request #3358: Adding command for New Database Connection
Posted by GitBox <gi...@apache.org>.
jhorvath commented on pull request #3358:
URL: https://github.com/apache/netbeans/pull/3358#issuecomment-997434470
> I have read and agree to the license statement.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] matthiasblaesing commented on a change in pull request #3358: Adding command for New Database Connection
Posted by GitBox <gi...@apache.org>.
matthiasblaesing commented on a change in pull request #3358:
URL: https://github.com/apache/netbeans/pull/3358#discussion_r770956165
##########
File path: java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/db/DatabaseCommands.java
##########
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.java.lsp.server.db;
+
+import java.net.URL;
+import java.sql.DatabaseMetaData;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.CompletableFuture;
+import java.util.stream.Collectors;
+import org.eclipse.lsp4j.MessageParams;
+import org.eclipse.lsp4j.MessageType;
+import org.netbeans.api.db.explorer.ConnectionManager;
+import org.netbeans.api.db.explorer.DatabaseConnection;
+import org.netbeans.api.db.explorer.DatabaseException;
+import org.netbeans.api.db.explorer.JDBCDriver;
+import org.netbeans.api.db.explorer.JDBCDriverManager;
+import org.netbeans.modules.java.lsp.server.protocol.NbCodeLanguageClient;
+import org.netbeans.modules.java.lsp.server.protocol.QuickPickItem;
+import org.netbeans.modules.java.lsp.server.protocol.ShowInputBoxParams;
+import org.netbeans.modules.java.lsp.server.protocol.ShowQuickPickParams;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.URLMapper;
+import org.openide.util.NbBundle;
+
+/**
+ *
+ * @author Jan Horvath
+ */
+@NbBundle.Messages({
+ "MSG_EnterDbUrl=Enter DB URL",
+ "MSG_EnterUsername=Enter Username",
+ "MSG_EnterPassword=Enter Password",
+ "MSG_SelectDriver=Select db driver",
+ "MSG_DriverNotFound=Driver not found",
+ "MSG_ConnectionAdded=Connection added",
+ "MSG_ConnectionFailed=Connection failed",
+ "MSG_SelectSchema=Select Database Schema"
+})
+public class DatabaseCommands {
+
+ public static CompletableFuture<Object> addDbConnection(NbCodeLanguageClient client) {
+ JDBCDriver[] drivers = JDBCDriverManager.getDefault().getDrivers();
+ List<QuickPickItem> items = new ArrayList<>();
+ for (int i = 0; i < drivers.length; i++) {
+ URL[] jars = drivers[i].getURLs();
+ if (jars != null && jars.length > 0) {
+ FileObject jarFO = URLMapper.findFileObject(jars[0]);
+ if (jarFO != null && jarFO.isValid()) {
+ items.add(
+ new QuickPickItem(drivers[i].getName(), null, drivers[i].getDisplayName() + " (" + drivers[i].getClassName() + ")", false, i) // NOI18N
+ );
+ }
+ }
+ }
+
+ return client.showQuickPick(new ShowQuickPickParams(Bundle.MSG_SelectDriver(), false, items))
+ .thenApply(selectedItems -> {
+ if (selectedItems == null) {
+ return null;
+ }
+ if (!selectedItems.isEmpty()) {
+ int i = ((Double) selectedItems.get(0).getUserData()).intValue();
+ JDBCDriver driver = drivers[i];
+ client.showInputBox(new ShowInputBoxParams(
+ Bundle.MSG_EnterDbUrl(), "")).thenAccept((u) -> {
+ if (u == null) {
+ return;
+ }
+ client.showInputBox(new ShowInputBoxParams(
+ Bundle.MSG_EnterUsername(), "")).thenAccept((username) -> { //NOI18N
+ if (username == null) {
+ return;
+ }
+ client.showInputBox(new ShowInputBoxParams(
+ Bundle.MSG_EnterPassword(), "", true)).thenAccept((password) -> { //NOI18N
+ if (password == null) {
+ return;
+ }
+ DatabaseConnection dbconn = DatabaseConnection.create(driver, u, username, null, password, true);
+ try {
+ ConnectionManager.getDefault().addConnection(dbconn);
+ List<String> schemas = getSchemas(dbconn);
+ System.out.println("schemas " + schemas);
Review comment:
This should be a logger (if needed)
##########
File path: java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/db/DatabaseCommands.java
##########
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.java.lsp.server.db;
+
+import java.net.URL;
+import java.sql.DatabaseMetaData;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.CompletableFuture;
+import java.util.stream.Collectors;
+import org.eclipse.lsp4j.MessageParams;
+import org.eclipse.lsp4j.MessageType;
+import org.netbeans.api.db.explorer.ConnectionManager;
+import org.netbeans.api.db.explorer.DatabaseConnection;
+import org.netbeans.api.db.explorer.DatabaseException;
+import org.netbeans.api.db.explorer.JDBCDriver;
+import org.netbeans.api.db.explorer.JDBCDriverManager;
+import org.netbeans.modules.java.lsp.server.protocol.NbCodeLanguageClient;
+import org.netbeans.modules.java.lsp.server.protocol.QuickPickItem;
+import org.netbeans.modules.java.lsp.server.protocol.ShowInputBoxParams;
+import org.netbeans.modules.java.lsp.server.protocol.ShowQuickPickParams;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.URLMapper;
+import org.openide.util.NbBundle;
+
+/**
+ *
+ * @author Jan Horvath
+ */
+@NbBundle.Messages({
+ "MSG_EnterDbUrl=Enter DB URL",
+ "MSG_EnterUsername=Enter Username",
+ "MSG_EnterPassword=Enter Password",
+ "MSG_SelectDriver=Select db driver",
+ "MSG_DriverNotFound=Driver not found",
+ "MSG_ConnectionAdded=Connection added",
+ "MSG_ConnectionFailed=Connection failed",
+ "MSG_SelectSchema=Select Database Schema"
+})
+public class DatabaseCommands {
+
+ public static CompletableFuture<Object> addDbConnection(NbCodeLanguageClient client) {
+ JDBCDriver[] drivers = JDBCDriverManager.getDefault().getDrivers();
+ List<QuickPickItem> items = new ArrayList<>();
+ for (int i = 0; i < drivers.length; i++) {
+ URL[] jars = drivers[i].getURLs();
+ if (jars != null && jars.length > 0) {
+ FileObject jarFO = URLMapper.findFileObject(jars[0]);
+ if (jarFO != null && jarFO.isValid()) {
+ items.add(
+ new QuickPickItem(drivers[i].getName(), null, drivers[i].getDisplayName() + " (" + drivers[i].getClassName() + ")", false, i) // NOI18N
+ );
+ }
+ }
+ }
+
+ return client.showQuickPick(new ShowQuickPickParams(Bundle.MSG_SelectDriver(), false, items))
+ .thenApply(selectedItems -> {
+ if (selectedItems == null) {
+ return null;
+ }
+ if (!selectedItems.isEmpty()) {
+ int i = ((Double) selectedItems.get(0).getUserData()).intValue();
+ JDBCDriver driver = drivers[i];
+ client.showInputBox(new ShowInputBoxParams(
+ Bundle.MSG_EnterDbUrl(), "")).thenAccept((u) -> {
+ if (u == null) {
+ return;
+ }
+ client.showInputBox(new ShowInputBoxParams(
+ Bundle.MSG_EnterUsername(), "")).thenAccept((username) -> { //NOI18N
+ if (username == null) {
+ return;
+ }
+ client.showInputBox(new ShowInputBoxParams(
+ Bundle.MSG_EnterPassword(), "", true)).thenAccept((password) -> { //NOI18N
+ if (password == null) {
+ return;
+ }
+ DatabaseConnection dbconn = DatabaseConnection.create(driver, u, username, null, password, true);
+ try {
+ ConnectionManager.getDefault().addConnection(dbconn);
+ List<String> schemas = getSchemas(dbconn);
+ System.out.println("schemas " + schemas);
+ if (schemas.isEmpty()) {
+ client.showMessage(new MessageParams(MessageType.Info, Bundle.MSG_ConnectionAdded()));
+ } else {
+ List<QuickPickItem> schemaItems = schemas.stream().map(schema -> new QuickPickItem(schema)).collect(Collectors.toList());
+ client.showQuickPick(new ShowQuickPickParams(Bundle.MSG_SelectSchema(), schemaItems)).thenAccept((s) -> {
+ if (s == null) {
+ try {
+ // Command was interrupted, we don't want the connection to be added
+ ConnectionManager.getDefault().removeConnection(dbconn);
+ } catch (DatabaseException ex) {
+ System.out.println(ex.getMessage());
Review comment:
This should either be a logger or a call to `org.openide.util.Exceptions#printStackTrace`.
##########
File path: java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/db/DatabaseCommands.java
##########
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.java.lsp.server.db;
+
+import java.net.URL;
+import java.sql.DatabaseMetaData;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.CompletableFuture;
+import java.util.stream.Collectors;
+import org.eclipse.lsp4j.MessageParams;
+import org.eclipse.lsp4j.MessageType;
+import org.netbeans.api.db.explorer.ConnectionManager;
+import org.netbeans.api.db.explorer.DatabaseConnection;
+import org.netbeans.api.db.explorer.DatabaseException;
+import org.netbeans.api.db.explorer.JDBCDriver;
+import org.netbeans.api.db.explorer.JDBCDriverManager;
+import org.netbeans.modules.java.lsp.server.protocol.NbCodeLanguageClient;
+import org.netbeans.modules.java.lsp.server.protocol.QuickPickItem;
+import org.netbeans.modules.java.lsp.server.protocol.ShowInputBoxParams;
+import org.netbeans.modules.java.lsp.server.protocol.ShowQuickPickParams;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.URLMapper;
+import org.openide.util.NbBundle;
+
+/**
+ *
+ * @author Jan Horvath
+ */
+@NbBundle.Messages({
+ "MSG_EnterDbUrl=Enter DB URL",
+ "MSG_EnterUsername=Enter Username",
+ "MSG_EnterPassword=Enter Password",
+ "MSG_SelectDriver=Select db driver",
+ "MSG_DriverNotFound=Driver not found",
+ "MSG_ConnectionAdded=Connection added",
+ "MSG_ConnectionFailed=Connection failed",
+ "MSG_SelectSchema=Select Database Schema"
+})
+public class DatabaseCommands {
+
+ public static CompletableFuture<Object> addDbConnection(NbCodeLanguageClient client) {
+ JDBCDriver[] drivers = JDBCDriverManager.getDefault().getDrivers();
+ List<QuickPickItem> items = new ArrayList<>();
+ for (int i = 0; i < drivers.length; i++) {
+ URL[] jars = drivers[i].getURLs();
+ if (jars != null && jars.length > 0) {
+ FileObject jarFO = URLMapper.findFileObject(jars[0]);
+ if (jarFO != null && jarFO.isValid()) {
+ items.add(
+ new QuickPickItem(drivers[i].getName(), null, drivers[i].getDisplayName() + " (" + drivers[i].getClassName() + ")", false, i) // NOI18N
+ );
+ }
+ }
+ }
+
+ return client.showQuickPick(new ShowQuickPickParams(Bundle.MSG_SelectDriver(), false, items))
+ .thenApply(selectedItems -> {
+ if (selectedItems == null) {
+ return null;
+ }
+ if (!selectedItems.isEmpty()) {
+ int i = ((Double) selectedItems.get(0).getUserData()).intValue();
Review comment:
What am I missing here? Why is this a `Double` and not an `Integer` as declared in line 69? If this is a lossy conversion, I would cast to `Number`, shielding you from implementation specific brokenness.
##########
File path: java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/db/DatabaseCommands.java
##########
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.java.lsp.server.db;
+
+import java.net.URL;
+import java.sql.DatabaseMetaData;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.CompletableFuture;
+import java.util.stream.Collectors;
+import org.eclipse.lsp4j.MessageParams;
+import org.eclipse.lsp4j.MessageType;
+import org.netbeans.api.db.explorer.ConnectionManager;
+import org.netbeans.api.db.explorer.DatabaseConnection;
+import org.netbeans.api.db.explorer.DatabaseException;
+import org.netbeans.api.db.explorer.JDBCDriver;
+import org.netbeans.api.db.explorer.JDBCDriverManager;
+import org.netbeans.modules.java.lsp.server.protocol.NbCodeLanguageClient;
+import org.netbeans.modules.java.lsp.server.protocol.QuickPickItem;
+import org.netbeans.modules.java.lsp.server.protocol.ShowInputBoxParams;
+import org.netbeans.modules.java.lsp.server.protocol.ShowQuickPickParams;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.URLMapper;
+import org.openide.util.NbBundle;
+
+/**
+ *
+ * @author Jan Horvath
+ */
+@NbBundle.Messages({
+ "MSG_EnterDbUrl=Enter DB URL",
+ "MSG_EnterUsername=Enter Username",
+ "MSG_EnterPassword=Enter Password",
+ "MSG_SelectDriver=Select db driver",
+ "MSG_DriverNotFound=Driver not found",
+ "MSG_ConnectionAdded=Connection added",
+ "MSG_ConnectionFailed=Connection failed",
+ "MSG_SelectSchema=Select Database Schema"
+})
+public class DatabaseCommands {
+
+ public static CompletableFuture<Object> addDbConnection(NbCodeLanguageClient client) {
+ JDBCDriver[] drivers = JDBCDriverManager.getDefault().getDrivers();
+ List<QuickPickItem> items = new ArrayList<>();
+ for (int i = 0; i < drivers.length; i++) {
+ URL[] jars = drivers[i].getURLs();
+ if (jars != null && jars.length > 0) {
+ FileObject jarFO = URLMapper.findFileObject(jars[0]);
+ if (jarFO != null && jarFO.isValid()) {
+ items.add(
+ new QuickPickItem(drivers[i].getName(), null, drivers[i].getDisplayName() + " (" + drivers[i].getClassName() + ")", false, i) // NOI18N
+ );
+ }
+ }
+ }
+
+ return client.showQuickPick(new ShowQuickPickParams(Bundle.MSG_SelectDriver(), false, items))
+ .thenApply(selectedItems -> {
+ if (selectedItems == null) {
+ return null;
+ }
+ if (!selectedItems.isEmpty()) {
+ int i = ((Double) selectedItems.get(0).getUserData()).intValue();
+ JDBCDriver driver = drivers[i];
+ client.showInputBox(new ShowInputBoxParams(
+ Bundle.MSG_EnterDbUrl(), "")).thenAccept((u) -> {
+ if (u == null) {
+ return;
+ }
+ client.showInputBox(new ShowInputBoxParams(
+ Bundle.MSG_EnterUsername(), "")).thenAccept((username) -> { //NOI18N
+ if (username == null) {
+ return;
+ }
+ client.showInputBox(new ShowInputBoxParams(
+ Bundle.MSG_EnterPassword(), "", true)).thenAccept((password) -> { //NOI18N
+ if (password == null) {
Review comment:
Is this intentional, that you open 3 consecutive prompts for the connection parameters? I think the current approach on the Swing side useing a single dialog is more user friendly (and the test connection button is a bonus :-))
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] sdedic commented on a change in pull request #3358: Adding command for New Database Connection
Posted by GitBox <gi...@apache.org>.
sdedic commented on a change in pull request #3358:
URL: https://github.com/apache/netbeans/pull/3358#discussion_r771546298
##########
File path: java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/db/DatabaseCommands.java
##########
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.java.lsp.server.db;
+
+import java.net.URL;
+import java.sql.DatabaseMetaData;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.CompletableFuture;
+import java.util.stream.Collectors;
+import org.eclipse.lsp4j.MessageParams;
+import org.eclipse.lsp4j.MessageType;
+import org.netbeans.api.db.explorer.ConnectionManager;
+import org.netbeans.api.db.explorer.DatabaseConnection;
+import org.netbeans.api.db.explorer.DatabaseException;
+import org.netbeans.api.db.explorer.JDBCDriver;
+import org.netbeans.api.db.explorer.JDBCDriverManager;
+import org.netbeans.modules.java.lsp.server.protocol.NbCodeLanguageClient;
+import org.netbeans.modules.java.lsp.server.protocol.QuickPickItem;
+import org.netbeans.modules.java.lsp.server.protocol.ShowInputBoxParams;
+import org.netbeans.modules.java.lsp.server.protocol.ShowQuickPickParams;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.URLMapper;
+import org.openide.util.NbBundle;
+
+/**
+ *
+ * @author Jan Horvath
+ */
+@NbBundle.Messages({
+ "MSG_EnterDbUrl=Enter DB URL",
+ "MSG_EnterUsername=Enter Username",
+ "MSG_EnterPassword=Enter Password",
+ "MSG_SelectDriver=Select db driver",
+ "MSG_DriverNotFound=Driver not found",
+ "MSG_ConnectionAdded=Connection added",
+ "MSG_ConnectionFailed=Connection failed",
+ "MSG_SelectSchema=Select Database Schema"
+})
+public class DatabaseCommands {
+
+ public static CompletableFuture<Object> addDbConnection(NbCodeLanguageClient client) {
+ JDBCDriver[] drivers = JDBCDriverManager.getDefault().getDrivers();
+ List<QuickPickItem> items = new ArrayList<>();
+ for (int i = 0; i < drivers.length; i++) {
+ URL[] jars = drivers[i].getURLs();
+ if (jars != null && jars.length > 0) {
+ FileObject jarFO = URLMapper.findFileObject(jars[0]);
+ if (jarFO != null && jarFO.isValid()) {
+ items.add(
+ new QuickPickItem(drivers[i].getName(), null, drivers[i].getDisplayName() + " (" + drivers[i].getClassName() + ")", false, i) // NOI18N
+ );
+ }
+ }
+ }
+
+ return client.showQuickPick(new ShowQuickPickParams(Bundle.MSG_SelectDriver(), false, items))
+ .thenApply(selectedItems -> {
+ if (selectedItems == null) {
+ return null;
+ }
+ if (!selectedItems.isEmpty()) {
+ int i = ((Double) selectedItems.get(0).getUserData()).intValue();
+ JDBCDriver driver = drivers[i];
+ client.showInputBox(new ShowInputBoxParams(
+ Bundle.MSG_EnterDbUrl(), "")).thenAccept((u) -> {
+ if (u == null) {
+ return;
+ }
+ client.showInputBox(new ShowInputBoxParams(
+ Bundle.MSG_EnterUsername(), "")).thenAccept((username) -> { //NOI18N
+ if (username == null) {
+ return;
+ }
+ client.showInputBox(new ShowInputBoxParams(
+ Bundle.MSG_EnterPassword(), "", true)).thenAccept((password) -> { //NOI18N
+ if (password == null) {
Review comment:
Note: this is an LSP-specific command implementation -- NetBeans has its standard Swing dialogs implemented in the DB module. Sadly LSP protocol does not allow (yet ?) for rich dialogs, so we need to approximate, I guess.
Some DB - related commands (i.e. connect, disconnect) were bridged directly to NB implementations although that requried some fixes in NB codebase. So LSP module contains minimal stuff needed - as much as it can be done is done directly in IDE codebase.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] matthiasblaesing commented on pull request #3358: Adding command for New Database Connection
Posted by GitBox <gi...@apache.org>.
matthiasblaesing commented on pull request #3358:
URL: https://github.com/apache/netbeans/pull/3358#issuecomment-997424734
@jhorvath Before this is merged:
- please ensure the author information is consistent, there is at least one merge commit, that only holds your username and a different email adress. I assume, this is created by github.
- after final review, please rebase onto master and squash into one commit (this will most likely fix the author point)
- I assume you read the license statement in the files you edited/added and you are in a position to donate the changes to the Apache Foundation and do so. (or you have an ICLA on file?)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] matthiasblaesing commented on a change in pull request #3358: Adding command for New Database Connection
Posted by GitBox <gi...@apache.org>.
matthiasblaesing commented on a change in pull request #3358:
URL: https://github.com/apache/netbeans/pull/3358#discussion_r771973764
##########
File path: java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/db/DatabaseCommands.java
##########
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.java.lsp.server.db;
+
+import java.net.URL;
+import java.sql.DatabaseMetaData;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.CompletableFuture;
+import java.util.stream.Collectors;
+import org.eclipse.lsp4j.MessageParams;
+import org.eclipse.lsp4j.MessageType;
+import org.netbeans.api.db.explorer.ConnectionManager;
+import org.netbeans.api.db.explorer.DatabaseConnection;
+import org.netbeans.api.db.explorer.DatabaseException;
+import org.netbeans.api.db.explorer.JDBCDriver;
+import org.netbeans.api.db.explorer.JDBCDriverManager;
+import org.netbeans.modules.java.lsp.server.protocol.NbCodeLanguageClient;
+import org.netbeans.modules.java.lsp.server.protocol.QuickPickItem;
+import org.netbeans.modules.java.lsp.server.protocol.ShowInputBoxParams;
+import org.netbeans.modules.java.lsp.server.protocol.ShowQuickPickParams;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.URLMapper;
+import org.openide.util.NbBundle;
+
+/**
+ *
+ * @author Jan Horvath
+ */
+@NbBundle.Messages({
+ "MSG_EnterDbUrl=Enter DB URL",
+ "MSG_EnterUsername=Enter Username",
+ "MSG_EnterPassword=Enter Password",
+ "MSG_SelectDriver=Select db driver",
+ "MSG_DriverNotFound=Driver not found",
+ "MSG_ConnectionAdded=Connection added",
+ "MSG_ConnectionFailed=Connection failed",
+ "MSG_SelectSchema=Select Database Schema"
+})
+public class DatabaseCommands {
+
+ public static CompletableFuture<Object> addDbConnection(NbCodeLanguageClient client) {
+ JDBCDriver[] drivers = JDBCDriverManager.getDefault().getDrivers();
+ List<QuickPickItem> items = new ArrayList<>();
+ for (int i = 0; i < drivers.length; i++) {
+ URL[] jars = drivers[i].getURLs();
+ if (jars != null && jars.length > 0) {
+ FileObject jarFO = URLMapper.findFileObject(jars[0]);
+ if (jarFO != null && jarFO.isValid()) {
+ items.add(
+ new QuickPickItem(drivers[i].getName(), null, drivers[i].getDisplayName() + " (" + drivers[i].getClassName() + ")", false, i) // NOI18N
+ );
+ }
+ }
+ }
+
+ return client.showQuickPick(new ShowQuickPickParams(Bundle.MSG_SelectDriver(), false, items))
+ .thenApply(selectedItems -> {
+ if (selectedItems == null) {
+ return null;
+ }
+ if (!selectedItems.isEmpty()) {
+ int i = ((Double) selectedItems.get(0).getUserData()).intValue();
+ JDBCDriver driver = drivers[i];
+ client.showInputBox(new ShowInputBoxParams(
+ Bundle.MSG_EnterDbUrl(), "")).thenAccept((u) -> {
+ if (u == null) {
+ return;
+ }
+ client.showInputBox(new ShowInputBoxParams(
+ Bundle.MSG_EnterUsername(), "")).thenAccept((username) -> { //NOI18N
+ if (username == null) {
+ return;
+ }
+ client.showInputBox(new ShowInputBoxParams(
+ Bundle.MSG_EnterPassword(), "", true)).thenAccept((password) -> { //NOI18N
+ if (password == null) {
Review comment:
Yeah, I assumed that much - thanks for the confirmation.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] matthiasblaesing commented on a change in pull request #3358: Adding command for New Database Connection
Posted by GitBox <gi...@apache.org>.
matthiasblaesing commented on a change in pull request #3358:
URL: https://github.com/apache/netbeans/pull/3358#discussion_r766142185
##########
File path: ide/db/src/org/netbeans/modules/db/explorer/DbSchemasQuery.java
##########
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.db.explorer;
+
+import java.sql.DatabaseMetaData;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+import org.netbeans.api.db.explorer.DatabaseException;
+import org.openide.util.Exceptions;
+
+/**
+ *
+ * @author Jan Horvath
+ */
+public class DbSchemasQuery {
+
+ /**
+ * Retrieves a list of database schemas available for given connection.
+ *
+ * @param dbconn
+ * @return List of schemas or null if connection failed
+ */
+ public static List<String> getSchemasForConnection(org.netbeans.api.db.explorer.DatabaseConnection dbconn) {
Review comment:
Please use the metadata API. See `org.netbeans.modules.db.explorer.node.ConnectionNode.updateModel()` to see how the metamodel can be accessed and `org.netbeans.modules.db.explorer.node.SchemaNodeProvider.initialize()` for a usage sample.
##########
File path: ide/db/src/org/netbeans/api/db/explorer/ConnectionManager.java
##########
@@ -187,6 +189,19 @@ public void removeConnection(DatabaseConnection dbconn) throws DatabaseException
ConnectionList.getDefault().remove(dbconn.getDelegate());
}
+
+ /**
+ * Retrieves a list of database schemas available for given connection.
+ *
+ * @param dbconn
+ * @return List of schemas or null if connection failed
+ */
+ public List<String> getSchemas(DatabaseConnection dbconn) {
Review comment:
There is no reason to add a new API at this level. See my other comment about the metadata api.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] jhorvath commented on a change in pull request #3358: Adding command for New Database Connection
Posted by GitBox <gi...@apache.org>.
jhorvath commented on a change in pull request #3358:
URL: https://github.com/apache/netbeans/pull/3358#discussion_r768851220
##########
File path: java/java.lsp.server/nbcode/nbproject/platform.properties
##########
@@ -30,7 +30,6 @@ cluster.path=\
disabled.modules=\
bcpg,\
bcprov,\
- com.google.guava,\
Review comment:
It was added by mistake, it is not needed, removing
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] sdedic commented on a change in pull request #3358: Adding command for New Database Connection
Posted by GitBox <gi...@apache.org>.
sdedic commented on a change in pull request #3358:
URL: https://github.com/apache/netbeans/pull/3358#discussion_r771553135
##########
File path: java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/db/DatabaseCommands.java
##########
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.java.lsp.server.db;
+
+import java.net.URL;
+import java.sql.DatabaseMetaData;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.CompletableFuture;
+import java.util.stream.Collectors;
+import org.eclipse.lsp4j.MessageParams;
+import org.eclipse.lsp4j.MessageType;
+import org.netbeans.api.db.explorer.ConnectionManager;
+import org.netbeans.api.db.explorer.DatabaseConnection;
+import org.netbeans.api.db.explorer.DatabaseException;
+import org.netbeans.api.db.explorer.JDBCDriver;
+import org.netbeans.api.db.explorer.JDBCDriverManager;
+import org.netbeans.modules.java.lsp.server.protocol.NbCodeLanguageClient;
+import org.netbeans.modules.java.lsp.server.protocol.QuickPickItem;
+import org.netbeans.modules.java.lsp.server.protocol.ShowInputBoxParams;
+import org.netbeans.modules.java.lsp.server.protocol.ShowQuickPickParams;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.URLMapper;
+import org.openide.util.NbBundle;
+
+/**
+ *
+ * @author Jan Horvath
+ */
+@NbBundle.Messages({
+ "MSG_EnterDbUrl=Enter DB URL",
+ "MSG_EnterUsername=Enter Username",
+ "MSG_EnterPassword=Enter Password",
+ "MSG_SelectDriver=Select db driver",
+ "MSG_DriverNotFound=Driver not found",
+ "MSG_ConnectionAdded=Connection added",
+ "MSG_ConnectionFailed=Connection failed",
+ "MSG_SelectSchema=Select Database Schema"
+})
+public class DatabaseCommands {
+
+ public static CompletableFuture<Object> addDbConnection(NbCodeLanguageClient client) {
+ JDBCDriver[] drivers = JDBCDriverManager.getDefault().getDrivers();
+ List<QuickPickItem> items = new ArrayList<>();
+ for (int i = 0; i < drivers.length; i++) {
+ URL[] jars = drivers[i].getURLs();
+ if (jars != null && jars.length > 0) {
+ FileObject jarFO = URLMapper.findFileObject(jars[0]);
+ if (jarFO != null && jarFO.isValid()) {
+ items.add(
+ new QuickPickItem(drivers[i].getName(), null, drivers[i].getDisplayName() + " (" + drivers[i].getClassName() + ")", false, i) // NOI18N
+ );
+ }
+ }
+ }
+
+ return client.showQuickPick(new ShowQuickPickParams(Bundle.MSG_SelectDriver(), false, items))
+ .thenApply(selectedItems -> {
+ if (selectedItems == null) {
+ return null;
+ }
+ if (!selectedItems.isEmpty()) {
+ int i = ((Double) selectedItems.get(0).getUserData()).intValue();
Review comment:
The trouble is that the `QuickPickItem` structure is mashalled to the LSP connection stream and goes to the client and back. And because the client is (yuck!) javascript, it represents integer as `number` which is unmarshalled as double... At this moment I do not know if the culprit is eclipse lsp4j, it is a feature by design (who the knows what type 2 actually is in a JSON document) or the javascript existence itself. If it is Eclipse stuff, we could eventually file a bug against the library.
To improve possible future compatibility, I'd put there
`((Number) selectedItems.get(0).getUserData()).intValue();`
so if ever numbers w/o floating part deserialize to Integers or Longs the code survives.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] sdedic commented on a change in pull request #3358: Adding command for New Database Connection
Posted by GitBox <gi...@apache.org>.
sdedic commented on a change in pull request #3358:
URL: https://github.com/apache/netbeans/pull/3358#discussion_r771546298
##########
File path: java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/db/DatabaseCommands.java
##########
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.java.lsp.server.db;
+
+import java.net.URL;
+import java.sql.DatabaseMetaData;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.CompletableFuture;
+import java.util.stream.Collectors;
+import org.eclipse.lsp4j.MessageParams;
+import org.eclipse.lsp4j.MessageType;
+import org.netbeans.api.db.explorer.ConnectionManager;
+import org.netbeans.api.db.explorer.DatabaseConnection;
+import org.netbeans.api.db.explorer.DatabaseException;
+import org.netbeans.api.db.explorer.JDBCDriver;
+import org.netbeans.api.db.explorer.JDBCDriverManager;
+import org.netbeans.modules.java.lsp.server.protocol.NbCodeLanguageClient;
+import org.netbeans.modules.java.lsp.server.protocol.QuickPickItem;
+import org.netbeans.modules.java.lsp.server.protocol.ShowInputBoxParams;
+import org.netbeans.modules.java.lsp.server.protocol.ShowQuickPickParams;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.URLMapper;
+import org.openide.util.NbBundle;
+
+/**
+ *
+ * @author Jan Horvath
+ */
+@NbBundle.Messages({
+ "MSG_EnterDbUrl=Enter DB URL",
+ "MSG_EnterUsername=Enter Username",
+ "MSG_EnterPassword=Enter Password",
+ "MSG_SelectDriver=Select db driver",
+ "MSG_DriverNotFound=Driver not found",
+ "MSG_ConnectionAdded=Connection added",
+ "MSG_ConnectionFailed=Connection failed",
+ "MSG_SelectSchema=Select Database Schema"
+})
+public class DatabaseCommands {
+
+ public static CompletableFuture<Object> addDbConnection(NbCodeLanguageClient client) {
+ JDBCDriver[] drivers = JDBCDriverManager.getDefault().getDrivers();
+ List<QuickPickItem> items = new ArrayList<>();
+ for (int i = 0; i < drivers.length; i++) {
+ URL[] jars = drivers[i].getURLs();
+ if (jars != null && jars.length > 0) {
+ FileObject jarFO = URLMapper.findFileObject(jars[0]);
+ if (jarFO != null && jarFO.isValid()) {
+ items.add(
+ new QuickPickItem(drivers[i].getName(), null, drivers[i].getDisplayName() + " (" + drivers[i].getClassName() + ")", false, i) // NOI18N
+ );
+ }
+ }
+ }
+
+ return client.showQuickPick(new ShowQuickPickParams(Bundle.MSG_SelectDriver(), false, items))
+ .thenApply(selectedItems -> {
+ if (selectedItems == null) {
+ return null;
+ }
+ if (!selectedItems.isEmpty()) {
+ int i = ((Double) selectedItems.get(0).getUserData()).intValue();
+ JDBCDriver driver = drivers[i];
+ client.showInputBox(new ShowInputBoxParams(
+ Bundle.MSG_EnterDbUrl(), "")).thenAccept((u) -> {
+ if (u == null) {
+ return;
+ }
+ client.showInputBox(new ShowInputBoxParams(
+ Bundle.MSG_EnterUsername(), "")).thenAccept((username) -> { //NOI18N
+ if (username == null) {
+ return;
+ }
+ client.showInputBox(new ShowInputBoxParams(
+ Bundle.MSG_EnterPassword(), "", true)).thenAccept((password) -> { //NOI18N
+ if (password == null) {
Review comment:
Note: this is an LSP-specific command implementation -- NetBeans have its standard Swing dialogs implemented in the DB module. Sadly LSP protocol does not allow (yet ?) for rich dialogs, so we need to approximate, I guess.
Some DB - related commands (i.e. connect, disconnect) were bridged directly to NB implementations although that requried some fixes in NB codebase. So LSP module contains minimal stuff needed - as much as it can be done is done directly in IDE codebase.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] matthiasblaesing commented on a change in pull request #3358: Adding command for New Database Connection
Posted by GitBox <gi...@apache.org>.
matthiasblaesing commented on a change in pull request #3358:
URL: https://github.com/apache/netbeans/pull/3358#discussion_r771973691
##########
File path: java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/db/DatabaseCommands.java
##########
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.java.lsp.server.db;
+
+import java.net.URL;
+import java.sql.DatabaseMetaData;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.CompletableFuture;
+import java.util.stream.Collectors;
+import org.eclipse.lsp4j.MessageParams;
+import org.eclipse.lsp4j.MessageType;
+import org.netbeans.api.db.explorer.ConnectionManager;
+import org.netbeans.api.db.explorer.DatabaseConnection;
+import org.netbeans.api.db.explorer.DatabaseException;
+import org.netbeans.api.db.explorer.JDBCDriver;
+import org.netbeans.api.db.explorer.JDBCDriverManager;
+import org.netbeans.modules.java.lsp.server.protocol.NbCodeLanguageClient;
+import org.netbeans.modules.java.lsp.server.protocol.QuickPickItem;
+import org.netbeans.modules.java.lsp.server.protocol.ShowInputBoxParams;
+import org.netbeans.modules.java.lsp.server.protocol.ShowQuickPickParams;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.URLMapper;
+import org.openide.util.NbBundle;
+
+/**
+ *
+ * @author Jan Horvath
+ */
+@NbBundle.Messages({
+ "MSG_EnterDbUrl=Enter DB URL",
+ "MSG_EnterUsername=Enter Username",
+ "MSG_EnterPassword=Enter Password",
+ "MSG_SelectDriver=Select db driver",
+ "MSG_DriverNotFound=Driver not found",
+ "MSG_ConnectionAdded=Connection added",
+ "MSG_ConnectionFailed=Connection failed",
+ "MSG_SelectSchema=Select Database Schema"
+})
+public class DatabaseCommands {
+
+ public static CompletableFuture<Object> addDbConnection(NbCodeLanguageClient client) {
+ JDBCDriver[] drivers = JDBCDriverManager.getDefault().getDrivers();
+ List<QuickPickItem> items = new ArrayList<>();
+ for (int i = 0; i < drivers.length; i++) {
+ URL[] jars = drivers[i].getURLs();
+ if (jars != null && jars.length > 0) {
+ FileObject jarFO = URLMapper.findFileObject(jars[0]);
+ if (jarFO != null && jarFO.isValid()) {
+ items.add(
+ new QuickPickItem(drivers[i].getName(), null, drivers[i].getDisplayName() + " (" + drivers[i].getClassName() + ")", false, i) // NOI18N
+ );
+ }
+ }
+ }
+
+ return client.showQuickPick(new ShowQuickPickParams(Bundle.MSG_SelectDriver(), false, items))
+ .thenApply(selectedItems -> {
+ if (selectedItems == null) {
+ return null;
+ }
+ if (!selectedItems.isEmpty()) {
+ int i = ((Double) selectedItems.get(0).getUserData()).intValue();
Review comment:
That makes sense. Thanks for the pointer.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] JaroslavTulach commented on a change in pull request #3358: Adding command for New Database Connection
Posted by GitBox <gi...@apache.org>.
JaroslavTulach commented on a change in pull request #3358:
URL: https://github.com/apache/netbeans/pull/3358#discussion_r768366884
##########
File path: java/java.lsp.server/nbcode/nbproject/platform.properties
##########
@@ -30,7 +30,6 @@ cluster.path=\
disabled.modules=\
bcpg,\
bcprov,\
- com.google.guava,\
Review comment:
Who needs Guava? I don't think NetBeans code is using it directly...
##########
File path: java/java.lsp.server/nbcode/nbproject/platform.properties
##########
@@ -30,7 +30,6 @@ cluster.path=\
disabled.modules=\
Review comment:
OK, now it is better. Adding:
```
org.netbeans.modules.db.core
org.netbeans.modules.db.dataview
```
seems sane. Not sure why we need `com.google.guava`!?
##########
File path: java/java.lsp.server/vscode/package.json
##########
@@ -401,6 +401,11 @@
"command": "foundProjects.deleteEntry",
"title": "Delete"
},
+ {
+ "command": "db.add.connection",
+ "title": "Add Database Connection",
+ "category": "Database"
Review comment:
Category "Database" sounds better.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] sdedic commented on a change in pull request #3358: Adding command for New Database Connection
Posted by GitBox <gi...@apache.org>.
sdedic commented on a change in pull request #3358:
URL: https://github.com/apache/netbeans/pull/3358#discussion_r772537246
##########
File path: java/java.lsp.server/nbcode/nbproject/platform.properties
##########
@@ -30,7 +30,6 @@ cluster.path=\
disabled.modules=\
bcpg,\
bcprov,\
- com.google.guava,\
Review comment:
guava is excluded.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] sdedic commented on pull request #3358: Adding command for New Database Connection
Posted by GitBox <gi...@apache.org>.
sdedic commented on pull request #3358:
URL: https://github.com/apache/netbeans/pull/3358#issuecomment-998586745
I would ignore the commit validation on Mac. Failed on a timeout.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists