Skip to content

Commit 0207219

Browse files
add a helper command to get the jdt platform settings (microsoft#326)
Signed-off-by: Jinbo Wang <jinbwan@microsoft.com>
1 parent 32f3a1f commit 0207219

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

com.microsoft.java.debug.plugin/plugin.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<command id="vscode.java.resolveBuildFiles"/>
1818
<command id="vscode.java.isOnClasspath"/>
1919
<command id="vscode.java.resolveJavaExecutable"/>
20+
<command id="vscode.java.fetchPlatformSettings"/>
2021
</delegateCommandHandler>
2122
</extension>
2223
</plugin>

com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/plugin/internal/JavaDebugDelegateCommandHandler.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public class JavaDebugDelegateCommandHandler implements IDelegateCommandHandler
4444
public static final String RESOLVE_BUILD_FILES = "vscode.java.resolveBuildFiles";
4545
public static final String IS_ON_CLASSPATH = "vscode.java.isOnClasspath";
4646
public static final String RESOLVE_JAVA_EXECUTABLE = "vscode.java.resolveJavaExecutable";
47+
public static final String FETCH_PLATFORM_SETTINGS = "vscode.java.fetchPlatformSettings";
4748

4849
@Override
4950
public Object executeCommand(String commandId, List<Object> arguments, IProgressMonitor progress) throws Exception {
@@ -81,6 +82,8 @@ public Object executeCommand(String commandId, List<Object> arguments, IProgress
8182
return isOnClasspath(arguments);
8283
case RESOLVE_JAVA_EXECUTABLE:
8384
return ResolveJavaExecutableHandler.resolveJavaExecutable(arguments);
85+
case FETCH_PLATFORM_SETTINGS:
86+
return PlatformSettings.getPlatformSettings();
8487
default:
8588
break;
8689
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2020 Microsoft Corporation and others.
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v1.0
5+
* which accompanies this distribution, and is available at
6+
* http://www.eclipse.org/legal/epl-v10.html
7+
*
8+
* Contributors:
9+
* Microsoft Corporation - initial API and implementation
10+
*******************************************************************************/
11+
12+
package com.microsoft.java.debug.plugin.internal;
13+
14+
import java.util.HashMap;
15+
import java.util.Map;
16+
17+
import org.eclipse.jdt.core.JavaCore;
18+
19+
public class PlatformSettings {
20+
21+
/**
22+
* Resolve the JDT platform settings.
23+
*/
24+
public static Map<String, String> getPlatformSettings() {
25+
Map<String, String> result = new HashMap<>();
26+
result.put("latestSupportedJavaVersion", JavaCore.latestSupportedJavaVersion());
27+
return result;
28+
}
29+
}

0 commit comments

Comments
 (0)