package ch.fusun.baron.map.ui.handlers;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.IHandler;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.handlers.HandlerUtil;
import ch.fusun.baron.map.ui.views.MapView;
/**
* Turns map counterclockwise
*/
public class TurnMapHandlerCounterClockWise extends AbstractHandler implements
IHandler {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchWindow window = HandlerUtil
.getActiveWorkbenchWindowChecked(event);
IViewPart view = window.getActivePage().findView(MapView.ID);
if (view instanceof MapView) {
((MapView) view).turnCounterClockWise();
}
return null;
}
}