Mercurial > hg > de.codedo.java.editor
changeset 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 | fe67b0af9b23 |
children | 935df68696c0 |
files | META-INF/MANIFEST.MF plugin.xml src/de/codedo/java/editor/CodedoJavaEditor.java src/de/codedo/java/editor/CodedoJavaElementImageProvider.java |
diffstat | 4 files changed, 15 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/META-INF/MANIFEST.MF Mon Sep 07 14:49:50 2015 +0200 +++ b/META-INF/MANIFEST.MF Thu Oct 15 09:43:34 2020 +0200 @@ -1,4 +1,5 @@ Manifest-Version: 1.0 +Automatic-Module-Name: de.codedo.java.editor Bundle-ManifestVersion: 2 Bundle-Name: Java Editor with extra icon Bundle-SymbolicName: de.codedo.java.editor;singleton:=true @@ -12,5 +13,5 @@ org.eclipse.jdt.ui, org.eclipse.jdt.core, org.eclipse.core.resources -Bundle-RequiredExecutionEnvironment: JavaSE-1.7 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy
--- a/plugin.xml Mon Sep 07 14:49:50 2015 +0200 +++ b/plugin.xml Thu Oct 15 09:43:34 2020 +0200 @@ -18,26 +18,22 @@ symbolicFontName="org.eclipse.jdt.ui.editors.textfont"> </editor> </extension> - <extension - point="org.eclipse.ui.commands"> + <extension point="org.eclipse.ui.commands"> <command id="de.codedo.java.editor.command.toggleTitleImage" name="Toggle editor icon"> </command> </extension> - <extension - point="org.eclipse.ui.handlers"> + <extension point="org.eclipse.ui.handlers"> <handler class="de.codedo.java.editor.ToggleEditorIconHandler" commandId="de.codedo.java.editor.command.toggleTitleImage"> </handler> </extension> - <extension - point="org.eclipse.ui.menus"> + <extension point="org.eclipse.ui.menus"> <menuContribution locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions"> - <toolbar - id="de.codedo.java.editor.toolbar"> + <toolbar id="de.codedo.java.editor.toolbar"> <command commandId="de.codedo.java.editor.command.toggleTitleImage" icon="icons/icon.png" @@ -48,5 +44,4 @@ </toolbar> </menuContribution> </extension> - </plugin>
--- a/src/de/codedo/java/editor/CodedoJavaEditor.java Mon Sep 07 14:49:50 2015 +0200 +++ b/src/de/codedo/java/editor/CodedoJavaEditor.java Thu Oct 15 09:43:34 2020 +0200 @@ -82,5 +82,4 @@ // this class is registered as Java editor so we should always have a java element here return (IJavaElement)input.getAdapter(IJavaElement.class); } - }
--- a/src/de/codedo/java/editor/CodedoJavaElementImageProvider.java Mon Sep 07 14:49:50 2015 +0200 +++ b/src/de/codedo/java/editor/CodedoJavaElementImageProvider.java Thu Oct 15 09:43:34 2020 +0200 @@ -1,5 +1,6 @@ package de.codedo.java.editor; +import java.io.IOException; import java.io.InputStream; import java.util.HashSet; import java.util.Set; @@ -58,8 +59,14 @@ Image image = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_DEF_VIEW); Device device = image.getDevice(); - InputStream input = getClass().getClassLoader().getResourceAsStream("icons/icon.png"); - _customTitleImage = new Image(device, input); + try (InputStream input = getClass().getClassLoader().getResourceAsStream("icons/icon.png")) + { + _customTitleImage = new Image(device, input); + } + catch (IOException ex) + { + throw new IllegalStateException(ex); + } } return _customTitleImage; }