7584a8062b24d5208b031e7859a8e7a0d9b25363
[taxeditor.git] / eu.etaxonomy.taxeditor.editor / src / main / java / eu / etaxonomy / taxeditor / editor / handler / defaultHandler / DefaultOpenTaxonEditorForTaxonHandler.java
1 package eu.etaxonomy.taxeditor.editor.handler.defaultHandler;
2 import java.util.UUID;
3
4 import org.eclipse.core.commands.ExecutionEvent;
5 import org.eclipse.ui.PartInitException;
6
7 import eu.etaxonomy.cdm.api.service.ITaxonService;
8 import eu.etaxonomy.cdm.model.taxon.TaxonBase;
9 import eu.etaxonomy.taxeditor.editor.EditorUtil;
10 import eu.etaxonomy.taxeditor.handler.defaultHandler.DefaultOpenHandlerBase;
11 import eu.etaxonomy.taxeditor.model.MessagingUtils;
12 import eu.etaxonomy.taxeditor.store.CdmStore;
13
14
15 public class DefaultOpenTaxonEditorForTaxonHandler extends DefaultOpenHandlerBase<TaxonBase> {
16
17 @Override
18 protected TaxonBase getEntity(UUID uuid) {
19 return CdmStore.getService(ITaxonService.class).load(uuid);
20 }
21
22 @Override
23 protected void open(ExecutionEvent event, TaxonBase entity) {
24 try {
25 EditorUtil.openTaxonBase(entity.getUuid());
26 } catch (PartInitException e) {
27 MessagingUtils.error(DefaultOpenTaxonEditorForTaxonHandler.class, "Could not open taxon editor for taxon/synonym "+entity, e);
28 }
29 }
30
31 }