2 * Copyright (C) 2016 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 org
.eclipse
.e4
.core
.contexts
.ContextInjectionFactory
;
12 import org
.eclipse
.e4
.ui
.workbench
.modeling
.EPartService
;
13 import org
.eclipse
.jface
.viewers
.IStructuredSelection
;
14 import org
.eclipse
.jface
.wizard
.WizardDialog
;
15 import org
.eclipse
.swt
.widgets
.Shell
;
17 import eu
.etaxonomy
.cdm
.api
.service
.ITaxonNodeService
;
18 import eu
.etaxonomy
.cdm
.model
.metadata
.PreferencePredicate
;
19 import eu
.etaxonomy
.cdm
.persistence
.dto
.TaxonNodeDto
;
20 import eu
.etaxonomy
.taxeditor
.event
.EventUtility
;
21 import eu
.etaxonomy
.taxeditor
.event
.WorkbenchEventConstants
;
22 import eu
.etaxonomy
.taxeditor
.preference
.PreferencesUtil
;
23 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
24 import eu
.etaxonomy
.taxeditor
.ui
.section
.classification
.EditTaxonNodeWizard
;
31 public class DefaultOpenTaxonNodeWizardHandlerE4
extends DefaultOpenHandlerBaseE4
<TaxonNodeDto
> {
34 // protected TaxonNode getEntity(UUID uuid) {
35 // return CdmStore.getService(ITaxonNodeService.class).load(uuid);
39 protected void open(TaxonNodeDto entity
, Shell shell
, EPartService partService
) {
40 EditTaxonNodeWizard taxonNodeWizard
= ContextInjectionFactory
.make(EditTaxonNodeWizard
.class, context
);
41 taxonNodeWizard
.init(null, null);
42 taxonNodeWizard
.setEntity(CdmStore
.getService(ITaxonNodeService
.class).load(entity
.getUuid()));
43 WizardDialog dialog
= new WizardDialog(shell
, taxonNodeWizard
);
45 EventUtility
.postEvent(WorkbenchEventConstants
.REFRESH_NAVIGATOR
, entity
);
50 public boolean canExecute(IStructuredSelection selection
) {
51 if (selection
.getFirstElement() instanceof TaxonNodeDto
){
52 return ((TaxonNodeDto
)selection
.getFirstElement()).getTaxonUuid()!=null && PreferencesUtil
.getBooleanValue(PreferencePredicate
.ShowTaxonNodeWizard
.getKey());