Project

General

Profile

Download (2.01 KB) Statistics
| Branch: | Tag: | Revision:
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 org.eclipse.e4.ui.workbench.modeling.EPartService;
12
import org.eclipse.jface.viewers.IStructuredSelection;
13
import org.eclipse.swt.widgets.Shell;
14

    
15
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
16
import eu.etaxonomy.taxeditor.editor.AppModelId;
17
import eu.etaxonomy.taxeditor.editor.EditorUtil;
18
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
19
import eu.etaxonomy.taxeditor.handler.defaultHandler.e4.DefaultOpenHandlerBaseE4;
20
import eu.etaxonomy.taxeditor.model.MessagingUtils;
21

    
22
public class DefaultOpenTaxonEditorForTaxonNodeHandler
23
        extends DefaultOpenHandlerBaseE4<TaxonNodeDto> {
24

    
25
    @Override
26
    protected void open(TaxonNodeDto entity, Shell shell, EPartService partService) {
27
        try {
28
            EditorUtil.openTaxonNodeE4(entity.getUuid(), modelService, partService, application);
29
        } catch (Exception e) {
30
            MessagingUtils.error(DefaultOpenTaxonEditorForTaxonNodeHandler.class, Messages.DefaultOpenTaxonEditorForTaxonNodeHandler_COULD_NOT_OPEN + entity.getTaxonTitleCache(), e);
31
        }
32
    }
33

    
34
    @Override
35
    protected boolean canExecute(Object selection) {
36
        if (selection instanceof IStructuredSelection &&
37
                ((IStructuredSelection)selection).getFirstElement() instanceof TaxonNodeDto){
38
            return ((TaxonNodeDto)((IStructuredSelection)selection).getFirstElement()).getTaxonUuid() != null;
39
        }
40
        return false ;
41
//        boolean hasPermission = CdmStore.currentAuthentiationHasPermission(entity, Operation.UPDATE);
42
//        return hasPermission && entity.getTaxon()!=null ;
43
    }
44

    
45
    @Override
46
    protected String getPartId() {
47
        return AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_NAME_E4_TAXONNAMEEDITORE4;
48
    }
49
}
(3-3/3)