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.agent.AgentBase;
|
11
|
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
|
12
|
import eu.etaxonomy.cdm.model.media.Media;
|
13
|
import eu.etaxonomy.cdm.model.name.TaxonName;
|
14
|
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
|
15
|
import eu.etaxonomy.cdm.model.reference.Reference;
|
16
|
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
|
17
|
import eu.etaxonomy.taxeditor.bulkeditor.AppModelId;
|
18
|
import eu.etaxonomy.taxeditor.bulkeditor.e4.BulkEditorE4;
|
19
|
import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
|
20
|
import eu.etaxonomy.taxeditor.handler.defaultHandler.e4.DefaultOpenHandlerBaseE4;
|
21
|
import eu.etaxonomy.taxeditor.store.CdmStore;
|
22
|
|
23
|
public class OpenBulkEditorForIdentifiableEntityE4 extends DefaultOpenHandlerBaseE4<IdentifiableEntity>{
|
24
|
|
25
|
/**
|
26
|
* {@inheritDoc}
|
27
|
*/
|
28
|
@Override
|
29
|
protected IdentifiableEntity getEntity(UUID uuid) {
|
30
|
return CdmStore.getCommonService().find(IdentifiableEntity.class, uuid);
|
31
|
}
|
32
|
|
33
|
/**
|
34
|
* {@inheritDoc}
|
35
|
*/
|
36
|
@Override
|
37
|
protected void open(IdentifiableEntity entity, Shell shell, EPartService partService) {
|
38
|
MPart part = partService.createPart(AppModelId.PARTDESCRIPTOR_BULKEDITOR_EDITOR);
|
39
|
part = partService.showPart(part, PartState.ACTIVATE);
|
40
|
BulkEditorE4 bulkEditor = (BulkEditorE4) part.getObject();
|
41
|
bulkEditor.init(AbstractBulkEditorInput.NewInstance(entity));
|
42
|
}
|
43
|
|
44
|
/**
|
45
|
* {@inheritDoc}
|
46
|
*/
|
47
|
@Override
|
48
|
protected boolean canExecute(IdentifiableEntity entity) {
|
49
|
return entity instanceof Reference
|
50
|
|| entity instanceof TaxonName
|
51
|
|| entity instanceof AgentBase
|
52
|
|| entity instanceof SpecimenOrObservationBase
|
53
|
|| entity instanceof TaxonBase
|
54
|
|| entity instanceof Media
|
55
|
;
|
56
|
}
|
57
|
|
58
|
}
|