Merge branch 'hotfix/5.45.1'
[taxeditor.git] / eu.etaxonomy.taxeditor.editor / src / main / java / eu / etaxonomy / taxeditor / editor / handler / defaultHandler / DefaultOpenTaxonEditorForTaxonBaseHandler.java
1 /**
2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
5 *
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
8 */
9 package eu.etaxonomy.taxeditor.editor.handler.defaultHandler;
10
11 import java.util.UUID;
12
13 import org.eclipse.e4.ui.workbench.modeling.EPartService;
14 import org.eclipse.swt.widgets.Shell;
15
16 import eu.etaxonomy.cdm.model.taxon.TaxonBase;
17 import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
18 import eu.etaxonomy.taxeditor.editor.AppModelId;
19 import eu.etaxonomy.taxeditor.editor.EditorUtil;
20 import eu.etaxonomy.taxeditor.handler.defaultHandler.e4.DefaultOpenHandlerBaseE4;
21
22 public class DefaultOpenTaxonEditorForTaxonBaseHandler
23 extends DefaultOpenHandlerBaseE4<TaxonBase, UuidAndTitleCache<TaxonBase>> {
24
25 @Override
26 protected void open(UuidAndTitleCache<TaxonBase> entity, Shell shell, EPartService partService) throws Exception {
27 UUID uuid = entity.getUuid();
28 EditorUtil.openTaxonBaseE4(uuid, modelService, partService, application);
29 }
30
31 @Override
32 protected boolean canExecute(UuidAndTitleCache<TaxonBase> entity) {
33 if (TaxonBase.class.isAssignableFrom(entity.getType())) {
34 return true;
35 }
36 return false;
37 }
38
39 @Override
40 protected String getPartId() {
41 return AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_TAXONEDITOR;
42 }
43 }