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 java
.util
.UUID
;
13 import org
.eclipse
.e4
.core
.contexts
.ContextInjectionFactory
;
14 import org
.eclipse
.e4
.ui
.workbench
.modeling
.EPartService
;
15 import org
.eclipse
.jface
.wizard
.WizardDialog
;
16 import org
.eclipse
.swt
.widgets
.Shell
;
18 import eu
.etaxonomy
.cdm
.api
.service
.ITaxonNodeService
;
19 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonNode
;
20 import eu
.etaxonomy
.taxeditor
.event
.EventUtility
;
21 import eu
.etaxonomy
.taxeditor
.event
.WorkbenchEventConstants
;
22 import eu
.etaxonomy
.taxeditor
.preference
.IPreferenceKeys
;
23 import eu
.etaxonomy
.taxeditor
.preference
.PreferencesUtil
;
24 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
25 import eu
.etaxonomy
.taxeditor
.ui
.section
.classification
.EditTaxonNodeWizard
;
32 public class DefaultOpenTaxonNodeWizardHandlerE4
extends DefaultOpenHandlerBaseE4
<TaxonNode
> {
35 protected TaxonNode
getEntity(UUID uuid
) {
36 return CdmStore
.getService(ITaxonNodeService
.class).load(uuid
);
40 protected void open(TaxonNode entity
, Shell shell
, EPartService partService
) {
41 EditTaxonNodeWizard taxonNodeWizard
= ContextInjectionFactory
.make(EditTaxonNodeWizard
.class, context
);
42 taxonNodeWizard
.init(null, null);
43 taxonNodeWizard
.setEntity(entity
);
44 WizardDialog dialog
= new WizardDialog(shell
, taxonNodeWizard
);
46 EventUtility
.postEvent(WorkbenchEventConstants
.REFRESH_NAVIGATOR
, true);
51 public boolean canExecute(TaxonNode entity
) {
52 return entity
.getTaxon()!=null && PreferencesUtil
.getBooleanValue(IPreferenceKeys
.SHOW_TAXONNODE_WIZARD
);