+++ /dev/null
-package eu.etaxonomy.taxeditor.editor.handler;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.e4.ui.model.application.ui.basic.MPart;
-import org.eclipse.e4.ui.workbench.modeling.EPartService;
-import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
-
-import eu.etaxonomy.taxeditor.editor.AppModelId;
-import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView;
-import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateViewEditorInput;
-import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
-
-public class OpenDerivateViewHandler extends AbstractHandler {
-
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- EPartService partService = TaxeditorStorePlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getService(EPartService.class);
- MPart part = partService.createPart(AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DERIVATE_DERIVATEVIEW);
- part = partService.showPart(part, PartState.ACTIVATE);
- DerivateView derivateView = (DerivateView) part.getObject();
- derivateView.init(new DerivateViewEditorInput());
- return null;
- }
-
-}
+++ /dev/null
-package eu.etaxonomy.taxeditor.handler.defaultHandler;
-
-import java.util.UUID;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.ParameterType;
-import org.eclipse.core.commands.common.NotDefinedException;
-
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
-import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
-
-public abstract class DefaultOpenHandlerBase <T> extends AbstractHandler {
-
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- String commandId = event.getCommand().getId();
- String uuidParameterId = commandId+".uuid";
- //check if uuid parameter is set
- if(event.getParameter(uuidParameterId)!=null){
- Object object = event.getObjectParameterForExecution(uuidParameterId);
- ParameterType parameterType;
- try {
- parameterType = event.getCommand().getParameterType(uuidParameterId);
- if(parameterType.isCompatible(object)){
- T entity = getEntity((UUID) object);
- open(event, entity);
- }
- } catch (NotDefinedException e) {
- MessagingUtils.error(DefaultOpenHandlerBase.class, "Error while opening entity!", e);
- }
- }
- //if not try current selection
- else{
- MessagingUtils.errorDialog("Default Handler", this, "Migrate handler!!!", TaxeditorStorePlugin.PLUGIN_ID, null, false);
-// ISelection selection = HandlerUtil.getCurrentSelection(event);
-// if(selection instanceof IStructuredSelection){
-// open(event, (T) ((IStructuredSelection) selection).getFirstElement());
-// }
- }
- return null;
- }
-
-
- protected abstract T getEntity(UUID uuid);
-
- protected abstract void open(ExecutionEvent event, T entity);
-
-}