Skip to content

Conversation

@JaroslavTulach
Copy link

@JaroslavTulach JaroslavTulach commented Dec 9, 2021

This PR builds on top of #3357 and 9e27e19 (accidentally integrated into master) to deliver the final vision of #3349 - e.g. to display rich HTML user interface for change method parameters refactoring. Most of the changes (like 54ddd6f) were done by Dušan. I might have polished them a bit, however my main task is to squash them into a PR with simpler change history.

obrazek

Should there be any problems with 9e27e19 I am ready to resolve it as part of this PR as soon as possible.

@JaroslavTulach JaroslavTulach added this to the NB13 milestone Dec 9, 2021
@JaroslavTulach JaroslavTulach self-assigned this Dec 9, 2021
JaroslavTulach pushed a commit to JaroslavTulach/netbeans that referenced this pull request Dec 9, 2021
</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.

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

+ "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.

+ "var button = document.createElement('button');\n"
+ "button.id = id;\n"
+ "button.onclick = function() {;\n"
+ " @org.netbeans.modules.java.lsp.server.ui.AbstractLspHtmlViewer::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.

Moved into Buttons class in non-API package.

@Override
public <C> C component(View view, Class<C> type) {
if (type == Void.class) {
load(view);
Copy link
Author

Choose a reason for hiding this comment

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

Thanks, @dbalek , loading the view after newView is finished was one of recent changes. Previously the initialization started sooner then reference to View was returned and that lead to various races. Sometimes it worked, sometimes it deadlocked depending on the order of threads execution. Creating the instance first and initializing later when component(Void.class) is called fixes these races. I have probably forgotten to update the test - but it actually passed fine this morning (probably too positive order of execution).

Copy link
Member

@sdedic sdedic left a comment

Choose a reason for hiding this comment

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

Looks sane, seems to work (change method parameters refactoring)

@JaroslavTulach JaroslavTulach merged commit 8afab70 into apache:master Dec 9, 2021
JaroslavTulach pushed a commit to JaroslavTulach/netbeans that referenced this pull request Dec 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants