Skip to content

Commit 1d52901

Browse files
travkin79rubenporras
authored andcommitted
Introduce a self-explaining convenience method for empty images
1 parent c6e17a6 commit 1d52901

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

org.eclipse.lsp4e/src/org/eclipse/lsp4e/ui/LSPImages.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,15 @@ private record ImageWithOverlaysKey(String baseImageKey,
239239
@Nullable ImageDescriptor overlayBottomLeftDescriptor, @Nullable ImageDescriptor overlayBottomRightDescriptor,
240240
@Nullable ImageDescriptor underlayDescriptor) {}
241241

242+
/**
243+
* Returns an empty fallback image f(16x16 pixels).
244+
*
245+
* @return an empty 16x16 icon
246+
*/
247+
public static Image getEmptyImage() {
248+
return EMPTY_IMAGE;
249+
}
250+
242251
/**
243252
* Returns the <code>Image</code> identified by the given key, or <code>null</code> if it does not exist.
244253
*/
@@ -303,7 +312,7 @@ public static ImageRegistry getImageRegistry() {
303312
*/
304313
public static @Nullable Image imageFromSymbolKind(@Nullable SymbolKind kind) {
305314
if (kind == null) {
306-
return EMPTY_IMAGE;
315+
return getEmptyImage();
307316
}
308317

309318
String imgKey = imageKeyFromSymbolKind(kind);

org.eclipse.lsp4e/src/org/eclipse/lsp4e/ui/SymbolIconProvider.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,7 @@ protected String getImageKeyFromSymbolKindWithVisibility(SymbolKind kind, List<S
256256
final @Nullable List<SymbolTag> symbolTags, int severity, Object symbol) {
257257

258258
if (symbolKind == null) {
259-
// return empty image
260-
return LSPImages.imageFromSymbolKind(symbolKind);
259+
return LSPImages.getEmptyImage();
261260
}
262261

263262
final List<SymbolTag> finalSymbolTags = symbolTags != null ? symbolTags : Collections.emptyList();

0 commit comments

Comments
 (0)