view src/de/codedo/java/editor/ToggleEditorIconHandler.java @ 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.
author Dirk Olmes <dirk@xanthippe.ping.de>
date Sat, 13 Dec 2014 13:54:38 +0100
parents ca07a15b6cc8
children
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;
	}
}