import org.eclipse.ui.handlers.HandlerUtil;
import eu.etaxonomy.cdm.api.conversation.ConversationHolderMock;
-import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigatorLabels;
import eu.etaxonomy.taxeditor.navigation.navigator.operation.RemotingChangeAcceptedTaxonToSynonymOperation;
import eu.etaxonomy.taxeditor.operation.RemotingCdmHandler;
.getLogger(RemotingChangeAcceptedTaxonToSynonymHandler.class);
- private ITaxonTreeNode oldTaxonNode;
+ private TaxonNode oldTaxonNode;
/**
* @param label
// check that only a single taxon tree node has been selected
if(selection.size() > 1) {
return new Status(IStatus.ERROR,
- "unknown",
+ "unknown", //$NON-NLS-1$
TaxonNavigatorLabels.SINGLE_TAXON_SELECTION_MESSAGE);
}
// check for no taxon tree node selected
if(selection.size() == 0) {
return new Status(IStatus.ERROR,
- "unknown",
+ "unknown", //$NON-NLS-1$
TaxonNavigatorLabels.NO_TAXON_SELECTION_MESSAGE);
}
// check that selected object is a taxon node
Object obj = selection.iterator().next();
- if(obj instanceof ITaxonTreeNode) {
- oldTaxonNode = (ITaxonTreeNode)obj;
+ if(obj instanceof TaxonNode) {
+ oldTaxonNode = (TaxonNode)obj;
} else {
return new Status(IStatus.ERROR,
- "unknown",
+ "unknown", //$NON-NLS-1$
TaxonNavigatorLabels.SELECTED_OBJECT_NOT_TREE_NODE_MESSAGE);
}
// check that the source taxon node does not have children
- if(((TaxonNode)oldTaxonNode).getCountChildren() > 0) {
+ if(oldTaxonNode.getCountChildren() > 0) {
return new Status(IStatus.ERROR,
- "unknown",
+ "unknown", //$NON-NLS-1$
TaxonNavigatorLabels.SOURCE_TAXON_HAS_CHILDREN_MESSAGE);
}
// check if corresponding name editor is closed
- boolean editorClosed = NavigatorHandlerUtils.closeObsoleteEditor(event, (TaxonNode) oldTaxonNode);
+ boolean editorClosed = NavigatorHandlerUtils.closeObsoleteEditor(event, oldTaxonNode);
if(editorClosed != true) {
return new Status(IStatus.ERROR,
- "unknown",
+ "unknown", //$NON-NLS-1$
TaxonNavigatorLabels.RELATED_EDITOR_NOT_CLOSED_MESSAGE);
}
@Override
public AbstractOperation prepareOperation(ExecutionEvent event) {
List<UUID> excludeTaxa = new ArrayList<UUID>();
- excludeTaxa.add(((TaxonNode)oldTaxonNode).getTaxon().getUuid());
+ excludeTaxa.add(oldTaxonNode.getTaxon().getUuid());
TaxonNode newAcceptedTaxonNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event),
new ConversationHolderMock(),
- "Choose the accepted taxon",
+ Messages.RemotingChangeAcceptedTaxonToSynonymHandler_CHOOSE_TAXON,
excludeTaxa,
- null,
- ((TaxonNode)oldTaxonNode).getClassification());
+ oldTaxonNode,
+ oldTaxonNode.getClassification());
if (newAcceptedTaxonNode == null) {
return null;