Revision cedc4ff1
Added by Katja Luther about 6 years ago
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/SetPublishFlagForSubtreeHandlerE4.java | ||
---|---|---|
26 | 26 |
|
27 | 27 |
import eu.etaxonomy.cdm.api.service.config.PublishForSubtreeConfigurator; |
28 | 28 |
import eu.etaxonomy.cdm.model.taxon.Classification; |
29 |
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
|
|
29 |
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
|
|
30 | 30 |
import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigatorLabels; |
31 | 31 |
import eu.etaxonomy.taxeditor.navigation.navigator.operation.SetPublishForSubtreeOperation; |
32 | 32 |
import eu.etaxonomy.taxeditor.operation.e4.RemotingCdmHandlerE4; |
... | ... | |
49 | 49 |
} |
50 | 50 |
|
51 | 51 |
|
52 |
private ITaxonTreeNode taxonNode;
|
|
52 |
private TaxonNodeDto taxonNode;
|
|
53 | 53 |
private PublishForSubtreeConfigurator configurator; |
54 | 54 |
|
55 | 55 |
|
... | ... | |
68 | 68 |
|
69 | 69 |
// check that selected object is a taxon node |
70 | 70 |
Object obj = selection.iterator().next(); |
71 |
if(obj instanceof ITaxonTreeNode) { |
|
72 |
if (obj instanceof Classification){ |
|
73 |
taxonNode = ((Classification)obj).getRootNode(); |
|
74 |
}else{ |
|
75 |
taxonNode = (ITaxonTreeNode)obj; |
|
76 |
} |
|
77 |
} else{ |
|
71 |
if(obj instanceof TaxonNodeDto) { |
|
72 |
taxonNode = (TaxonNodeDto)obj; |
|
73 |
} else if(obj instanceof Classification){ |
|
74 |
taxonNode = new TaxonNodeDto(((Classification)obj).getRootNode()); |
|
75 |
}else{ |
|
78 | 76 |
return new Status(IStatus.ERROR, |
79 | 77 |
"unknown", //$NON-NLS-1$ |
80 | 78 |
TaxonNavigatorLabels.SELECTED_OBJECT_NOT_TREE_NODE_MESSAGE); |
... | ... | |
94 | 92 |
@CanExecute |
95 | 93 |
private boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection, MHandledMenuItem menuItem){ |
96 | 94 |
boolean canExecute = false; |
97 |
canExecute = selection.getFirstElement() instanceof ITaxonTreeNode;
|
|
95 |
canExecute = selection.getFirstElement() instanceof TaxonNodeDto;
|
|
98 | 96 |
menuItem.setVisible(canExecute); |
99 | 97 |
return canExecute; |
100 | 98 |
} |
Also available in: Unified diff
ref #2380: implement usage of Dto for taxon navigator