# HG changeset patch # User Dirk Olmes # Date 1441629764 -7200 # Node ID 6287f5e469f128b384aea942a6937ffb32edb58a # Parent dd4ab3c8d143e2b96cbd4b1e387bc50daefb42b0 Reset the title image when an editor is closed. diff -r dd4ab3c8d143 -r 6287f5e469f1 src/de/codedo/java/editor/CodedoJavaEditor.java --- a/src/de/codedo/java/editor/CodedoJavaEditor.java Tue Dec 16 07:38:49 2014 +0100 +++ b/src/de/codedo/java/editor/CodedoJavaEditor.java Mon Sep 07 14:42:44 2015 +0200 @@ -57,13 +57,30 @@ public void toggleTitleImage() { - IEditorInput input = getEditorInput(); - - // this class is registered as Java editor so we should always have a java element here - IJavaElement javaElement = (IJavaElement)input.getAdapter(IJavaElement.class); + IJavaElement javaElement = getJavaElement(); CodedoJavaElementImageProvider imageProvider = Activator.getDefault().getJavaElementImageProvider(); Image newTitleImage = imageProvider.toggleTitleImage(javaElement); setTitleImage(newTitleImage); } + + @Override + public void dispose() + { + CodedoJavaElementImageProvider imageProvider = Activator.getDefault().getJavaElementImageProvider(); + + IJavaElement javaElement = getJavaElement(); + imageProvider.resetTitleImage(javaElement); + + super.dispose(); + } + + private IJavaElement getJavaElement() + { + IEditorInput input = getEditorInput(); + + // this class is registered as Java editor so we should always have a java element here + return (IJavaElement)input.getAdapter(IJavaElement.class); + } + } diff -r dd4ab3c8d143 -r 6287f5e469f1 src/de/codedo/java/editor/CodedoJavaElementImageProvider.java --- a/src/de/codedo/java/editor/CodedoJavaElementImageProvider.java Tue Dec 16 07:38:49 2014 +0100 +++ b/src/de/codedo/java/editor/CodedoJavaElementImageProvider.java Mon Sep 07 14:42:44 2015 +0200 @@ -63,4 +63,9 @@ } return _customTitleImage; } + + public void resetTitleImage(IJavaElement element) + { + _editorsWithCustomTitleImage.remove(element); + } }