Project

General

Profile

Download (1.62 KB) Statistics
| Branch: | Tag: | Revision:
1
package eu.etaxonomy.taxeditor.bulkeditor.handler.defaultHandler;
2

    
3
import org.eclipse.e4.ui.workbench.modeling.EPartService;
4
import org.eclipse.jface.viewers.IStructuredSelection;
5
import org.eclipse.swt.widgets.Shell;
6

    
7
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
8
import eu.etaxonomy.taxeditor.bulkeditor.BulkEditorUtil;
9
import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
10
import eu.etaxonomy.taxeditor.bulkeditor.input.TaxonEditorInput;
11
import eu.etaxonomy.taxeditor.handler.defaultHandler.e4.DefaultOpenHandlerBaseE4;
12

    
13
public class OpenBulkEditorForTaxonNodeHandler extends DefaultOpenHandlerBaseE4<TaxonNodeDto> {
14

    
15
//    @Override
16
//    protected TaxonNode getEntity(UUID uuid) {
17
//        return CdmStore.getService(ITaxonNodeService.class).load(uuid);
18
//    }
19

    
20
    @Override
21
    protected void open(TaxonNodeDto entity, Shell shell, EPartService partService) {
22
        AbstractBulkEditorInput input = TaxonEditorInput.getInstance();
23
        input.setEntityUuid(entity.getTaxonUuid());
24
        BulkEditorUtil.openBulkEditor(input, modelService, partService, application);
25
    }
26

    
27
    /**
28
     * {@inheritDoc}
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

    
43
}
(2-2/2)