Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
cb1000d
Updating HTML/Java API to most recent version 1.7.2
Sep 15, 2021
9028ce1
Including org.netbeans.html.presenter.generic HTML/Java module in the…
Sep 19, 2021
6919f2e
Introducing pluggable HTML viewer SPI
Sep 19, 2021
f517d18
HTML/Java UI API no longer depends on JavaFX and can be used on its own
Sep 20, 2021
683e3d7
Intercept requests to display an HTML UI and show it in VSCode's WebView
Sep 20, 2021
9401aff
Java: Demo HTML UI
Sep 20, 2021
0109977
Command java.html.demo is supported
Sep 20, 2021
0cfa785
Demo of refactoring UI
Sep 20, 2021
8765c56
<base> tag has to be before any other links
Sep 21, 2021
7f84ced
Using enum to represent access modifiers
Sep 22, 2021
a8dbba5
Use @HTMLDialog to display the Hello World UI
Nov 1, 2021
85b4ac2
Merge branch 'master' into jtulach/WebViews
dbalek Nov 4, 2021
54ddd6f
ChangeMethodParameters refactoring modified to use the WebView based UI.
dbalek Nov 5, 2021
93e6ddc
Allow for existing parameters changes.
dbalek Nov 8, 2021
fbe92fe
Merge remote-tracking branch 'origin/master' into jtulach/WebViews
Nov 11, 2021
3d60d40
Making HTML/Java Refactoring UI testable
Nov 16, 2021
a4ff702
NotificationType has one type parameter
Nov 16, 2021
720e9ad
Straightforward way to closeWindow via message to WebView
Nov 16, 2021
345e5c9
Merge branch 'jtulach/WebViews' of github.com:JaroslavTulach/netbeans…
dbalek Nov 22, 2021
e20ca1c
Bringing in BundleNbjavac branch to eliminate ClassCastExceptions fro…
Nov 22, 2021
9cfeb4c
Specify urlOpener as Consumer
Nov 24, 2021
c851ff4
Let the infrastructure render the buttons
Nov 24, 2021
7aec3fa
Notify back when a WebView is closed
Nov 24, 2021
560daf2
Associated lifecycle callback with each HTML view/dialog
Nov 25, 2021
2961f0a
Refactoring/Change Method Parameters Refactoring action to demonstrat…
Nov 25, 2021
276330e
Merge branch 'master' into jtulach/WebViews
dbalek Dec 3, 2021
7b53b63
Testing HTML/Java API 1.7.3
Dec 5, 2021
31baffd
Adjusting the test to Buttons being instantiable
Dec 5, 2021
26a7e32
Using new fully qualified name of org.netbeans.html.presenters.spi OS…
Dec 5, 2021
1f8a5cf
OnSubmit callback to validate non-blocking dialog
Dec 6, 2021
2e15163
Replace the state machine by chain of Runnables
Dec 6, 2021
7f2c85c
Keeping just HtmlViewer in the SPI of htmlui module
Dec 6, 2021
7fd7d7b
Moving HTML UI Implementation into unique package
Dec 7, 2021
1244c27
Documenting the HTMLViewerSpi
Dec 7, 2021
c273302
Bringing up-to-date with master
Dec 7, 2021
f8b6a99
Merging in with PR-3357 to eliminate future merge conflicts.
Dec 7, 2021
2295fea
Merge after integration of #3357
Dec 8, 2021
80834d4
No need for using special repository, HTML/Java 1.7.3 has already mad…
Dec 8, 2021
24cb4da
Open the server port only to localhost
Dec 9, 2021
e91bdcb
Prefixing each page with random prefix. Closing the server on mismatch
Dec 9, 2021
cec6f18
Adding Apache license to HTML related files
Dec 9, 2021
7875578
Let the client and server exchange showHtmlPageSupport capability and…
Dec 9, 2021
a469d85
Make sure relative files like codicon.css and codicon.ttf are properl…
Dec 9, 2021
a65a7de
Sincing with 9bc1429686ea3 of HTML/Java SimpleServer
Dec 9, 2021
56f4b9c
codicon.tff and codicon.css comes from https://github.com/microsoft/v…
Dec 9, 2021
0fa85ce
Merging in changes from #3361
Dec 9, 2021
6e53de8
Finally merging with master that contains #3357 as well as #3361
Dec 10, 2021
836ddb2
Avoid needless changes against master
Dec 10, 2021
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/*
* 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.refactoring;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import javax.lang.model.element.Element;
import javax.lang.model.element.ElementKind;
import javax.lang.model.element.ExecutableElement;
import org.netbeans.api.java.source.ElementHandle;
import org.netbeans.api.java.source.JavaSource;
import org.openide.awt.ActionID;
import org.openide.awt.ActionReference;
import org.openide.awt.ActionRegistration;
import org.openide.filesystems.FileObject;
import org.openide.util.NbBundle.Messages;

@ActionID(
category = "Refactoring",
id = "org.netbeans.modules.java.lsp.server.refactoring.ChangeMethodParametersRefactoringAction"
)
@ActionRegistration(
iconBase = "org/netbeans/modules/java/lsp/server/refactoring/newHTML.png",
displayName = "#CTL_ChangeMethodParametersRefactoringAction"
)
@ActionReference(path = "Menu/Refactoring", position = 1120)
@Messages("CTL_ChangeMethodParametersRefactoringAction=Change Method Parameters Refactoring")
public final class ChangeMethodParametersRefactoringAction implements ActionListener {
private final FileObject file;

public ChangeMethodParametersRefactoringAction(FileObject file) {
this.file = file;
}

@Override
public void actionPerformed(ActionEvent evt) {
JavaSource js = JavaSource.forFileObject(file);
if (js != null) {
try {
js.runUserActionTask(ci -> {
ci.toPhase(JavaSource.Phase.ELEMENTS_RESOLVED);
ExecutableElement method = null;
METHOD: for (Element type : ci.getTopLevelElements()) {
for (Element e : type.getEnclosedElements()) {
System.err.println("e: " + e);
if (e.getKind() == ElementKind.METHOD) {
method = (ExecutableElement) e;
break METHOD;
}
}
}
if (method != null) {
ElementHandle<ExecutableElement> handle = ElementHandle.create(method);
Pages.showChangeMethodParametersUI(ci, null, file, handle, method);
}
}, true);
} catch (IOException ex) {
throw new IllegalStateException(ex);
}
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<!--

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.

-->
<html>
<head>
<title>TestHtmlUI</title>
<meta charset="UTF-8">
</head>
<body>
<div data-bind="template: templateName"></div>

<!-- UI of the main window -->
<script type="text/html" id="window">
<input data-bind="textInput: text"></input>
<button data-bind="click: showDialog, enable: text">Ask!</button>
</script>

<!-- UI of the dialog -->
<script type="text/html" id="dialog">
<div><span data-bind="text: text"></span> How are you?</div>
<!-- you need to check the checkbox to enabled the OK button -->
<input type="checkbox" data-bind="checked: ok">OK?<br>
<!-- next button is enabled when the checkbox is checked -->
<button id='OK' hidden data-bind="enable: ok">Good</button>
<button id='BAD' hidden>Bad</button>
</script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
/*
* 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.refactoring.ui;

import net.java.html.json.Model;
import net.java.html.json.Function;
import net.java.html.json.Property;
import net.java.html.json.ComputedProperty;
import org.netbeans.api.htmlui.OpenHTMLRegistration;
import org.netbeans.api.htmlui.HTMLDialog;
import org.openide.util.NbBundle;
import org.openide.awt.ActionID;
import org.openide.awt.ActionReference;
import org.openide.awt.ActionReferences;

/**
* HTML page which displays a window and also a dialog.
*/
@Model(className = "TestHtmlUI", targetId = "", properties = {
@Property(name = "text", type = String.class)
})
public final class TestHtmlUICntrl {

@ComputedProperty
static String templateName() {
return "window";
}

@Function
static void showDialog(TestHtmlUI model) {
String reply = Pages.showTestHtmlUIDialog(model.getText());
if ("OK".equals(reply)) {
model.setText("Happy World!");
} else {
model.setText("Sad World!");
}
}

@ActionID(
category = "Tools",
id = "org.netbeans.modules.java.lsp.server.refactoring.ui.TestHtmlUI"
)
@ActionReferences({
@ActionReference(path = "Menu/Refactoring", position = 1125)
})
@NbBundle.Messages("CTL_TestHtmlUI=Open HTML Hello World!")
@OpenHTMLRegistration(
url = "TestHtmlUI.html",
displayName = "#CTL_TestHtmlUI"
//, iconBase="SET/PATH/TO/ICON/HERE"
)
public static TestHtmlUI onPageLoad() {
return new TestHtmlUI("Hello World!").applyBindings();
}

//
// dialog UI
//
@HTMLDialog(url = "TestHtmlUI.html")
static void showTestHtmlUIDialog(String t) {
new TestHtmlUIDialog(t, false).applyBindings();
}

@Model(className = "TestHtmlUIDialog", targetId = "", properties = {
@Property(name = "text", type = String.class),
@Property(name = "ok", type = boolean.class),})
static final class DialogCntrl {

@ComputedProperty
static String templateName() {
return "dialog";
}
}
}