commit eb00c1c9cb49f33f269dc5a087b7c1842982c6e0
Author: Andreas Müller <a.mueller@bgbm.org>
Date:   Wed Oct 23 16:05:46 2013 +0000

    fix delete problem for open MultiPageEditors

diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/MultiPageTaxonEditorDataChangeBehaviour.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/MultiPageTaxonEditorDataChangeBehaviour.java
index aa6dc659c..80812aef3 100644
--- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/MultiPageTaxonEditorDataChangeBehaviour.java
+++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/MultiPageTaxonEditorDataChangeBehaviour.java
@@ -75,13 +75,12 @@ public class MultiPageTaxonEditorDataChangeBehaviour extends AbstractDataChangeB
 	
 	
 	/** {@inheritDoc} */
+	//we do not really need this anymore as closing the editors is 
+	//now run before the delete operation in DeleteHandler
 	@Override
 	public void reactOnDelete(Vector<CdmDataChangeEvent> events){
 		for(CdmDataChangeEvent event : events){
 			// close open editors
-			if(event.getEntity() instanceof TaxonNode){
-				logger.warn("taxon node");
-			}
 			if((event.getEntity() instanceof TaxonNode) 
 					&& input.getTaxonNode().equals(event.getEntity())){
 				EditorUtil.close(source);
diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/DeleteHandler.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/DeleteHandler.java
index a1a4425b5..6d730a08f 100644
--- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/DeleteHandler.java
+++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/DeleteHandler.java
@@ -77,41 +77,46 @@ public class DeleteHandler extends AbstractHandler implements IHandler{
 
 		AbstractPostOperation operation = null;
 		try {
-			operation = new DeleteOperation(
-					event.getCommand().getName(), NavigationUtil.getUndoContext(),
-					treeNodes, taxonNavigator, taxonNavigator);
 
-			IStatus status = NavigationUtil.executeOperation(operation);
 
-
-			// FIXME is there a better place for this code?
-			if (status == Status.OK_STATUS){
-				for (ITaxonTreeNode treeNode : treeNodes){
-					if(treeNode instanceof TaxonNode) {
-						closeObsoleteEditor((TaxonNode) treeNode);
-					}
+			boolean allEditorsClosed = true;
+			for (ITaxonTreeNode treeNode : treeNodes){
+				if(treeNode instanceof TaxonNode) {
+					allEditorsClosed &= closeObsoleteEditor((TaxonNode) treeNode);
 				}
 			}
 
+			if (allEditorsClosed){
+				operation = new DeleteOperation(
+						event.getCommand().getName(), NavigationUtil.getUndoContext(),
+						treeNodes, taxonNavigator, taxonNavigator);
+	
+				NavigationUtil.executeOperation(operation);
+			}
+
+	
+
 		} catch (NotDefinedException e) {
 			NavigationUtil.warn(getClass(), "Command name not set");
 		}
 		return null;
 	}
 
-	private void closeObsoleteEditor(TaxonNode taxonNode){
+	private boolean closeObsoleteEditor(TaxonNode taxonNode){
+		boolean result = true;
 		for (IEditorReference ref : activePage.getEditorReferences()) {
 			try {
 				IEditorInput input = ref.getEditorInput();
 				if (input instanceof TaxonEditorInput) {
 					TaxonNode node = ((TaxonEditorInput) input).getTaxonNode();
 					if (taxonNode.equals(node)) {
-						activePage.closeEditor(ref.getEditor(false), false);
+						result &= activePage.closeEditor(ref.getEditor(false), true);
 					}
 				}
 			} catch (PartInitException e) {
 				continue;
 			}
 		}
+		return result;
 	}
 }
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/dnd/CdmAuthorityTableDropTargetListener.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/dnd/CdmAuthorityTableDropTargetListener.java
index 5612ab4ab..bb58d8803 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/dnd/CdmAuthorityTableDropTargetListener.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/dnd/CdmAuthorityTableDropTargetListener.java
@@ -8,18 +8,10 @@
 */
 package eu.etaxonomy.taxeditor.dnd;
 
-import java.awt.Cursor;
-import java.util.EnumSet;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.dnd.DND;
 import org.eclipse.swt.dnd.DropTargetEvent;
 import org.eclipse.swt.dnd.DropTargetListener;
 
 import eu.etaxonomy.cdm.model.common.CdmBase;
-import eu.etaxonomy.cdm.model.taxon.TaxonNode;
-import eu.etaxonomy.cdm.persistence.hibernate.permission.CRUD;
-import eu.etaxonomy.cdm.persistence.hibernate.permission.CdmAuthority;
 import eu.etaxonomy.taxeditor.dnd.transfer.TaxonNodeTransfer;
 import eu.etaxonomy.taxeditor.ui.group.grantedauthority.CdmAuthorityComposite;
 import eu.etaxonomy.taxeditor.ui.group.grantedauthority.CdmAuthorityCompositeViewer;
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/taxon/TaxonBaseDetailElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/taxon/TaxonBaseDetailElement.java
index bff30d787..680017787 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/taxon/TaxonBaseDetailElement.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/taxon/TaxonBaseDetailElement.java
@@ -56,13 +56,11 @@ public class TaxonBaseDetailElement extends AbstractIdentifiableEntityDetailElem
 	 * </p>
 	 *
 	 * @param cdmFormFactory
-	 *            a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
-	 *            object.
+	 *        a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
 	 * @param formElement
-	 *            a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
-	 *            object.
+	 *        a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
 	 * @param style
-	 *            a int.
+	 *        a int.
 	 */
 	public TaxonBaseDetailElement(CdmFormFactory cdmFormFactory,
 			ICdmFormElement formElement, int style) {
@@ -95,11 +93,13 @@ public class TaxonBaseDetailElement extends AbstractIdentifiableEntityDetailElem
 			checkbox_unplaced = formFactory.createCheckbox(formElement,
 					"Taxon is unplaced", ((Taxon) entity).isUnplaced(), style);
 		}
+		
+		checkbox_doubtful = formFactory.createCheckbox(formElement,
+				entity.getClass().getSimpleName() + " is doubtful", entity.isDoubtful(), style);
+		
 		checkbox_published = formFactory.createCheckbox(formElement,
 		        "Taxon is published", ((Taxon) entity).isPublish(), style);
 
-		checkbox_doubtful = formFactory.createCheckbox(formElement,
-				entity.getClass().getSimpleName() + " is doubtful", entity.isDoubtful(), style);
 	}
 
 	/** {@inheritDoc} */
