This is an automated email from the ASF dual-hosted git repository.

thurka pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git


The following commit(s) were added to refs/heads/master by this push:
     new a2a20e24e7 redundant check for supported 'command' removed
     new d6afe996e9 Merge pull request #6285 from thurka/GH-6113
a2a20e24e7 is described below

commit a2a20e24e7c068bd9236a33bae9d9968ab9a1f65
Author: Tomas Hurka <tomas.hu...@gmail.com>
AuthorDate: Wed Aug 2 11:43:00 2023 +0200

    redundant check for supported 'command' removed
---
 .../netbeans/modules/java/lsp/server/db/DBAddConnection.java  |  3 ---
 .../modules/java/lsp/server/db/DBCommandProvider.java         |  3 ---
 .../modules/java/lsp/server/db/DBConnectionProvider.java      |  3 ---
 .../modules/java/lsp/server/explorer/NodeActionsProvider.java |  3 ---
 .../java/lsp/server/explorer/NodePropertiesProvider.java      |  3 ---
 .../org/netbeans/modules/java/lsp/server/htmlui/WebView.java  |  2 +-
 .../netbeans/modules/java/lsp/server/protocol/ServerTest.java | 11 ++---------
 7 files changed, 3 insertions(+), 25 deletions(-)

diff --git 
a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/db/DBAddConnection.java
 
b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/db/DBAddConnection.java
index 79fb38b24f..5b00a58bec 100644
--- 
a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/db/DBAddConnection.java
+++ 
b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/db/DBAddConnection.java
@@ -96,9 +96,6 @@ public class DBAddConnection extends CodeActionsProvider {
 
     @Override
     public CompletableFuture<Object> processCommand(NbCodeLanguageClient 
client, String command, List<Object> arguments) {
-        if (!DB_ADD_CONNECTION.equals(command)) {
-            return null;
-        }
         InputService.Registry inputServiceRegistry = 
Lookup.getDefault().lookup(InputService.Registry.class);
         if (inputServiceRegistry == null) {
             return null;
diff --git 
a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/db/DBCommandProvider.java
 
b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/db/DBCommandProvider.java
index 9a75a82143..845b8af04e 100644
--- 
a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/db/DBCommandProvider.java
+++ 
b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/db/DBCommandProvider.java
@@ -57,9 +57,6 @@ public class DBCommandProvider extends CodeActionsProvider {
 
     @Override
     public CompletableFuture<Object> processCommand(NbCodeLanguageClient 
client, String command, List<Object> arguments) {
-        if (!COMMAND_GET_PREFERRED_CONNECTION.equals(command)) {
-            return null;
-        }
         TreeNodeRegistry r = 
Lookup.getDefault().lookup(TreeNodeRegistry.class);
         DatabaseConnection conn = 
ConnectionManager.getDefault().getPreferredConnection(true);
         if (conn == null || r == null) {
diff --git 
a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/db/DBConnectionProvider.java
 
b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/db/DBConnectionProvider.java
index 4f8d6e338e..09e2176663 100644
--- 
a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/db/DBConnectionProvider.java
+++ 
b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/db/DBConnectionProvider.java
@@ -55,9 +55,6 @@ public class DBConnectionProvider extends CodeActionsProvider{
     
     @Override
     public CompletableFuture<Object> processCommand(NbCodeLanguageClient 
client, String command, List<Object> arguments) {
-        if (!GET_DB_CONNECTION.equals(command)) {
-            return null;
-        }
         Map<String, String> result = new HashMap<> ();
         DatabaseConnection conn = 
ConnectionManager.getDefault().getPreferredConnection(true);
 
diff --git 
a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/explorer/NodeActionsProvider.java
 
b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/explorer/NodeActionsProvider.java
index b583025c98..a786638561 100644
--- 
a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/explorer/NodeActionsProvider.java
+++ 
b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/explorer/NodeActionsProvider.java
@@ -96,9 +96,6 @@ public class NodeActionsProvider extends CodeActionsProvider {
     
     @Override
     public CompletableFuture<Object> processCommand(NbCodeLanguageClient 
client, String command, List<Object> arguments) {
-        if (!command.startsWith(NBLS_ACTION_PREFIX)) {
-            return CompletableFuture.completedFuture(false);
-        }
         JsonElement el = null;
         if (arguments.size() > 0) {
             JsonObject item = gson.fromJson(gson.toJson(arguments.get(0)), 
JsonObject.class);
diff --git 
a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/explorer/NodePropertiesProvider.java
 
b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/explorer/NodePropertiesProvider.java
index ab7cb72461..2d74a57288 100644
--- 
a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/explorer/NodePropertiesProvider.java
+++ 
b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/explorer/NodePropertiesProvider.java
@@ -82,9 +82,6 @@ public class NodePropertiesProvider extends 
CodeActionsProvider {
 
     @Override
     public CompletableFuture<Object> processCommand(NbCodeLanguageClient 
client, String command, List<Object> arguments) {
-        if (!COMMANDS.contains(command)) {
-            return CompletableFuture.completedFuture(null);
-        }
         if (arguments == null || arguments.isEmpty()) {
             return CompletableFuture.completedFuture(null);
         }
diff --git 
a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/htmlui/WebView.java
 
b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/htmlui/WebView.java
index 799fc21f98..2e7918b2c6 100644
--- 
a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/htmlui/WebView.java
+++ 
b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/htmlui/WebView.java
@@ -380,7 +380,7 @@ public class WebView implements Closeable {
 
         @Override
         public CompletableFuture<Object> processCommand(NbCodeLanguageClient 
client, String command, List<Object> arguments) {
-            if (PROCESS_COMMAND.equals(command) && arguments != null && 
!arguments.isEmpty()) {
+            if (arguments != null && !arguments.isEmpty()) {
                 final Map m = gson.fromJson((JsonObject) arguments.get(0), 
Map.class);
                 final String id = (String) m.get(ID);
                 if (id != null) {
diff --git 
a/java/java.lsp.server/test/unit/src/org/netbeans/modules/java/lsp/server/protocol/ServerTest.java
 
b/java/java.lsp.server/test/unit/src/org/netbeans/modules/java/lsp/server/protocol/ServerTest.java
index 1c837dc2c3..4a7645dbca 100644
--- 
a/java/java.lsp.server/test/unit/src/org/netbeans/modules/java/lsp/server/protocol/ServerTest.java
+++ 
b/java/java.lsp.server/test/unit/src/org/netbeans/modules/java/lsp/server/protocol/ServerTest.java
@@ -248,11 +248,8 @@ public class ServerTest extends NbTestCase {
 
         @Override
         public CompletableFuture<Object> processCommand(NbCodeLanguageClient 
client, String command, List<Object> arguments) {
-            if (COMMAND_EXTRACT_LOOKUP.equals(command)) {
-                commandLookup = Lookup.getDefault();
-                return CompletableFuture.completedFuture(true);
-            }
-            return null;
+            commandLookup = Lookup.getDefault();
+            return CompletableFuture.completedFuture(true);
         }
     }
     @Override
@@ -5429,10 +5426,6 @@ public class ServerTest extends NbTestCase {
         
         @Override
         public CompletableFuture<Object> processCommand(NbCodeLanguageClient 
client, String command, List<Object> arguments) {
-            if (!command.equals("_progressCommand")) {
-                return null;
-            }
-
             return CompletableFuture.<Object>supplyAsync(() -> {
                 ProgressHandle h = ProgressHandle.createHandle("Test Command", 
this::cancel);
                 try {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org
For additional commands, e-mail: commits-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to