Mercurial > hg > de.codedo.java.editor
annotate src/de/codedo/java/editor/ToggleEditorIconHandler.java @ 6:6287f5e469f1
Reset the title image when an editor is closed.
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Mon, 07 Sep 2015 14:42:44 +0200 |
parents | f7d908568cfc |
children |
rev | line source |
---|---|
0
ca07a15b6cc8
created a plugin that allows to set a custom icon on a java editor
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
1 package de.codedo.java.editor; |
ca07a15b6cc8
created a plugin that allows to set a custom icon on a java editor
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
2 |
ca07a15b6cc8
created a plugin that allows to set a custom icon on a java editor
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
3 import org.eclipse.core.commands.AbstractHandler; |
ca07a15b6cc8
created a plugin that allows to set a custom icon on a java editor
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
4 import org.eclipse.core.commands.ExecutionEvent; |
ca07a15b6cc8
created a plugin that allows to set a custom icon on a java editor
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
5 import org.eclipse.core.commands.ExecutionException; |
ca07a15b6cc8
created a plugin that allows to set a custom icon on a java editor
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
6 import org.eclipse.ui.IEditorPart; |
ca07a15b6cc8
created a plugin that allows to set a custom icon on a java editor
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
7 import org.eclipse.ui.handlers.HandlerUtil; |
ca07a15b6cc8
created a plugin that allows to set a custom icon on a java editor
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
8 |
ca07a15b6cc8
created a plugin that allows to set a custom icon on a java editor
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
9 public class ToggleEditorIconHandler extends AbstractHandler |
ca07a15b6cc8
created a plugin that allows to set a custom icon on a java editor
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
10 { |
ca07a15b6cc8
created a plugin that allows to set a custom icon on a java editor
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
11 @Override |
ca07a15b6cc8
created a plugin that allows to set a custom icon on a java editor
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
12 public Object execute(ExecutionEvent event) throws ExecutionException |
ca07a15b6cc8
created a plugin that allows to set a custom icon on a java editor
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
13 { |
ca07a15b6cc8
created a plugin that allows to set a custom icon on a java editor
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
14 IEditorPart editorPart = HandlerUtil.getActiveEditor(event); |
1
f7d908568cfc
Install a custom JavaElementImageProvider subclass so that the custom title image stays in place even if the editor icon is decorated e.g. by error markers.
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
0
diff
changeset
|
15 if (editorPart instanceof CodedoJavaEditor) |
f7d908568cfc
Install a custom JavaElementImageProvider subclass so that the custom title image stays in place even if the editor icon is decorated e.g. by error markers.
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
0
diff
changeset
|
16 { |
0
ca07a15b6cc8
created a plugin that allows to set a custom icon on a java editor
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
17 CodedoJavaEditor editor = (CodedoJavaEditor)editorPart; |
ca07a15b6cc8
created a plugin that allows to set a custom icon on a java editor
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
18 editor.toggleTitleImage(); |
ca07a15b6cc8
created a plugin that allows to set a custom icon on a java editor
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
19 } |
ca07a15b6cc8
created a plugin that allows to set a custom icon on a java editor
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
20 return null; |
ca07a15b6cc8
created a plugin that allows to set a custom icon on a java editor
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
21 } |
ca07a15b6cc8
created a plugin that allows to set a custom icon on a java editor
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff
changeset
|
22 } |