Skip to content

Commit 5115030

Browse files
committed
UI cleanup
1 parent ddc78d8 commit 5115030

File tree

5 files changed

+16
-320
lines changed

5 files changed

+16
-320
lines changed

headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/commands/SpringIndexCommands.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,13 @@
3737
public class SpringIndexCommands {
3838

3939
private static final String SPRING_STRUCTURE_CMD = "sts/spring-boot/structure";
40-
private static final String SPRING_STRUCTURE_CMD_2 = "sts/spring-boot/structure2";
4140

4241
private final SpringMetamodelIndex springIndex;
4342

4443
public SpringIndexCommands(SimpleLanguageServer server, SpringMetamodelIndex springIndex, JavaProjectFinder projectFinder, StereotypeCatalogRegistry stereotypeCatalogRegistry) {
4544
this.springIndex = springIndex;
4645

47-
server.onCommand(SPRING_STRUCTURE_CMD, params -> server.getAsync().invoke(() -> springIndex.getProjects()));
48-
server.onCommand(SPRING_STRUCTURE_CMD_2, params -> server.getAsync().invoke(() -> {
46+
server.onCommand(SPRING_STRUCTURE_CMD, params -> server.getAsync().invoke(() -> {
4947
return projectFinder.all().stream().map(project -> nodeFrom(stereotypeCatalogRegistry, springIndex, project)).filter(Objects::nonNull).collect(Collectors.toList());
5048
}));
5149
}
@@ -67,7 +65,7 @@ private Node nodeFrom(StereotypeCatalogRegistry stereotypeCatalogRegistry, Sprin
6765
// json output
6866
BiConsumer<Node, Object> consumer = (node, c) -> {
6967
node.withAttribute(HierarchicalNodeHandler.TEXT, labelProvider.getCustomLabel(c))
70-
.withAttribute("icon", "fa-named-interface");
68+
.withAttribute(ToolsJsonNodeHandler.ICON, "fa-named-interface");
7169
};
7270

7371
var jsonHandler = new ToolsJsonNodeHandler(labelProvider, consumer);

headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/commands/ToolsJsonNodeHandler.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@
4242
public class ToolsJsonNodeHandler implements NodeHandler<StereotypePackageElement, StereotypePackageElement, StereotypeClassElement, StereotypeMethodElement, Object> {
4343

4444
private static final String LOCATION = "location";
45-
public static final String ICON = "icon";
46-
public static final String TEXT = "text";
45+
static final String ICON = "icon";
46+
static final String TEXT = "text";
4747

4848
private final Node root;
4949
private final LabelProvider<StereotypePackageElement, StereotypePackageElement, StereotypeClassElement, StereotypeMethodElement, Object> labels;
@@ -92,6 +92,7 @@ public void handleMethod(StereotypeMethodElement method, MethodNodeContext<Stere
9292
addChildFoo(node -> node
9393
.withAttribute(TEXT, labels.getMethodLabel(method, context.getContextualType()))
9494
.withAttribute(LOCATION, method.getLocation())
95+
.withAttribute(ICON, "fa-method")
9596
);
9697
}
9798

vscode-extensions/vscode-spring-boot/lib/explorer/explorer-tree-provider.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import { CancellationToken, commands, Event, EventEmitter, ProviderResult, TreeDataProvider, TreeItem, TreeItemCollapsibleState } from "vscode";
1+
import { Event, EventEmitter, ProviderResult, TreeDataProvider, TreeItem } from "vscode";
22
import { StructureManager } from "./structure-tree-manager";
3-
import { DocumentNode, ProjectNode, SpringNode } from "./nodes";
4-
import * as Path from "path";
3+
import { SpringNode } from "./nodes";
54

65
export class ExplorerTreeProvider implements TreeDataProvider<SpringNode> {
76

vscode-extensions/vscode-spring-boot/lib/explorer/nodes.ts

Lines changed: 5 additions & 213 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { TextDocumentShowOptions, ThemeIcon, TreeItem, TreeItemCollapsibleState, Uri } from "vscode";
2-
import { Location, Position, Range } from "vscode-languageclient";
1+
import { TextDocumentShowOptions, ThemeIcon, TreeItem, TreeItemCollapsibleState } from "vscode";
2+
import { Location } from "vscode-languageclient";
33
import { LsStereoTypedNode } from "./structure-tree-manager";
44

55
export class SpringNode {
@@ -12,216 +12,6 @@ export class SpringNode {
1212
}
1313
}
1414

15-
export class ProjectNode extends SpringNode {
16-
constructor(readonly name: string, children: SpringNode[]) {
17-
super(children);
18-
}
19-
getTreeItem(): TreeItem {
20-
const item = super.getTreeItem();
21-
item.label = this.name;
22-
return item;
23-
}
24-
}
25-
26-
export class DocumentNode extends SpringNode {
27-
constructor(readonly docURI: Uri, children: SpringNode[]) {
28-
super(children);
29-
}
30-
getTreeItem(): TreeItem {
31-
const item = super.getTreeItem();
32-
item.label = undefined; // let VSCode derive the label from the resource URI
33-
item.resourceUri = this.docURI;
34-
item.iconPath = ThemeIcon.File;
35-
return item;
36-
}
37-
}
38-
39-
export class AotProcessorNode extends SpringNode {
40-
constructor(
41-
children: SpringNode[],
42-
readonly type: string,
43-
readonly docUri: Uri
44-
) {
45-
super(children);
46-
}
47-
getTreeItem(): TreeItem {
48-
const item = super.getTreeItem();
49-
item.label = this.type;
50-
item.resourceUri = this.docUri;
51-
return item;
52-
}
53-
}
54-
55-
export class BeanMethodContainerNode extends SpringNode {
56-
constructor(
57-
children: SpringNode[],
58-
readonly type: string,
59-
readonly location: Location,
60-
) {
61-
super(children);
62-
}
63-
getTreeItem(): TreeItem {
64-
const item = super.getTreeItem();
65-
item.label = this.type;
66-
return item;
67-
}
68-
}
69-
70-
export class BeanRegistrarNode extends SpringNode {
71-
constructor(
72-
children: SpringNode[],
73-
readonly name: string,
74-
readonly type: string,
75-
readonly location: Location,
76-
) {
77-
super(children);
78-
}
79-
getTreeItem(): TreeItem {
80-
const item = super.getTreeItem();
81-
item.label = this.name;
82-
return item;
83-
}
84-
}
85-
86-
export class ConfigPropertyNode extends SpringNode {
87-
constructor(
88-
children: SpringNode[],
89-
readonly name: string,
90-
readonly type: string,
91-
readonly range: Range
92-
) {
93-
super(children);
94-
}
95-
getTreeItem(): TreeItem {
96-
const item = super.getTreeItem();
97-
item.label = this.name;
98-
return item;
99-
}
100-
}
101-
102-
export class EventListenerNode extends SpringNode {
103-
constructor(
104-
children: SpringNode[],
105-
readonly eventType: string,
106-
readonly location: Location,
107-
readonly containerBeanType: string,
108-
readonly annotations: AnnotationMetadata[]
109-
) {
110-
super(children);
111-
}
112-
getTreeItem(): TreeItem {
113-
const item = super.getTreeItem();
114-
item.label = this.eventType;
115-
return item;
116-
}
117-
}
118-
119-
export class EventPublisherNode extends SpringNode {
120-
constructor(
121-
children: SpringNode[],
122-
readonly eventType: string,
123-
readonly location: Location,
124-
readonly eventTypesFromHierarchy: string[]
125-
) {
126-
super(children);
127-
}
128-
getTreeItem(): TreeItem {
129-
const item = super.getTreeItem();
130-
item.label = this.eventType;
131-
return item;
132-
}
133-
}
134-
135-
export class QueryMethodNode extends SpringNode {
136-
constructor(
137-
children: SpringNode[],
138-
readonly methodName: string,
139-
readonly queryString: string,
140-
readonly range: Range
141-
) {
142-
super(children);
143-
}
144-
getTreeItem(): TreeItem {
145-
const item = super.getTreeItem();
146-
item.label = this.methodName;
147-
return item;
148-
}
149-
}
150-
151-
export class RequestMappingNode extends SpringNode {
152-
constructor(
153-
children: SpringNode[],
154-
readonly path: string,
155-
readonly httpMethods: string[],
156-
readonly contentTypes: string[],
157-
readonly acceptTypes: string[],
158-
readonly symbolLabel: string,
159-
readonly range: Range
160-
) {
161-
super(children);
162-
}
163-
getTreeItem(): TreeItem {
164-
const item = super.getTreeItem();
165-
item.label = this.path;
166-
return item;
167-
}
168-
}
169-
170-
export class WebfluxRoutesNode extends RequestMappingNode {
171-
constructor(
172-
children: SpringNode[],
173-
path: string,
174-
httpMethods: string[],
175-
contentTypes: string[],
176-
acceptTypes: string[],
177-
symbolLabel: string,
178-
range: Range,
179-
readonly ranges: Range[]
180-
) {
181-
super(children, path, httpMethods, contentTypes, acceptTypes, symbolLabel, range);
182-
}
183-
}
184-
185-
export class BeanNode extends SpringNode {
186-
constructor(
187-
children: SpringNode[],
188-
readonly name: string,
189-
readonly type: string,
190-
readonly location: Location,
191-
readonly injectionPoints: InjectionPoint[],
192-
readonly supertypes: string[],
193-
readonly annotations: AnnotationMetadata[],
194-
readonly isConfiguration: boolean,
195-
readonly symbolLabel: string
196-
) {
197-
super(children);
198-
}
199-
getTreeItem(): TreeItem {
200-
const item = super.getTreeItem();
201-
item.label = this.name;
202-
return item;
203-
}
204-
}
205-
206-
export interface InjectionPoint {
207-
readonly name: string;
208-
readonly type: string;
209-
readonly location: Location;
210-
readonly annotations: AnnotationMetadata[];
211-
}
212-
213-
export interface AnnotationMetadata {
214-
readonly annotationType: string;
215-
readonly isMetaAnnotation: boolean;
216-
readonly location: Location;
217-
readonly attributes: {[key: string]: AnnotationAttributeValue[]};
218-
}
219-
220-
export interface AnnotationAttributeValue {
221-
readonly name: string;
222-
readonly location: Location;
223-
}
224-
22515
export class StereotypedNode extends SpringNode {
22616
constructor(private n: LsStereoTypedNode, children: SpringNode[]) {
22717
super(children);
@@ -253,7 +43,9 @@ export class StereotypedNode extends SpringNode {
25343
case "fa-stereotype":
25444
return new ThemeIcon("symbol-class");
25545
case "fa-application":
256-
return new ThemeIcon("folder");
46+
return new ThemeIcon("folder");
47+
case "fa-method":
48+
return new ThemeIcon("symbol-method");
25749
default:
25850
return new ThemeIcon("symbol-object");
25951
}

0 commit comments

Comments
 (0)