Project

General

Profile

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

    
3
import java.util.UUID;
4

    
5
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
6
import org.eclipse.e4.ui.workbench.modeling.EPartService;
7
import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
8
import org.eclipse.swt.widgets.Shell;
9

    
10
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
11
import eu.etaxonomy.taxeditor.bulkeditor.AppModelId;
12
import eu.etaxonomy.taxeditor.bulkeditor.e4.BulkEditorE4;
13
import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
14
import eu.etaxonomy.taxeditor.handler.defaultHandler.e4.DefaultOpenHandlerBaseE4;
15
import eu.etaxonomy.taxeditor.store.CdmStore;
16

    
17
public class OpenBulkEditorForIdentifiableEntityE4 extends DefaultOpenHandlerBaseE4<IdentifiableEntity>{
18

    
19
    /**
20
     * {@inheritDoc}
21
     */
22
    @Override
23
    protected IdentifiableEntity getEntity(UUID uuid) {
24
        return CdmStore.getCommonService().find(IdentifiableEntity.class, uuid);
25
    }
26

    
27
    /**
28
     * {@inheritDoc}
29
     */
30
    @Override
31
    protected void open(IdentifiableEntity entity, Shell shell, EPartService partService) {
32
        MPart part = partService.createPart(AppModelId.PARTDESCRIPTOR_BULKEDITOR_EDITOR);
33
        partService.showPart(part, PartState.ACTIVATE);
34
        BulkEditorE4 bulkEditor = (BulkEditorE4) part.getObject();
35
        bulkEditor.init(AbstractBulkEditorInput.NewInstance(entity));
36
    }
37

    
38
    /**
39
     * {@inheritDoc}
40
     */
41
    @Override
42
    protected boolean canExecute(IdentifiableEntity entity) {
43
        return true;
44
    }
45

    
46
}
(1-1/2)