Skip to content

Commit d35552a

Browse files
Add configuration row to overview & update FAQ (#492)
* Add configuration row to overview & update FAQ * refactor the logic to handle installExtension in overview page
1 parent 7446169 commit d35552a

File tree

4 files changed

+89
-22
lines changed

4 files changed

+89
-22
lines changed

src/getting-started/assets/index.html

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,26 @@ <h5 class="font-weight-light">Feedback Channels</h5>
325325
</blockquote>
326326
<h3 class="font-weight-light">Why do I see the JDK errors?</h3>
327327
<p>
328-
<strong><code>JDK 8+</code> is required</strong> to run VS Code Java! You see this error because we failed to find one on your machine. The <a href="command:java.runtime">JDK Acquisition Guide</a> can help you understand how JDK path is searched and provides download links if you need to install one.
328+
<strong><code>JDK 11+</code> is required</strong> to run VS Code Java! You see this error because we failed to find one on your machine. The <a href="command:java.runtime">Configure Java Runtime</a> guide can help you understand how JDK path is searched and provides download links if you need to install one.
329+
</p>
330+
<h3 class="font-weight-light">Can I run my Java 8 project with JDK 1.8?</h3>
331+
<p>
332+
Yes. JDK 11 requirement is just for running VS Code Java extension itself, you can still configure a different runtime <a href="command:java.helper.openUrl?%22https%3A%2F%2Fcode.visualstudio.com%2Fdocs%2Fjava%2Fjava-project%23_jdk-for-projects%22">JDK for your project</a> via user setting <a href="command:workbench.action.openSettings?%22java.configuration.runtimes%22">"java.configuration.runtimes"</a>. The extension will pick a mapping JDK to compile/run your project according to the compiler version specified by the project build file.
333+
<pre>
334+
"java.configuration.runtimes": [
335+
{
336+
"name": "JavaSE-1.8",
337+
"path": "/usr/local/jdk1.8.0_201"
338+
},
339+
{
340+
"name": "JavaSE-11",
341+
"path": "/usr/local/jdk-11.0.3",
342+
"sources" : "/usr/local/jdk-11.0.3/lib/src.zip",
343+
"javadoc" : "https://docs.oracle.com/en/java/javase/11/docs/api",
344+
"default": true
345+
}
346+
]
347+
</pre>
329348
</p>
330349
<h3 class="font-weight-light">Why do I see tons of problems and red squiggles?</h3>
331350
<p>
@@ -353,9 +372,13 @@ <h3 class="font-weight-light">Can I use Lombok?</h3>
353372
Yes. You'll need to install the <a href="https://marketplace.visualstudio.com/items?itemName=GabrielBB.vscode-lombok">Lombok</a> extension, which enables VS Code to process Lombok annotations. To learn more about alternatives and details, visit <a href="https://github.com/redhat-developer/vscode-java/wiki/Lombok-support">this page</a>.
354373
</p>
355374
<h3 class="font-weight-light">Can I develop Android apps using VS Code Java?</h3>
356-
<p class="mb-0">
375+
<p>
357376
Sorry, it's not supported now.
358377
</p>
378+
<h3 class="font-weight-light">How to troubleshoot the problems?</h3>
379+
<p class="mb-0">
380+
You could click <b>F1</b> -> <b>Java: Open all log files</b> to get the logs. Also learn more at <a href="https://github.com/redhat-developer/vscode-java/wiki/Troubleshooting">Troubleshooting Guide</a>.
381+
</p>
359382
</div>
360383
</div>
361384
</div>

src/overview/assets/index.html

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</head>
88

99
<body>
10-
<div class="container mt-5 mb-5">
10+
<div class="container mb-5">
1111
<div class="row mb-3">
1212
<div class="col">
1313
<h1>Java Overview</h1>
@@ -152,17 +152,32 @@ <h3 class="font-weight-light">Help</h3>
152152
<div class="col">
153153
<h3 class="font-weight-light">Learn</h3>
154154
<div class="list-group">
155-
<button id="gettingStartedBtn" class="list-group-item list-group-item-action flex-column align-items-start btn btn-link mb-2" title="Open Java Getting Started View">
155+
<button command="java.gettingStarted" class="list-group-item list-group-item-action flex-column align-items-start btn btn-link mb-2 p-2" title="Open Java Getting Started View">
156156
<p class="mb-1">Java Getting Started</p>
157-
<small>Learn 1 min <a href="command:java.gettingStarted?%22%23quick-start-tab%22">Quick Start</a> tutorial, common shortcuts for <a href="command:java.gettingStarted?%22%23code-editing-tab%22">Code Editing</a> and <a href="command:java.gettingStarted?%22%23debugging-tab%22">Debugging</a>, and <a href="command:java.gettingStarted?%22%23faq-tab%22">FAQ</a>.</small>
157+
<small>Learn 1 min <a href="javascript:void(0)" title="Quick Start" command="java.gettingStarted" args='"#quick-start-tab"'>Quick Start</a> tutorial, common shortcuts for <a href="javascript:void(0)" title="Code Editing" command="java.gettingStarted" args='"#code-editing-tab"'>Code Editing</a> and <a href="javascript:void(0)" title="Debugging" command="java.gettingStarted" args='"#debugging-tab"'>Debugging</a>, and <a href="javascript:void(0)" title="FAQ" command="java.gettingStarted" args='"#faq-tab"'>FAQ</a>.</small>
158158
</button>
159-
<a href="command:java.helper.openUrl?%22https%3A%2F%2Fcode.visualstudio.com%2Fdocs%2Fjava%2Fjava-debugging%22" class="list-group-item list-group-item-action flex-column align-items-start btn btn-link mb-2" title="Open Java Debugging Tutorial">
160-
<p class="mb-1">Debugging Tutorial</p>
161-
<small>Learn how to debug Java apps in VS Code.</small>
159+
<button command="java.helper.openUrl" args='"https://code.visualstudio.com/docs/java/java-tutorial"' class="list-group-item list-group-item-action flex-column align-items-start btn btn-link mb-2 p-2" title="Open Java Tutorials">
160+
<p class="mb-1">Java Tutorials</p>
161+
<small>Learn how to <a href="javascript:void(0)" title="Open Java Debugging Tutorial" command="java.helper.openUrl" args='"https://code.visualstudio.com/docs/java/java-debugging"'>debug Java apps</a> and <a href="javascript:void(0)" title="Open Java Testing Tutorial" command="java.helper.openUrl" args='"https://code.visualstudio.com/docs/java/java-testing"'>run JUnit tests</a> in VS Code.</small>
162+
</button>
163+
</div>
164+
</div>
165+
</div>
166+
<div class="row mb-3">
167+
<div class="col">
168+
<h3 class="font-weight-light">Configuration</h3>
169+
<div class="list-group">
170+
<a href="javascript:void(0)" command="java.runtime" class="list-group-item list-group-item-action flex-column align-items-start btn btn-link mb-2 p-2" title="Open Java Runtime Guide">
171+
<p class="mb-1">Configure Java Runtime</p>
172+
<small>Setup JDKs for projects and VS Code Java.</small>
173+
</a>
174+
<a href="javascript:void(0)" command="java.extGuide" class="list-group-item list-group-item-action flex-column align-items-start btn btn-link mb-2 p-2" title="Open Extension Guide">
175+
<p class="mb-1">Extension Guide</p>
176+
<small>Recommended extensions for Java development.</small>
162177
</a>
163-
<a href="command:java.helper.openUrl?%22https%3A%2F%2Fcode.visualstudio.com%2Fdocs%2Fjava%2Fjava-testing%22" class="list-group-item list-group-item-action flex-column align-items-start btn btn-link mb-2" title="Open Java Testing Tutorial">
164-
<p class="mb-1">Run JUnit Tests</p>
165-
<small>Learn how to work with JUnit test cases in VS Code.</small>
178+
<a href="javascript:void(0)" command="workbench.action.openSettings" args='"java."' class="list-group-item list-group-item-action flex-column align-items-start btn btn-link mb-2 p-2" title="Open Java Settings">
179+
<p class="mb-1">Java Settings</p>
180+
<small>Show the Java settings.</small>
166181
</a>
167182
</div>
168183
</div>

src/overview/assets/index.ts

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,43 @@ $("#showWhenUsingJava").change(function () {
4848

4949
function installExtension(extName: string, displayName: string) {
5050
vscode.postMessage({
51-
command: "installExtension",
52-
extName: extName,
53-
displayName: displayName
51+
command: "java.helper.installExtension",
52+
args: [ extName, displayName ],
5453
});
5554
}
5655

5756
$("div[ext] > a").click(function () {
5857
installExtension($(this.parentElement).attr("ext") || "", $(this.parentElement).attr("displayName") || "");
5958
});
6059

61-
$("#gettingStartedBtn").click(function () {
62-
vscode.postMessage({
63-
command: "java.gettingStarted"
64-
});
60+
$("a[command]").click(function (event) {
61+
event.stopPropagation();
62+
63+
const command = $(this).attr("command") || "";
64+
const args = $(this).attr("args") || null;
65+
execCommand(command, args);
66+
});
67+
68+
$("button[command]").click(function () {
69+
const command = $(this).attr("command") || "";
70+
const args = $(this).attr("args") || null;
71+
execCommand(command, args);
6572
});
73+
74+
function execCommand(command: string, jsonArgs: string) {
75+
if (command) {
76+
let args = [];
77+
if (jsonArgs) {
78+
const data = JSON.parse(jsonArgs);
79+
if (Array.isArray(data)) {
80+
args = data;
81+
} else {
82+
args.push(data);
83+
}
84+
}
85+
vscode.postMessage({
86+
command,
87+
args
88+
});
89+
}
90+
}

src/overview/index.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,14 @@ async function initializeOverviewView(context: vscode.ExtensionContext, webviewP
7979
context.subscriptions.push(webviewPanel.webview.onDidReceiveMessage(async (e) => {
8080
if (e.command === "setOverviewVisibility") {
8181
toggleOverviewVisibilityOperation(context, e.visibility);
82-
} else if (e.command === "installExtension") {
83-
await vscode.commands.executeCommand("java.helper.installExtension", e.extName, e.displayName);
84-
} else if (e.command === "java.gettingStarted") {
85-
await vscode.commands.executeCommand("java.gettingStarted");
82+
} else if (e.command) {
83+
sendInfo("", {
84+
referrer: "overview",
85+
command: e.command,
86+
arg: e.args && e.args.length ? e.args[0] : ""
87+
});
88+
89+
await vscode.commands.executeCommand(e.command, ...e.args);
8690
}
8791
}));
8892
}

0 commit comments

Comments
 (0)