Skip to content

Commit 28f3897

Browse files
authored
Address design comments. (#42)
1 parent e8cfa95 commit 28f3897

File tree

4 files changed

+36
-13
lines changed

4 files changed

+36
-13
lines changed

jdtls.ext/com.microsoft.jdtls.ext.core/src/com/microsoft/jdtls/ext/core/PackageCommand.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ private static List<PackageNode> getContainers(PackageParams query, IProgressMon
113113
try {
114114
entry = JavaCore.getResolvedClasspathEntry(entry);
115115
IClasspathContainer container = JavaCore.getClasspathContainer(entry.getPath(), javaProject);
116+
// HACK: There is an initialization issue for the first container.
117+
if (container == null) {
118+
container = JavaCore.getClasspathContainer(entry.getPath(), javaProject);
119+
}
120+
116121
if (container != null) {
117122
return new ContainerNode(container.getDescription(), container.getPath().toPortableString(), NodeKind.CONTAINER,
118123
entry.getEntryKind());

package.json

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,7 @@
3535
{
3636
"command": "java.project.create",
3737
"title": "Create Java Project",
38-
"category": "Java",
39-
"icon": {
40-
"dark": "images/dark/icon-create.svg",
41-
"light": "images/light/icon-create.svg"
42-
}
38+
"category": "Java"
4339
},
4440
{
4541
"command": "java.view.package.refresh",
@@ -51,25 +47,31 @@
5147
}
5248
}
5349
],
50+
"configuration": {
51+
"type": "object",
52+
"title": "Java Dependency Configuration",
53+
"properties": {
54+
"java.dependency.showOutline": {
55+
"type": "boolean",
56+
"description": "Enable show outline in the Java Dependency explorer",
57+
"default": false
58+
}
59+
}
60+
},
5461
"menus": {
5562
"view/title": [
56-
{
57-
"command": "java.project.create",
58-
"when": "view == javaProjectExplorer",
59-
"group": "navigation@0"
60-
},
6163
{
6264
"command": "java.view.package.refresh",
6365
"when": "view == javaProjectExplorer",
64-
"group": "navigation@1"
66+
"group": "navigation@0"
6567
}
6668
]
6769
},
6870
"views": {
6971
"explorer": [
7072
{
7173
"id": "javaProjectExplorer",
72-
"name": "Java Packages"
74+
"name": "Java Dependency"
7375
}
7476
]
7577
}
@@ -103,4 +105,4 @@
103105
"vscode-extension-telemetry": "0.0.17",
104106
"xml2js": "^0.4.19"
105107
}
106-
}
108+
}

src/settings.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT license.
3+
4+
import { workspace, WorkspaceConfiguration } from "vscode";
5+
6+
export class Settings {
7+
public static showOutline(): boolean {
8+
return this._debugSettingsRoot.get("showOutline");
9+
}
10+
11+
private static _debugSettingsRoot: WorkspaceConfiguration = workspace.getConfiguration("java.dependency");
12+
}

src/views/typeRootNode.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { Commands } from "../commands";
66
import { INodeData } from "../java/nodeData";
77
import { ITypeRootNodeData, TypeRootKind } from "../java/typeRootNodeData";
88
import { Services } from "../services";
9+
import { Settings } from "../settings";
910
import { DataNode } from "./dataNode";
1011
import { ExplorerNode } from "./explorerNode";
1112
import { SymbolNode } from "./symbolNode";
@@ -44,6 +45,9 @@ export class TypeRootNode extends DataNode {
4445
return Services.context.asAbsolutePath("./images/file-type-java.svg");
4546
}
4647
}
48+
protected hasChildren(): boolean {
49+
return Settings.showOutline();
50+
}
4751

4852
private getSymbols(document: TextDocument): Thenable<SymbolInformation[]> {
4953
return commands.executeCommand<SymbolInformation[]>(

0 commit comments

Comments
 (0)