package it.tref.eclipse.wicket.plugin.handlers;
import it.tref.eclipse.wicket.plugin.editors.WicketFunEditor;
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.IWorkbenchWindow;
import org.eclipse.ui.handlers.HandlerUtil;
/**
* Our sample handler extends AbstractHandler, an IHandler base class.
* @see org.eclipse.core.commands.IHandler
* @see org.eclipse.core.commands.AbstractHandler
*/
public class SwitchEditorPropertiesHandler extends AbstractHandler {
/**
* The constructor.
*/
public SwitchEditorPropertiesHandler() {
}
/**
* the command has been executed, so extract extract the needed information
* from the application context.
*/
public Object execute(ExecutionEvent event) throws ExecutionException
{
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
if(window.getActivePage().getActiveEditor() instanceof WicketFunEditor)
{
WicketFunEditor wfe = (WicketFunEditor)window.getActivePage().getActiveEditor();
IEditorPart pe = wfe.getNextPropertiesEditor();
if(pe != null)
wfe.setActiveEditor(pe);
}
return null;
}
}