2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
9 package eu
.etaxonomy
.taxeditor
.bulkeditor
.handler
.defaultHandler
;
11 import org
.eclipse
.e4
.ui
.workbench
.modeling
.EPartService
;
12 import org
.eclipse
.swt
.widgets
.Shell
;
14 import eu
.etaxonomy
.cdm
.model
.agent
.AgentBase
;
15 import eu
.etaxonomy
.cdm
.model
.common
.IdentifiableEntity
;
16 import eu
.etaxonomy
.cdm
.model
.media
.Media
;
17 import eu
.etaxonomy
.cdm
.model
.name
.TaxonName
;
18 import eu
.etaxonomy
.cdm
.model
.occurrence
.SpecimenOrObservationBase
;
19 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
20 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonBase
;
21 import eu
.etaxonomy
.cdm
.persistence
.dto
.UuidAndTitleCache
;
22 import eu
.etaxonomy
.taxeditor
.bulkeditor
.BulkEditorUtil
;
23 import eu
.etaxonomy
.taxeditor
.bulkeditor
.input
.AbstractBulkEditorInput
;
24 import eu
.etaxonomy
.taxeditor
.handler
.defaultHandler
.e4
.DefaultOpenHandlerBaseE4
;
26 public class OpenBulkEditorForIdentifiableEntityE4
extends DefaultOpenHandlerBaseE4
<Object
>{
29 // protected IdentifiableEntity getEntity(UUID uuid) {
30 // return CdmStore.getCommonService().find(IdentifiableEntity.class, uuid);
34 protected void open(Object entity
, Shell shell
, EPartService partService
) {
35 @SuppressWarnings("rawtypes")
36 AbstractBulkEditorInput input
= null;
37 if (entity
instanceof UuidAndTitleCache
){
38 input
= AbstractBulkEditorInput
.NewInstance(((UuidAndTitleCache
)entity
).getType(), ((UuidAndTitleCache
)entity
).getUuid());
39 }else if (entity
instanceof IdentifiableEntity
){
40 input
= AbstractBulkEditorInput
.NewInstance((IdentifiableEntity
)entity
);
42 BulkEditorUtil
.openBulkEditor(input
, modelService
, partService
, application
);
46 protected boolean canExecute(Object entity
) {
47 if (entity
instanceof UuidAndTitleCache
){
48 return (TaxonName
.class.isAssignableFrom(((UuidAndTitleCache
)entity
).getType())
49 || AgentBase
.class.isAssignableFrom(((UuidAndTitleCache
)entity
).getType())
50 || SpecimenOrObservationBase
.class.isAssignableFrom(((UuidAndTitleCache
)entity
).getType())
51 || TaxonBase
.class.isAssignableFrom(((UuidAndTitleCache
)entity
).getType())
52 || Reference
.class.isAssignableFrom(((UuidAndTitleCache
)entity
).getType()));
55 return entity
instanceof Reference
56 || entity
instanceof TaxonName
57 || entity
instanceof AgentBase
58 || entity
instanceof SpecimenOrObservationBase
59 || entity
instanceof TaxonBase
60 || entity
instanceof Media
66 protected String
getPartId() {
67 return eu
.etaxonomy
.taxeditor
.bulkeditor
.AppModelId
.PARTDESCRIPTOR_BULKEDITOR_EDITOR
;