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/10 13:16:49 UTC

[GitHub] [netbeans] JaroslavTulach commented on a change in pull request #3363: Added more actions to LSP Projects View

JaroslavTulach commented on a change in pull request #3363:
URL: https://github.com/apache/netbeans/pull/3363#discussion_r766665146



##########
File path: java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/explorer/DefaultDecorationsImpl.java
##########
@@ -110,23 +116,52 @@ public TreeItemData createDecorations(Node n, boolean expanded) {
             }
 
             FileObject f = n.getLookup().lookup(FileObject.class);
+            boolean nodeChecked = false;
+            if (f == null) {
+                DataFolder df = n.getLookup().lookup(DataFolder.class);
+                if (df != null) {
+                    f = df.getPrimaryFile();
+                    // Workaround for possible bug in data folder: DataFolder itself and the Fileobject for the folder do not
+                    // have a Node in their Lookups.

Review comment:
       Is it Folder node or Package node? I believe @entlicher (when working on version control system integration?) tried hard to not treat Package node as regular `FileObject`, but rather a "flat" folder. 

##########
File path: java/java.lsp.server/nbcode/integration/src/META-INF/services/org.openide.explorer.ExtendedDelete
##########
@@ -0,0 +1,19 @@
+# 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.
+
+# Suppress refactoring-aware delete as its UI is not suitable for LSP yet
+#-org.netbeans.modules.refactoring.spi.impl.SafeDeleteAction

Review comment:
       Good. The `ExtendedDelete` is really a horrible pattern. I am not proud for allowing it to get into the platform.

##########
File path: java/java.lsp.server/vscode/package.json
##########
@@ -372,15 +372,22 @@
 				"title": "Compile Workspace",
 				"category": "Java"
 			},
+			{
+				"command": "java.clean.workspace",
+				"title": "Clean Workspace",
+				"category": "Java"
+			},
 			{
 				"command": "java.workspace.new",
 				"title": "New from Template...",
-				"category": "Java"
+				"category": "Java",
+				"icon": "$(new-file)"
 			},
 			{
 				"command": "java.workspace.newproject",
 				"title": "New Project...",
-				"category": "Java"
+				"category": "Java",
+				"icon" : "$(new-folder)"

Review comment:
       What does `${new-folder}` mean?

##########
File path: java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/ProjectActionParams.java
##########
@@ -0,0 +1,72 @@
+/*
+ * 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.protocol;
+
+import org.eclipse.lsp4j.jsonrpc.validation.NonNull;
+import org.eclipse.xtext.xbase.lib.Pure;
+import org.eclipse.xtext.xbase.lib.util.ToStringBuilder;
+
+/**
+ * Describes 1st command parameter for 'java.project.action' generic command.

Review comment:
       That's probably not the ultimate description how things shall work, right? I guess one needs to dig the functionality from elsewhere...

##########
File path: java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/LspTemplateUI.java
##########
@@ -273,9 +286,48 @@ private static String singleSelection(List<QuickPickItem> selectedGroups) {
         }
         return selectedGroups.get(0).getUserData().toString();
     }
+    
+    private static final String ATTR_SOURCE_GROUP = "new.sourceGroup";  // NOI18N
+    private static final String ATTR_SOURCE_HINT = "new.sourceHint"; // NOI18N

Review comment:
       We should start documenting these [magic strings](http://wiki.apidesign.org/wiki/MagicalStrings) somewhere. Especially when we start spreading them outside of the `java.lsp.server` module.
   
   Even if we don't, it should be `<arch stability="private"..../>` as that is an API someone can depend on (but shouldn't).

##########
File path: java/java.lsp.server/vscode/package.json
##########
@@ -464,22 +504,76 @@
 					"when": "nbJavaLSReady"
 				}
 			],
+			"view/title": [
+				{
+					"command": "java.workspace.newproject",
+					"when": "nbJavaLSReady && view == foundProjects",
+					"group": "navigation"
+				},
+				{
+					"command": "java.workspace.compile",
+					"when": "nbJavaLSReady && view == foundProjects"
+				},
+				{
+					"command": "java.clean.workspace",
+					"when": "nbJavaLSReady && view == foundProjects"
+				},
+				{
+					"command": "test-explorer.run-all",
+					"when": "nbJavaLSReady && view == foundProjects"
+				},
+				{
+					"command": "workbench.action.debug.run",
+					"when": "nbJavaLSReady && view == foundProjects"
+				},
+				{
+					"command": "workbench.action.debug.start",
+					"when": "nbJavaLSReady && view == foundProjects"
+				}
+			],
 			"view/item/context": [
 				{
 					"command": "foundProjects.deleteEntry",
 					"when": "view == foundProjects && viewItem == node"
 				},
 				{
 					"command": "nbls:Database:netbeans.db.explorer.action.Connect",
-					"when": "nbJavaLSReady && viewItem =~ /class:ddl.DBConnection/"
+					"when": "viewItem =~ /class:ddl.DBConnection/"
 				},
 				{
 					"command": "nbls:Database:netbeans.db.explorer.action.Disconnect",
-					"when": "nbJavaLSReady && viewItem =~ /class:ddl.DBConnection/"
+					"when": "viewItem =~ /class:ddl.DBConnection/"
 				},
 				{
 					"command": "nbls:Edit:org.openide.actions.DeleteAction",
-					"when": "nbJavaLSReady && viewItem =~ /class:ddl.DBConnection/"
+					"when": "viewItem =~ /cap:delete/"

Review comment:
       What does `=~ /cap:delete/` mean?




-- 
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