2 * Copyright (C) 2020 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
.handler
.defaultHandler
.e4
;
11 import java
.util
.ArrayList
;
12 import java
.util
.List
;
14 import javax
.inject
.Named
;
16 import org
.eclipse
.e4
.core
.contexts
.IEclipseContext
;
17 import org
.eclipse
.e4
.core
.di
.annotations
.Execute
;
18 import org
.eclipse
.e4
.ui
.model
.application
.MApplication
;
19 import org
.eclipse
.e4
.ui
.model
.application
.ui
.menu
.MHandledMenuItem
;
20 import org
.eclipse
.e4
.ui
.services
.IServiceConstants
;
21 import org
.eclipse
.e4
.ui
.workbench
.modeling
.EModelService
;
22 import org
.eclipse
.e4
.ui
.workbench
.modeling
.EPartService
;
23 import org
.eclipse
.jface
.viewers
.TreeSelection
;
24 import org
.eclipse
.swt
.widgets
.Shell
;
26 import eu
.etaxonomy
.cdm
.persistence
.dto
.UuidAndTitleCache
;
32 public abstract class DefaultOpenSetBaseHandler
<S
> extends DefaultOpenHandlerBaseE4
<S
> {
36 public void execute(@Named(IServiceConstants
.ACTIVE_SHELL
)Shell shell
, MHandledMenuItem menuItem
,
37 EModelService modelService
, EPartService partService
, MApplication application
,
38 IEclipseContext context
) throws Exception
{
39 this.context
= context
;
40 this.modelService
= modelService
;
41 this.application
= application
;
43 String commandId
= menuItem
.getCommand().getElementId();
44 Object transientData
= menuItem
.getTransientData().get(commandId
+".uuid");
46 if(transientData
instanceof TreeSelection
){
47 list
= (S
) ((TreeSelection
)transientData
).toList();
49 }else if (transientData
instanceof UuidAndTitleCache
){
50 List
<UuidAndTitleCache
> uuidList
= new ArrayList
<>();
51 uuidList
.add((UuidAndTitleCache
)transientData
);
55 open(list
, shell
, partService
);