1
|
package eu.etaxonomy.taxeditor.handler.defaultHandler.e4;
|
2
|
|
3
|
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
4
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
5
|
import org.eclipse.jface.wizard.WizardDialog;
|
6
|
import org.eclipse.swt.widgets.Shell;
|
7
|
|
8
|
import eu.etaxonomy.cdm.api.service.IClassificationService;
|
9
|
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
|
10
|
import eu.etaxonomy.taxeditor.newWizard.NewClassificationWizard;
|
11
|
import eu.etaxonomy.taxeditor.store.CdmStore;
|
12
|
|
13
|
public class DefaultOpenClassificationWizardHandlerE4 extends DefaultOpenHandlerBaseE4<TaxonNodeDto> {
|
14
|
|
15
|
// @Override
|
16
|
// protected TaxonNode getEntity(UUID uuid) {
|
17
|
// return CdmStore.getService(ITaxonNodeService.class).load(uuid);
|
18
|
// }
|
19
|
|
20
|
@Override
|
21
|
protected void open(TaxonNodeDto entity, Shell shell, EPartService partService) {
|
22
|
NewClassificationWizard classificationWizard = new NewClassificationWizard();
|
23
|
classificationWizard.init(null, null);
|
24
|
classificationWizard.setEntity(CdmStore.getService(IClassificationService.class).load(entity.getClassificationUUID()));
|
25
|
WizardDialog dialog = new WizardDialog(shell, classificationWizard);
|
26
|
dialog.open();
|
27
|
}
|
28
|
|
29
|
/**
|
30
|
* {@inheritDoc}
|
31
|
*/
|
32
|
@Override
|
33
|
protected boolean canExecute(IStructuredSelection entity) {
|
34
|
// return true;
|
35
|
if (entity.getFirstElement() instanceof TaxonNodeDto){
|
36
|
return ((TaxonNodeDto)entity.getFirstElement()).getTaxonUuid() == null;
|
37
|
}
|
38
|
return false;
|
39
|
// return entity.getClassification().getRootNode().equals(entity);
|
40
|
}
|
41
|
|
42
|
|
43
|
}
|