Ondrej-Douda commented on code in PR #6079:
URL: https://github.com/apache/netbeans/pull/6079#discussion_r1234266491


##########
java/java.lsp.server/vscode/src/propertiesView/propertiesHtmlBuilder.ts:
##########
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Licensed under the Universal Permissive License v 1.0 as shown at 
https://oss.oracle.com/licenses/upl.
+ */
+import * as vscode from 'vscode';
+import { Properties, Property } from "./controlTypes";
+
+export function makeHtmlForProperties(name: string, nonce: string, scriptUri: 
vscode.Uri, properties: Properties): string {
+    return `<!DOCTYPE html>
+    <html lang="en">
+    
+    <head>
+        <meta charset="UTF-8">
+        <meta name="viewport" content="width=device-width, initial-scale=1.0">
+        <meta http-equiv="Content-Security-Policy" content="default-src 
'none'; script-src 'nonce-${nonce}';">
+        <title>${name}</title>
+    </head>
+    
+    <body>
+        <h1>${name} Properties</h1>
+        <vscode-divider></vscode-divider>
+        <table>
+            ${makePropertiesTable(properties)}
+            <tr>
+                <td colspan="2">
+                </td>
+            </tr>
+            <tr>
+                <td colspan="2" align="right" style="text-align: right;">
+                    <vscode-button id="save" 
appearance="primary">Save</vscode-button>
+                    <vscode-button id="cancel" 
appearance="secondary">Cancel</vscode-button>
+                </td>
+            </tr>
+        </table>
+        <script type="module" nonce="${nonce}" src="${scriptUri}"></script>
+    </body>
+    
+    </html>`
+};
+
+function wrapToTable(name: string, content: string, separator: string = ":"): 
string {
+    return `<tr><td align="right"><b>${name}${separator}</b></td><td 
align="left">${content}</td></tr>`;
+}
+
+function makePropertiesTable(properties: Properties): string {
+    let html = "";
+    for (const prop of properties.props) {
+        html += makePropAccess(prop);
+    }
+    return html;
+}
+
+function makePropAccess(prop: Property): string {
+    let out: string;
+    switch (prop.propType) {
+        case 'java.lang.String':

Review Comment:
   Those values are compile time literals, just aren't runtime bound to 
object...
   It is kindof hard to bind types and enum values safely, will try to include 
this object...



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

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

Reply via email to