import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.IUndoableOperation;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.handlers.HandlerUtil;
import eu.etaxonomy.cdm.model.taxon.Synonym;
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
-import eu.etaxonomy.taxeditor.dialogs.filteredSelection.FilteredTaxonNodeSelectionDialog;
+import eu.etaxonomy.taxeditor.dialogs.filteredSelection.TaxonNodeSelectionDialog;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
-import eu.etaxonomy.taxeditor.operations.ChangeSynonymToAcceptedTaxonOperation;
-import eu.etaxonomy.taxeditor.operations.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.editor.name.operation.ChangeSynonymToAcceptedTaxonOperation;
+import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
+import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
/**
+ * <p>ChangeSynonymToAcceptedTaxonHandler class.</p>
+ *
* @author n.hoffmann
* @created 21.04.2009
* @version 1.0
/* (non-Javadoc)
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
*/
+ /** {@inheritDoc} */
public Object execute(ExecutionEvent event) throws ExecutionException {
editor = (MultiPageTaxonEditor) HandlerUtil.getActiveEditor(event);
Shell shell = HandlerUtil.getActiveShell(event);
List<UUID> excludeTaxa = null;
- TaxonNode newParentNode = FilteredTaxonNodeSelectionDialog.selectTaxonNode(HandlerUtil.getActiveShell(event), "Select parent", excludeTaxa, null);
+ TaxonNode newParentNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event), editor.getConversationHolder(), "Select parent", excludeTaxa, null);
if(newParentNode != null){
// apply confirmation dialog
// FIXME with this implementation we can not create a taxonNode that is a direct child of the classification node
- IUndoableOperation operation = new ChangeSynonymToAcceptedTaxonOperation("Change synonym to accepted taxon", EditorUtil.getUndoContext(),
+ AbstractPostOperation operation = new ChangeSynonymToAcceptedTaxonOperation("Change synonym to accepted taxon", EditorUtil.getUndoContext(),
taxon, newParentNode, synonym, null, this, editor); //$NON-NLS-1$
EditorUtil.executeOperation(operation);
}
/* (non-Javadoc)
* @see eu.etaxonomy.taxeditor.operations.IPostOperationEnabled#postOperation(eu.etaxonomy.cdm.model.common.CdmBase)
*/
+ /** {@inheritDoc} */
public boolean postOperation(CdmBase objectAffectedByOperation) {
// Redraw existing editor
((IPostOperationEnabled) editor).postOperation(null);
- editor.doSave(null);
+ editor.doSave(EditorUtil.getMonitor());
if (objectAffectedByOperation instanceof TaxonNode) {
* CdmStore.getTaxonService().getTaxonNodeByUuid(taxonNodeUuid);
* doesn't work yet.
*/
- IEditorPart newEditor = EditorUtil.openTaxonNode(newNode.getUuid());
+ EditorUtil.openTaxonNode(newNode.getUuid());
} catch (PartInitException e) {
// TODO Auto-generated catch block
e.printStackTrace();
+ } catch (Exception e) {
+ EditorUtil.warningDialog("Could not create Taxon", this, e.getMessage());
}
}
return true;
}
+
+ /**
+ * <p>onComplete</p>
+ *
+ * @return a boolean.
+ */
+ public boolean onComplete() {
+ // TODO Auto-generated method stub
+ return false;
+ }
}