Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions java/java.lsp.server/licenseinfo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@
<file>vscode/src/extension.ts</file>
<license ref="MIT-vscode-ext" />
</fileset>
<fileset>
<file>src/org/netbeans/modules/java/lsp/server/refactoring/ui/codicon.ttf</file>
<file>src/org/netbeans/modules/java/lsp/server/refactoring/ui/codicon.css</file>
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These files are taken from Microsoft codicons project. Readme mentions it is MIT licensed and points to standard MIT license.

<license ref="MIT" />
</fileset>
<fileset>
<file>vscode/.vscodeignore</file>
<file>vscode/.eslintrc.json</file>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#Signature file v4.1
#Version 1.10.0
#Version 1.14.0

CLSS public java.lang.Object
cons public init()
Expand All @@ -23,6 +23,35 @@ meth public void notifyLater(org.openide.NotifyDescriptor)
supr org.openide.DialogDisplayer
hfds context

CLSS public org.netbeans.modules.java.lsp.server.ui.AbstractGlobalActionContext
cons public init()
intf org.openide.util.ContextGlobalProvider
intf org.openide.util.Lookup$Provider
meth public org.openide.util.Lookup createGlobalContext()
meth public org.openide.util.Lookup getLookup()
meth public static <%0 extends java.lang.Object> {%%0} withActionContext(org.openide.util.Lookup,java.util.concurrent.Callable<{%%0}>)
supr java.lang.Object
hcls ContextHolder

CLSS public org.netbeans.modules.java.lsp.server.ui.AbstractLspHtmlViewer
cons protected init()
innr protected final View
intf org.netbeans.spi.htmlui.HTMLViewerSpi<org.netbeans.modules.java.lsp.server.ui.AbstractLspHtmlViewer$View,java.lang.Object>
meth public <%0 extends java.lang.Object> {%%0} component(org.netbeans.modules.java.lsp.server.ui.AbstractLspHtmlViewer$View,java.lang.Class<{%%0}>)
meth public java.lang.Object createButton(org.netbeans.modules.java.lsp.server.ui.AbstractLspHtmlViewer$View,java.lang.String)
meth public java.lang.String getId(org.netbeans.modules.java.lsp.server.ui.AbstractLspHtmlViewer$View,java.lang.Object)
meth public org.netbeans.modules.java.lsp.server.ui.AbstractLspHtmlViewer$View newView(org.netbeans.spi.htmlui.HTMLViewerSpi$Context)
meth public void runLater(org.netbeans.modules.java.lsp.server.ui.AbstractLspHtmlViewer$View,java.lang.Runnable)
meth public void setEnabled(org.netbeans.modules.java.lsp.server.ui.AbstractLspHtmlViewer$View,java.lang.Object,boolean)
meth public void setText(org.netbeans.modules.java.lsp.server.ui.AbstractLspHtmlViewer$View,java.lang.Object,java.lang.String)
supr java.lang.Object
hfds initial

CLSS protected final org.netbeans.modules.java.lsp.server.ui.AbstractLspHtmlViewer$View
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sigtest doesn't like private View - making it protected to fix ant gen-sigtests-release problem introduced in 9e27e19

outer org.netbeans.modules.java.lsp.server.ui.AbstractLspHtmlViewer
supr java.lang.Object
hfds ctx,presenter,ui

CLSS public abstract org.netbeans.modules.java.lsp.server.ui.AbstractLspInputOutputProvider
cons protected init()
innr public final static LspIO
Expand Down Expand Up @@ -92,6 +121,7 @@ meth protected abstract java.util.concurrent.CompletableFuture<org.eclipse.lsp4j
meth protected abstract org.openide.awt.StatusDisplayer$Message showStatusMessage(org.netbeans.modules.java.lsp.server.protocol.ShowStatusMessageParams)
meth protected abstract void logMessage(org.eclipse.lsp4j.MessageParams)
meth protected abstract void showMessage(org.eclipse.lsp4j.MessageParams)
meth protected java.util.concurrent.CompletableFuture<java.lang.String> showHtmlPage(org.netbeans.modules.java.lsp.server.protocol.HtmlPageParams)
meth public static org.netbeans.modules.java.lsp.server.ui.UIContext find()
anno 0 org.netbeans.api.annotations.common.NonNull()
meth public static org.netbeans.modules.java.lsp.server.ui.UIContext find(org.openide.util.Lookup)
Expand All @@ -104,6 +134,16 @@ CLSS public abstract interface org.netbeans.modules.progress.spi.ProgressEnviron
meth public abstract org.netbeans.api.progress.ProgressHandle createHandle(java.lang.String,org.openide.util.Cancellable,boolean)
meth public abstract org.netbeans.modules.progress.spi.Controller getController()

CLSS public abstract interface org.netbeans.spi.htmlui.HTMLViewerSpi<%0 extends java.lang.Object, %1 extends java.lang.Object>
innr public final static Context
meth public abstract <%0 extends java.lang.Object> {%%0} component({org.netbeans.spi.htmlui.HTMLViewerSpi%0},java.lang.Class<{%%0}>)
meth public abstract java.lang.String getId({org.netbeans.spi.htmlui.HTMLViewerSpi%0},{org.netbeans.spi.htmlui.HTMLViewerSpi%1})
meth public abstract void runLater({org.netbeans.spi.htmlui.HTMLViewerSpi%0},java.lang.Runnable)
meth public abstract void setEnabled({org.netbeans.spi.htmlui.HTMLViewerSpi%0},{org.netbeans.spi.htmlui.HTMLViewerSpi%1},boolean)
meth public abstract void setText({org.netbeans.spi.htmlui.HTMLViewerSpi%0},{org.netbeans.spi.htmlui.HTMLViewerSpi%1},java.lang.String)
meth public abstract {org.netbeans.spi.htmlui.HTMLViewerSpi%0} newView(org.netbeans.spi.htmlui.HTMLViewerSpi$Context)
meth public abstract {org.netbeans.spi.htmlui.HTMLViewerSpi%1} createButton({org.netbeans.spi.htmlui.HTMLViewerSpi%0},java.lang.String)

