view src/de/codedo/java/editor/ToggleEditorIconHandler.java @ 0:ca07a15b6cc8

created a plugin that allows to set a custom icon on a java editor
author Dirk Olmes <dirk@xanthippe.ping.de>
date Thu, 23 Oct 2014 22:20:08 +0200
parents
children f7d908568cfc
line wrap: on
line source

package de.codedo.java.editor;

import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.handlers.HandlerUtil;

public class ToggleEditorIconHandler extends AbstractHandler
{
	@Override
	public Object execute(ExecutionEvent event) throws ExecutionException 
	{
		IEditorPart editorPart = HandlerUtil.getActiveEditor(event);
		if (editorPart instanceof CodedoJavaEditor) {
			CodedoJavaEditor editor = (CodedoJavaEditor)editorPart;
			editor.toggleTitleImage();
		}
		return null;
	}
}