Skip to content

Commit ba1701a

Browse files
committed
adjusted icons for structural view, added specific icons for stereotypes
1 parent 57bfeb0 commit ba1701a

File tree

3 files changed

+101
-13
lines changed

3 files changed

+101
-13
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2025 Broadcom, Inc.
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+
* https://www.eclipse.org/legal/epl-v10.html
7+
*
8+
* Contributors:
9+
* Broadcom, Inc. - initial API and implementation
10+
*******************************************************************************/
11+
package org.springframework.ide.vscode.boot.java.commands;
12+
13+
import java.util.Map;
14+
15+
public class StereotypeIcons {
16+
17+
public static final Map<String, String> ICONS = Map.ofEntries(
18+
Map.entry("architecture.hexagonal", "debug-breakpoint-data-unverified"),
19+
Map.entry("architecture.hexagonal.Port", "symbol-interface"),
20+
Map.entry("architecture.hexagonal.Adapter", "debug-disconnect"),
21+
Map.entry("architecture.hexagonal.Application", "circuit-board"),
22+
Map.entry("architecture.layered", "layers"),
23+
Map.entry("architecture.onion", "target"),
24+
Map.entry("architecture.onion.Application", "circuit-board"),
25+
Map.entry("architecture.onion.Domain", "?"), // TODO
26+
Map.entry("architecture.onion.Infrastructure", "debug-disconnect"),
27+
Map.entry("ddd.AggregateRoot", "symbol-class"),
28+
Map.entry("ddd.Association", "link"),
29+
Map.entry("ddd.Entity", "symbol-field"),
30+
Map.entry("ddd.Identifier", "lightbulb"),
31+
Map.entry("ddd.Repository", "database"),
32+
Map.entry("ddd.Service", "?"), // TODO
33+
Map.entry("ddd.ValueObject", "symbol-value"),
34+
Map.entry("event.DomainEvent", "bell"),
35+
Map.entry("event.DomainEventHandler", "callhierarchy-incoming"),
36+
37+
Map.entry("org.jmolecules.architecture.hexagonal", "debug-breakpoint-data-unverified"),
38+
Map.entry("org.jmolecules.architecture.hexagonal.Port", "symbol-interface"),
39+
Map.entry("org.jmolecules.architecture.hexagonal.Adapter", "debug-disconnect"),
40+
Map.entry("org.jmolecules.architecture.hexagonal.Application", "circuit-board"),
41+
Map.entry("org.jmolecules.architecture.layered", "layers"),
42+
Map.entry("org.jmolecules.architecture.onion", "target"),
43+
Map.entry("org.jmolecules.architecture.onion.Application", "circuit-board"),
44+
Map.entry("org.jmolecules.architecture.onion.Domain", "?"), // TODO
45+
Map.entry("org.jmolecules.architecture.onion.Infrastructure", "debug-disconnect"),
46+
Map.entry("org.jmolecules.ddd.AggregateRoot", "symbol-class"),
47+
Map.entry("org.jmolecules.ddd.Association", "link"),
48+
Map.entry("org.jmolecules.ddd.Entity", "symbol-field"),
49+
Map.entry("org.jmolecules.ddd.Identifier", "lightbulb"),
50+
Map.entry("org.jmolecules.ddd.Repository", "database"),
51+
Map.entry("org.jmolecules.ddd.Service", "?"), // TODO
52+
Map.entry("org.jmolecules.ddd.ValueObject", "symbol-value"),
53+
Map.entry("org.jmolecules.event.DomainEvent", "bell"),
54+
Map.entry("org.jmolecules.event.DomainEventHandler", "callhierarchy-incoming"),
55+
56+
Map.entry("jackson", "bracket"),
57+
Map.entry("java.Exception", "zap"),
58+
Map.entry("jpa", "database"),
59+
Map.entry("spring.Configuration", "gear"),
60+
Map.entry("spring.MessageListener", "callhierarchy-incoming"),
61+
Map.entry("spring.boot", "coffee"),
62+
Map.entry("spring.boot.ConfigurationProperties", "symbol-property"),
63+
Map.entry("spring.data", "database"),
64+
Map.entry("spring.data.rest", "bracket"),
65+
Map.entry("spring.data.rest.Projection", "search"),
66+
Map.entry("spring.EventListener", "callhierarchy-incoming"),
67+
Map.entry("spring.web", "globe"),
68+
Map.entry("spring.web.rest.hypermedia", "link"),
69+
Map.entry("Application", "project"),
70+
Map.entry("Module", "library"),
71+
Map.entry("Packages", "package"),
72+
Map.entry("Method", "symbol-method"),
73+
Map.entry("Type", "symbol-class"),
74+
Map.entry("Stereotype", "record")
75+
);
76+
77+
78+
}

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

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,34 +56,42 @@ public ToolsJsonNodeHandler(LabelProvider<StereotypePackageElement, StereotypePa
5656
this.customHandler = customHandler;
5757
this.current = root;
5858
}
59+
60+
@Override
61+
public void handleStereotype(Stereotype stereotype, NodeContext context) {
62+
63+
String stereotypeID = stereotype.getIdentifier();
64+
String icon = StereotypeIcons.ICONS.containsKey(stereotypeID) ? StereotypeIcons.ICONS.get(stereotypeID) : StereotypeIcons.ICONS.get("Stereotype");
65+
66+
addChild(node -> node
67+
.withAttribute(TEXT, labels.getSterotypeLabel(stereotype))
68+
.withAttribute(ICON, icon)
69+
);
70+
}
5971

