comparison src/de/codedo/java/editor/CodedoJavaElementImageProvider.java @ 8:778c251baa66

Anpassungen fuer aktuelles JDK. Input Stream, aus dem das Icon geladen wird, ordentlich schliessen.
author Dirk Olmes <dirk.olmes@codedo.de>
date Thu, 15 Oct 2020 09:43:34 +0200
parents 6287f5e469f1
children 935df68696c0
comparison
equal deleted inserted replaced
7:fe67b0af9b23 8:778c251baa66
1 package de.codedo.java.editor; 1 package de.codedo.java.editor;
2 2
3 import java.io.IOException;
3 import java.io.InputStream; 4 import java.io.InputStream;
4 import java.util.HashSet; 5 import java.util.HashSet;
5 import java.util.Set; 6 import java.util.Set;
6 7
7 import org.eclipse.jdt.core.IJavaElement; 8 import org.eclipse.jdt.core.IJavaElement;
56 if (_customTitleImage == null) 57 if (_customTitleImage == null)
57 { 58 {
58 Image image = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_DEF_VIEW); 59 Image image = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_DEF_VIEW);
59 Device device = image.getDevice(); 60 Device device = image.getDevice();
60 61
61 InputStream input = getClass().getClassLoader().getResourceAsStream("icons/icon.png"); 62 try (InputStream input = getClass().getClassLoader().getResourceAsStream("icons/icon.png"))
62 _customTitleImage = new Image(device, input); 63 {
64 _customTitleImage = new Image(device, input);
65 }
66 catch (IOException ex)
67 {
68 throw new IllegalStateException(ex);
69 }
63 } 70 }
64 return _customTitleImage; 71 return _customTitleImage;
65 } 72 }
66 73
67 public void resetTitleImage(IJavaElement element) 74 public void resetTitleImage(IJavaElement element)