ref #7865 Change method signature for checking for dirty taxa editors
[taxeditor.git] / eu.etaxonomy.taxeditor.navigation / src / main / java / eu / etaxonomy / taxeditor / navigation / navigator / e4 / handler / SetSecReferenceForSubtreeHandlerE4.java
index 62e916aa839cbb99cb8b46b53d2748705526dd12..2163cf878505f968bf63c4c6fffff40776b8da70 100755 (executable)
@@ -31,15 +31,13 @@ import org.eclipse.swt.widgets.Shell;
 import eu.etaxonomy.cdm.api.service.config.SecundumForSubtreeConfigurator;
 import eu.etaxonomy.cdm.model.taxon.Classification;
 import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
-import eu.etaxonomy.taxeditor.bulkeditor.e4.BulkEditorE4;
 import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
 import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
 import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigatorLabels;
 import eu.etaxonomy.taxeditor.navigation.navigator.operation.SetSecundumForSubtreeOperation;
 import eu.etaxonomy.taxeditor.operation.e4.RemotingCdmHandlerE4;
 import eu.etaxonomy.taxeditor.ui.dialog.configurator.SetSecundumForSubtreeConfigurationWizard;
-import eu.etaxonomy.taxeditor.workbench.WorkbenchUtility;
+import eu.etaxonomy.taxeditor.workbench.part.IE4SavablePart;
 
 /**
  * @author k.luther
@@ -84,7 +82,7 @@ public class SetSecReferenceForSubtreeHandlerE4 extends RemotingCdmHandlerE4 {
                     "unknown", //$NON-NLS-1$
                     TaxonNavigatorLabels.SELECTED_OBJECT_NOT_TREE_NODE_MESSAGE);
         }
-        Collection<MPart> dirtyParts = EditorUtil.checkForTaxonChanges(null, partService);
+        Collection<IE4SavablePart> dirtyParts = EditorUtil.checkForTaxonChanges(null, partService);
 
         if (dirtyParts != null && !dirtyParts.isEmpty()){
             String[] buttonLables = {Messages.YES, Messages.NO,Messages.TreeNodeDropAdapter_CANCEL};
@@ -98,21 +96,13 @@ public class SetSecReferenceForSubtreeHandlerE4 extends RemotingCdmHandlerE4 {
                 return Status.CANCEL_STATUS;
             }
 
-            Iterator<MPart> partIterator = dirtyParts.iterator();
+            Iterator<IE4SavablePart> partIterator = dirtyParts.iterator();
             while( partIterator.hasNext() ){
-                MPart part = partIterator.next();
+                IE4SavablePart part = partIterator.next();
                 if (proceed) {
                     if (part != null){
-                        if (part.getElementId().equals("eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4")){ //$NON-NLS-1$
-                            TaxonNameEditorE4 targetEditor = (TaxonNameEditorE4) WorkbenchUtility.getE4WrappedPart(part);
-                            targetEditor.save(new NullProgressMonitor());
-                        }else if (part.getElementId().equals("bulkeditor.editor")){ //$NON-NLS-1$
-                            BulkEditorE4 targetEditor = (BulkEditorE4) WorkbenchUtility.getE4WrappedPart(part);
-                            targetEditor.save(new NullProgressMonitor());
-                        }
-
+                        part.save(new NullProgressMonitor());
                     }
-
                 }
             }
         }