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

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

commit 3f74b396a54c005caf7cbe3deebcb9c11ef39c19
Author: Tomas Hurka <tomas.hu...@gmail.com>
AuthorDate: Tue Jun 20 10:59:47 2023 +0200

    use new version of java.node.properties.* commads
---
 .../vscode/src/propertiesView/propertiesView.ts    | 25 +++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/java/java.lsp.server/vscode/src/propertiesView/propertiesView.ts 
b/java/java.lsp.server/vscode/src/propertiesView/propertiesView.ts
index 627b8ab32c..16d6ffedc5 100644
--- a/java/java.lsp.server/vscode/src/propertiesView/propertiesView.ts
+++ b/java/java.lsp.server/vscode/src/propertiesView/propertiesView.ts
@@ -101,19 +101,34 @@ export class PropertiesView {
 
        private async load() {
                const props = await this.get();
-               if (props.length === 0)
+               if (props.size === 0) {
                        throw new Error("No properties.");
-               this.properties = props[0] as Properties;
+               }
+               
+               this.properties = props.values().next().value;
+               console.log("Props "+this.properties);
        }
 
-       private async get() {
-               return asClass(Array, await 
vscode.commands.executeCommand(PropertiesView.COMMAND_GET_NODE_PROPERTIES, 
this.id));
+       private async get() : Promise<Map<String,Properties>> {
+               let resp = await 
vscode.commands.executeCommand(PropertiesView.COMMAND_GET_NODE_PROPERTIES, 
this.id);
+               if (!resp) {
+                       // TODO - possibly report protocol error ?
+                       return new Map<String, Properties>();
+               }
+               return new Map<String, Properties>(Object.entries(resp));
+               
        }
 
        private save(properties: MessageProp[]) {
+               if (!this.properties) {
+                       return;
+               }
                for (const prop of properties)
                        this.mergeProps(prop, this.properties?.props);
-               
vscode.commands.executeCommand(PropertiesView.COMMAND_SET_NODE_PROPERTIES, 
this.id, [this.properties]);
+               let msg = new Map<String,Properties>();
+               msg.set(this.properties.propName, this.properties);
+
+               
vscode.commands.executeCommand(PropertiesView.COMMAND_SET_NODE_PROPERTIES, 
this.id, msg);
        }
 
        private mergeProps(prop: MessageProp, props?: Property[]): void {


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