6072
@Override
6173
public void handleApplication(StereotypePackageElement application) {
6274
this.root
6375
.withAttribute(TEXT, labels.getApplicationLabel(application))
64-
.withAttribute(ICON, "fa-application");
76+
.withAttribute(ICON, StereotypeIcons.ICONS.get("Application"))
77+
;
6578
}
6679

6780
@Override
6881
public void handlePackage(StereotypePackageElement pkg, NodeContext context) {
6982

7083
addChild(node -> node
71-
.withAttribute(ICON, "fa-package")
72-
.withAttribute(TEXT, labels.getPackageLabel(pkg)));
73-
}
74-
75-
@Override
76-
public void handleStereotype(Stereotype stereotype, NodeContext context) {
77-
78-
addChild(node -> node.withAttribute(ICON, "fa-stereotype")
79-
.withAttribute(TEXT, labels.getSterotypeLabel(stereotype)));
84+
.withAttribute(TEXT, labels.getPackageLabel(pkg))
85+
.withAttribute(ICON, StereotypeIcons.ICONS.get("Packages"))
86+
);
8087
}
8188

8289
@Override
8390
public void handleType(StereotypeClassElement type, NodeContext context) {
8491
addChild(node -> node
8592
.withAttribute(TEXT, labels.getTypeLabel(type))
8693
.withAttribute(LOCATION, type.getLocation())
94+
.withAttribute(ICON, StereotypeIcons.ICONS.get("Type"))
8795
);
8896
}
8997

@@ -92,7 +100,7 @@ public void handleMethod(StereotypeMethodElement method, MethodNodeContext<Stere
92100
addChildFoo(node -> node
93101
.withAttribute(TEXT, labels.getMethodLabel(method, context.getContextualType()))
94102
.withAttribute(LOCATION, method.getLocation())
95-
.withAttribute(ICON, "fa-method")
103+
.withAttribute(ICON, StereotypeIcons.ICONS.get("Method"))
96104
);
97105
}
98106

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ export class StereotypedNode extends SpringNode {
3535
}
3636

3737
computeIcon() {
38-
switch (this.n.attributes.icon) {
38+
return new ThemeIcon(this.n.attributes.icon);
39+
/* switch (this.n.attributes.icon) {
40+
retur
3941
case "fa-named-interface": // specify the case
4042
return new ThemeIcon("symbol-interface");
4143
case "fa-package":
@@ -48,7 +50,7 @@ export class StereotypedNode extends SpringNode {
4850
return new ThemeIcon("symbol-method");
4951
default:
5052
return new ThemeIcon("symbol-class");
51-
}
53+
} */
5254
}
5355

5456
}

0 commit comments

Comments
 (0)