Mercurial > hg > de.codedo.java.editor
annotate src/de/codedo/java/editor/ToggleEditorIconHandler.java @ 9:935df68696c0 default tip
Reflection Code in eigene Klasse verschoben.
author | Dirk Olmes <dirk.olmes@codedo.de> |
---|---|
date | Thu, 15 Oct 2020 12:05:06 +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 } |