1
|
/**
|
2
|
* Copyright (C) 2020 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
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.
|
8
|
*/
|
9
|
package eu.etaxonomy.taxeditor.handler.defaultHandler.e4;
|
10
|
|
11
|
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
12
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
13
|
import org.eclipse.jface.wizard.WizardDialog;
|
14
|
import org.eclipse.swt.widgets.Shell;
|
15
|
|
16
|
import eu.etaxonomy.cdm.api.service.IClassificationService;
|
17
|
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
|
18
|
import eu.etaxonomy.taxeditor.newWizard.NewClassificationWizard;
|
19
|
import eu.etaxonomy.taxeditor.store.CdmStore;
|
20
|
|
21
|
public class DefaultOpenClassificationWizardHandlerE4 extends DefaultOpenHandlerBaseE4<TaxonNodeDto> {
|
22
|
|
23
|
@Override
|
24
|
protected void open(TaxonNodeDto entity, Shell shell, EPartService partService) {
|
25
|
NewClassificationWizard classificationWizard = new NewClassificationWizard();
|
26
|
classificationWizard.init(null, null);
|
27
|
classificationWizard.setEntity(CdmStore.getService(IClassificationService.class).load(entity.getClassificationUUID()));
|
28
|
WizardDialog dialog = new WizardDialog(shell, classificationWizard);
|
29
|
dialog.open();
|
30
|
}
|
31
|
|
32
|
@Override
|
33
|
protected boolean canExecute(Object selection) {
|
34
|
if (((IStructuredSelection)selection).getFirstElement() instanceof TaxonNodeDto){
|
35
|
return ((TaxonNodeDto)((IStructuredSelection)selection).getFirstElement()).getTaxonUuid() == null;
|
36
|
}
|
37
|
return false;
|
38
|
}
|
39
|
}
|