Project

General

Profile

Download (1.69 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.bulkeditor.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.bulkeditor.BulkEditorUtil;
17
import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
18
import eu.etaxonomy.taxeditor.bulkeditor.input.TaxonEditorInput;
19
import eu.etaxonomy.taxeditor.handler.defaultHandler.e4.DefaultOpenHandlerBaseE4;
20

    
21
public class OpenBulkEditorForTaxonNodeHandler extends DefaultOpenHandlerBaseE4<TaxonNodeDto> {
22

    
23
    @Override
24
    protected void open(TaxonNodeDto entity, Shell shell, EPartService partService) {
25
        AbstractBulkEditorInput<?> input = TaxonEditorInput.getInstance();
26
        input.setEntityUuid(entity.getTaxonUuid());
27
        BulkEditorUtil.openBulkEditor(input, modelService, partService, application);
28
    }
29

    
30
    @Override
31
    protected boolean canExecute(Object selection) {
32
        if (((IStructuredSelection)selection).getFirstElement() instanceof TaxonNodeDto && ((IStructuredSelection)selection).size() == 1){
33
            return ((TaxonNodeDto)((IStructuredSelection)selection).getFirstElement()).getTaxonUuid()!=null;
34
        }
35
        return false;
36
    }
37

    
38
    @Override
39
    protected String getPartId() {
40
        return eu.etaxonomy.taxeditor.bulkeditor.AppModelId.PARTDESCRIPTOR_BULKEDITOR_EDITOR;
41
    }
42
}
(2-2/2)