CLSS public abstract interface org.netbeans.spi.io.InputOutputProvider<%0 extends java.lang.Object, %1 extends java.io.PrintWriter, %2 extends java.lang.Object, %3 extends java.lang.Object>
meth public abstract boolean isIOClosed({org.netbeans.spi.io.InputOutputProvider%0})
anno 1 org.netbeans.api.annotations.common.NonNull()
Expand Down Expand Up @@ -190,3 +230,27 @@ supr java.lang.Object
hfds INSTANCE
hcls Trivial

CLSS public abstract interface org.openide.util.ContextGlobalProvider
meth public abstract org.openide.util.Lookup createGlobalContext()

CLSS public abstract org.openide.util.Lookup
cons public init()
fld public final static org.openide.util.Lookup EMPTY
innr public abstract interface static Provider
innr public abstract static Item
innr public abstract static Result
innr public final static Template
meth public <%0 extends java.lang.Object> java.util.Collection<? extends {%%0}> lookupAll(java.lang.Class<{%%0}>)
meth public <%0 extends java.lang.Object> org.openide.util.Lookup$Item<{%%0}> lookupItem(org.openide.util.Lookup$Template<{%%0}>)
meth public <%0 extends java.lang.Object> org.openide.util.Lookup$Result<{%%0}> lookupResult(java.lang.Class<{%%0}>)
meth public abstract <%0 extends java.lang.Object> org.openide.util.Lookup$Result<{%%0}> lookup(org.openide.util.Lookup$Template<{%%0}>)
meth public abstract <%0 extends java.lang.Object> {%%0} lookup(java.lang.Class<{%%0}>)
meth public static org.openide.util.Lookup getDefault()
supr java.lang.Object
hfds LOG,defaultLookup,defaultLookupProvider
hcls DefLookup,Empty

CLSS public abstract interface static org.openide.util.Lookup$Provider
outer org.openide.util.Lookup
meth public abstract org.openide.util.Lookup getLookup()

2 changes: 1 addition & 1 deletion java/java.lsp.server/nbproject/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

javac.source=1.8
javac.compilerargs=-Xlint -Xlint:-serial
spec.version.base=1.13.0
spec.version.base=1.14.0
requires.nb.javac=true
lsp.build.dir=vscode/nbcode
test.unit.run.cp.extra=
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/*
* 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.htmlui;

import net.java.html.js.JavaScriptBody;
import org.netbeans.spi.htmlui.HTMLViewerSpi;

/**
* Helper utilities to deal with HTML buttons.
*/
public final class Buttons {
private Buttons() {
}

@JavaScriptBody(args = {}, body = "\n"
+ "const vscode = acquireVsCodeApi();\n" // this method can be called only once per WebView existance
+ "window.close = function() {\n"
+ " vscode.postMessage({\n"
+ " command: 'dispose',\n"
+ " });\n"
+ "};\n"
)
public static native void registerCloseWindow();

@JavaScriptBody(args = { "id", "callback" }, javacall = true, body = "\n"
+ "var first = false;\n"
+ "var footer = document.getElementById('dialog-buttons');\n"
+ "if (!footer) {\n"
+ " first = true\n"
+ " footer = document.createElement('div');\n"
+ " footer.id = 'dialog-buttons';\n"
+ " footer.classList.add('flex');\n"
+ " footer.classList.add('section');\n"
+ " document.body.appendChild(footer);\n"
+ "}\n"
+ "var button = document.createElement('button');\n"
+ "button.id = id;\n"
+ "button.onclick = function() {;\n"
+ " @org.netbeans.modules.java.lsp.server.htmlui.Buttons::clickButton0(Ljava/lang/String;Ljava/lang/Object;)(id, callback);\n"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The HTML/Java API infrastructure generates a callback class $JsCallbacks$ in the same package to be able to call from JavaScript to JVM. We don't want that class in the API - as such I am introducing new Buttons class and moving all @JavaScriptBody methods in here.

+ "};\n"
+ "button.classList.add('regular-button');\n"
+ "button.classList.add('vscode-font');\n"
+ "if (first) {\n"
+ " button.classList.add('align-right');\n"
+ "}\n"
+ "footer.appendChild(button);\n"
+ "return button;\n"
)
public native static Object createButton0(String id, HTMLViewerSpi.Context callback);

static void clickButton0(String id, Object callback) {
HTMLViewerSpi.Context ctx = (HTMLViewerSpi.Context) callback;
ctx.onSubmit(id);
}

@JavaScriptBody(args = { "b" }, body = "return b.id;")
public native static String buttonName0(Object b);

@JavaScriptBody(args = { "b", "text" }, body = "b.innerHTML = text;")
public native static void buttonText0(Object b, String text);

@JavaScriptBody(args = { "b", "disabled" }, body = "return b.disabled = disabled;")
public native static String buttonDisabled0(Object b, boolean disabled);

}
Loading