factual data for bulkeditor, improving referencing objects view, make delete in bulke...
authorKatja Luther <k.luther@bgbm.org>
Thu, 29 Jan 2015 10:58:33 +0000 (10:58 +0000)
committerKatja Luther <k.luther@bgbm.org>
Thu, 29 Jan 2015 10:58:33 +0000 (10:58 +0000)
eu.etaxonomy.taxeditor.bulkeditor/plugin.xml
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/BulkEditor.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/handler/DeleteHandler.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/TaxonEditorInput.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/referencingobjects/ReferencingObjectsView.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/TaxonNameEditor.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptiveViewPart.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/CreateDescriptionHandler.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewPart.java

index cb64bf7b38e7e45ce98ba1f9fa6f76e1f53cac0d..fc783f268763cdcb999e8fde1f9b5b1911ce4aef 100644 (file)
                visible="true">\r
          </separator>\r
          <command\r
-               commandId="org.eclipse.ui.edit.delete"\r
+               commandId="eu.etaxonomy.taxeditor.bulkeditor.delete"\r
                label="Delete"\r
                style="push">\r
             <visibleWhen\r
             id="taxeditor-bulkeditor.command.setMarkerFlag"\r
             name="Set Marker Flag">\r
       </command>\r
+      <command\r
+            id="eu.etaxonomy.taxeditor.bulkeditor.delete"\r
+            name="delete">\r
+      </command>\r
       <!--command\r
             defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.handler.NewEntityHandler"\r
             id="eu.etaxonomy.taxeditor.bulkeditor.command.new"\r
       </handler>\r
       <handler\r
             class="eu.etaxonomy.taxeditor.bulkeditor.handler.DeleteHandler"\r
-            commandId="org.eclipse.ui.edit.delete">\r
+            commandId="eu.etaxonomy.taxeditor.bulkeditor.delete">\r
          <activeWhen>\r
             <with\r
                   variable="selection">\r
index c05e3483c3c164e4b3de53ff0a795e3ac1030c69..44c8ce7b68bfe028ab563b5ec34322f9f8a7b25d 100644 (file)
@@ -48,6 +48,8 @@ import eu.etaxonomy.taxeditor.bulkeditor.referencingobjects.ReferencingObjectsVi
 import eu.etaxonomy.taxeditor.model.IDerivedUnitFacadePart;
 import eu.etaxonomy.taxeditor.model.IDirtyMarkable;
 import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
+import eu.etaxonomy.taxeditor.model.IPartContentHasFactualData;
+
 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 
@@ -61,7 +63,7 @@ import eu.etaxonomy.taxeditor.store.CdmStore;
  * @version 1.0
  */
 public class BulkEditor extends AnnotatedLineEditor implements IPartContentHasDetails,
-        IDirtyMarkable, IDerivedUnitFacadePart {
+        IDirtyMarkable, IDerivedUnitFacadePart, IPartContentHasFactualData {
 
        /** Constant <code>ID="bulkeditor.editor"</code> */
        public static final String ID = "bulkeditor.editor";
@@ -173,6 +175,7 @@ public class BulkEditor extends AnnotatedLineEditor implements IPartContentHasDe
                }
                super.dispose();
        }
+       
 
        /* (non-Javadoc)
         * @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#isEditable()
index 8f87f7d2ba2b6841160c07d859a7fca309870b06..95c415566bf6b265b617ef22556c62642e832341 100644 (file)
@@ -21,6 +21,7 @@ import org.eclipse.ui.IEditorInput;
 import org.eclipse.ui.IEditorPart;
 import org.eclipse.ui.IViewPart;
 import org.eclipse.ui.IViewReference;
+import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.handlers.HandlerUtil;
 import org.eclipse.ui.texteditor.IDocumentProvider;
 import org.eclipse.ui.IWorkbenchPage;
@@ -33,6 +34,7 @@ import eu.etaxonomy.cdm.api.service.IOccurrenceService;
 import eu.etaxonomy.cdm.api.service.IReferenceService;
 import eu.etaxonomy.cdm.api.service.ITaxonService;
 import eu.etaxonomy.cdm.api.service.IUserService;
+import eu.etaxonomy.cdm.api.service.config.NameDeletionConfigurator;
 import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
 import eu.etaxonomy.cdm.model.common.Group;
 import eu.etaxonomy.cdm.model.common.User;
@@ -56,6 +58,7 @@ import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 
+
 /**
  * @author n.hoffmann
  * @created Mar 11, 2011
@@ -87,6 +90,11 @@ public class DeleteHandler extends AbstractHandler {
                                IStructuredSelection structuredSelection = (IStructuredSelection) selection;
                                
                                IEntityPersistenceService persistenceService = (IEntityPersistenceService) input;
+                                IViewPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+                                                   .findView("eu.etaxonomy.taxeditor.bulkeditor.view.referencingobjects");
+                                   if (part != null){
+                                               ((ReferencingObjectsView)part).dispose();
+                                       }
                                
                                for(Object object : structuredSelection.toList()){
                                        
@@ -116,8 +124,10 @@ public class DeleteHandler extends AbstractHandler {
                                                        result = service.delete((User) object);
                                                } else if (object instanceof TaxonNameBase){
                                                        INameService service = controller.getNameService();
-                                                       service.load(((TaxonNameBase) object).getUuid());
-                                                       result = service.delete((TaxonNameBase)object);
+                                                       TaxonNameBase name = service.load(((TaxonNameBase) object).getUuid());
+                                                       NameDeletionConfigurator config = new NameDeletionConfigurator();
+                                                       
+                                                       result = service.delete(name, config);
                                                } else if (object instanceof TaxonBase){
                                                        ITaxonService service = controller.getTaxonService();
                                                        service.load(((TaxonBase) object).getUuid());
@@ -134,7 +144,7 @@ public class DeleteHandler extends AbstractHandler {
                                        } catch (Exception e){
                                                MessagingUtils.messageDialog("Exception occured. Could not delete", getClass(), e.getMessage(), null);
                                        }
-                                       if (result.isError() || !result.getExceptions().isEmpty()){
+                                       if (result.isError() || result.isAbort()|| !result.getExceptions().isEmpty()){
                                                if (!result.getExceptions().isEmpty()) {
                                                        MessagingUtils.messageDialog("Could not delete", getClass(), result.getExceptions().get(0).getMessage(), null);
                                                }else{
@@ -144,8 +154,17 @@ public class DeleteHandler extends AbstractHandler {
                                        }
                                        if (result.isOk() && result.getExceptions().isEmpty()){
                                                ((BulkEditor) editor).removeAnnotatedLine(annotation);
+                                               
 
                                        }
+                                       if (part != null){
+                                               ((ReferencingObjectsView)part).refresh();
+                                       }
+                                       part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+                                                   .findView("eu.etaxonomy.taxeditor.editor.view.descriptive");
+                                   if (part != null){
+                                               //((DescriptiveViewPart)part).dispose();
+                                       }
                                }                               
                        }
                }else{
index 92b9023ee2b28ae588f9035adc92e8107d4db027..3367a5e09279f936f52c687d8c049e656a818f65 100644 (file)
@@ -1,5 +1,6 @@
 package eu.etaxonomy.taxeditor.bulkeditor.input;\r
 \r
+import java.util.ArrayList;\r
 import java.util.Arrays;\r
 import java.util.List;\r
 import java.util.UUID;\r
@@ -10,7 +11,10 @@ import eu.etaxonomy.cdm.api.service.config.FindTaxaAndNamesConfiguratorImpl;
 import eu.etaxonomy.cdm.api.service.config.IFindTaxaAndNamesConfigurator;\r
 import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;\r
 import eu.etaxonomy.cdm.api.service.exception.ReferencedObjectUndeletableException;\r
+import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;\r
 import eu.etaxonomy.cdm.model.name.TaxonNameBase;\r
+import eu.etaxonomy.cdm.model.taxon.Synonym;\r
+import eu.etaxonomy.cdm.model.taxon.Taxon;\r
 import eu.etaxonomy.cdm.model.taxon.TaxonBase;\r
 import eu.etaxonomy.cdm.persistence.query.MatchMode;\r
 import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator;\r
@@ -24,6 +28,8 @@ public class TaxonEditorInput extends AbstractBulkEditorInput<TaxonBase>{
        /** Constant <code>ID="bulkeditor.input.taxon"</code> */\r
        public static final String ID = "bulkeditor.input.taxon";\r
        \r
+       \r
+       \r
        /**\r
         * <p>Getter for the field <code>instance</code>.</p>\r
         *\r
@@ -33,6 +39,7 @@ public class TaxonEditorInput extends AbstractBulkEditorInput<TaxonBase>{
                if (instance == null) {\r
                        instance = new TaxonEditorInput();\r
                }\r
+       \r
                return instance;\r
        }\r
        \r
@@ -78,8 +85,17 @@ public class TaxonEditorInput extends AbstractBulkEditorInput<TaxonBase>{
                IFindTaxaAndNamesConfigurator<TaxonBase> newConfig = new FindTaxaAndNamesConfiguratorImpl<TaxonBase>();\r
                newConfig.setTitleSearchString(configurator.getTitleSearchStringSqlized());\r
                newConfig.setMatchMode(MatchMode.ANYWHERE);\r
-               \r
-               return CdmStore.getSearchManager().findTaxa(configurator);\r
+               List<TaxonBase> taxa =  CdmStore.getSearchManager().findTaxa(configurator);\r
+               List<TaxonBase> taxaCopy = new ArrayList<TaxonBase>();\r
+               for (TaxonBase taxon:taxa){\r
+                       \r
+                       if (taxon instanceof Taxon){\r
+                               taxaCopy.add(HibernateProxyHelper.deproxy(taxon, Taxon.class));\r
+                       }else{\r
+                               taxaCopy.add(HibernateProxyHelper.deproxy(taxon, Synonym.class));\r
+                       }\r
+               }\r
+               return taxaCopy;\r
        }\r
 \r
 \r
index f4d15b14639694532c9e316be86d77b39256a15a..0c1280ad8ae8cca7b37bd5d33587b04e1076ecc3 100644 (file)
@@ -1,9 +1,9 @@
 // $Id$
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
+* European Distributed Institute of Taxonomy 
 * http://www.e-taxonomy.eu
-*
+* 
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
@@ -15,25 +15,49 @@ import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
 import java.util.Set;
+import java.util.UUID;
 
 import org.apache.log4j.Logger;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.viewers.TableViewer;
 import org.eclipse.jface.viewers.TableViewerColumn;
 import org.eclipse.jface.viewers.Viewer;
 import org.eclipse.swt.SWT;
+import org.eclipse.swt.internal.ole.win32.ISpecifyPropertyPages;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Table;
 import org.eclipse.ui.INullSelectionListener;
+import org.eclipse.ui.ISelectionListener;
 import org.eclipse.ui.IWorkbenchPart;
 
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.service.IAgentService;
 import eu.etaxonomy.cdm.api.service.ICommonService;
+import eu.etaxonomy.cdm.api.service.IGroupService;
+import eu.etaxonomy.cdm.api.service.IIdentifiableEntityService;
+import eu.etaxonomy.cdm.api.service.INameService;
+import eu.etaxonomy.cdm.api.service.IOccurrenceService;
+import eu.etaxonomy.cdm.api.service.IReferenceService;
+import eu.etaxonomy.cdm.api.service.ITaxonService;
+import eu.etaxonomy.cdm.api.service.IUserService;
+import eu.etaxonomy.cdm.model.agent.AgentBase;
 import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
 import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.common.Group;
+import eu.etaxonomy.cdm.model.common.ICdmBase;
 import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
+import eu.etaxonomy.cdm.model.common.User;
+import eu.etaxonomy.cdm.model.name.TaxonNameBase;
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
+import eu.etaxonomy.cdm.model.reference.Reference;
+import eu.etaxonomy.cdm.model.taxon.TaxonBase;
+import eu.etaxonomy.cdm.persistence.dao.agent.IAgentDao;
 import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
 import eu.etaxonomy.taxeditor.model.DescriptionHelper;
 import eu.etaxonomy.taxeditor.model.LineSelection;
@@ -53,11 +77,11 @@ public class ReferencingObjectsView extends AbstractCdmViewPart implements INull
 
        /** Constant <code>ID="eu.etaxonomy.taxeditor.bulkeditor.refer"{trunked}</code> */
        public static final String ID = "eu.etaxonomy.taxeditor.bulkeditor.view.referencingobjects";
-
+       
        private TableViewer viewer;
 
-       private CdmBase referencedObject;
-
+       private String referencedObjectTitleCache;
+       
        /* (non-Javadoc)
         * @see eu.etaxonomy.taxeditor.model.AbstractCdmViewPart#createViewer(org.eclipse.swt.widgets.Composite)
         */
@@ -65,7 +89,7 @@ public class ReferencingObjectsView extends AbstractCdmViewPart implements INull
        @Override
        public void createViewer(Composite parent) {
                selectionService.addSelectionListener(this);
-
+               
                viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL
                                | SWT.V_SCROLL | SWT.FULL_SELECTION);
                createColumns(viewer);
@@ -73,7 +97,7 @@ public class ReferencingObjectsView extends AbstractCdmViewPart implements INull
                viewer.setLabelProvider(new ReferencingObjectsLabelProvider());
 //             viewer.setInput(new ArrayList<CdmBase>());
        }
-
+       
        /**
         * Create the columns for the table
         * @param viewer
@@ -99,72 +123,87 @@ public class ReferencingObjectsView extends AbstractCdmViewPart implements INull
         *
         * @param entity a {@link eu.etaxonomy.cdm.model.common.IdentifiableEntity} object.
         */
-       public void updateReferencingObjects(final IdentifiableEntity entity) {
-
+       public void updateReferencingObjects(final UUID entityUUID, final Class objectClass) {
+               
                final Display display = Display.getCurrent();
-
-               //TODO see ticket #4537 (Re-enable asynchronous loading for ReferencingObjectsView)
-               //this is a workaround for #1569
-               //Job job = new Job("Update Referencing Objects") {
-//
-//                     @Override
-//                     protected IStatus run(IProgressMonitor monitor) {
-//                             monitor.beginTask("Calculating referencing objects", 10);
-//
-//                             monitor.worked(3);
-//
-//                             display.asyncExec(new Runnable() {
-//
-//                                     @Override
-//                                     public void run() {
-//                                             ConversationHolder conversation = CdmStore.createConversation();
-                                               List<CdmBase> referencingObjects = getReferencingObjects(entity);
-                                               updateView(referencingObjects);
-//                                             conversation.close();
-//                                     }
-//                             });
-//
-//                             monitor.done();
-//
-//
-//                             return Status.OK_STATUS;
-//                     }
-//             };
-//
-//             job.setPriority(Job.DECORATE);
-//             job.schedule();
+               
+               Job job = new Job("Update Referencing Objects") {
+                       
+                       @Override
+                       protected IStatus run(IProgressMonitor monitor) {
+                               monitor.beginTask("Calculating referencing objects", 10);
+                       
+                               monitor.worked(3);
+                               
+                               display.asyncExec(new Runnable() {
+                                       
+                                       @Override
+                                       public void run() {
+                                               if (entityUUID != null){
+                                                       ConversationHolder conversation = CdmStore.createConversation();
+                                                       List<CdmBase> referencingObjects = getReferencingObjects(entityUUID, objectClass);
+                                                       conversation.close();
+                                                       updateView(referencingObjects);
+                                               }
+                                       }
+                               });
+                               
+                               monitor.done();
+                               
+                               
+                               return Status.OK_STATUS;
+                       }
+               };
+               
+               job.setPriority(Job.DECORATE);
+               job.schedule();
        }
 
-       private List<CdmBase> getReferencingObjects(Object entity) {
+       private List<CdmBase> getReferencingObjects(UUID entity, Class objectClass) {
+               CdmBase referencedObject = null;
         try {
-               if(entity instanceof CdmBase){
-                       referencedObject = (CdmBase) entity;
-                       if (referencedObject instanceof TeamOrPersonBase){
-                               referencedObject = CdmStore.getService(IAgentService.class).load(referencedObject.getUuid());
-                       }
+               if (objectClass.getSuperclass().equals(TeamOrPersonBase.class) ){
+                       referencedObject = CdmStore.getService(IAgentService.class).load(entity);
+               } else if (objectClass.getSuperclass().equals(TaxonNameBase.class)){
+                       referencedObject = CdmStore.getService(INameService.class).load(entity);
+               } else if (objectClass.getSuperclass().equals(TaxonBase.class)){
+                       referencedObject = CdmStore.getService(ITaxonService.class).load(entity);
+               } else if (objectClass.getSuperclass().equals(Reference.class)){
+                       referencedObject = CdmStore.getService(IReferenceService.class).load(entity);
+               } else if (objectClass.getSuperclass().equals(SpecimenOrObservationBase.class)){
+                       referencedObject = CdmStore.getService(IOccurrenceService.class).load(entity);
+               } else if (objectClass.isAssignableFrom(User.class)){
+                       referencedObject = CdmStore.getService(IUserService.class).load(entity);
+               } else if (objectClass.isAssignableFrom(Group.class)){
+                       referencedObject = CdmStore.getService(IGroupService.class).load(entity);
+               }
                        //referencedObject =(CdmBase) CdmStore.getService(IIdentifiableEntityService.class).load(referencedObject.getUuid());
-                       Set<CdmBase> setOfReferencingObjects = CdmStore.getService(ICommonService.class).getReferencingObjects(referencedObject);
-                       if (setOfReferencingObjects != null){
-                               List<CdmBase> referencingObjects = new ArrayList<CdmBase>(setOfReferencingObjects);
-
-                               Collections.sort(referencingObjects, new ReferencingClassComparator());
-
-                               return referencingObjects;
-                       }
+               Set<CdmBase> setOfReferencingObjects = null;
+               
+               if (referencedObject != null){
+                       referencedObjectTitleCache = ((IdentifiableEntity)referencedObject).getTitleCache();
+                       setOfReferencingObjects = CdmStore.getService(ICommonService.class).getReferencingObjects(referencedObject);
+               }
+               if (setOfReferencingObjects != null){
+                       List<CdmBase> referencingObjects = new ArrayList<CdmBase>(setOfReferencingObjects);                     
+                       
+                       Collections.sort(referencingObjects, new ReferencingClassComparator());
+                               
+                       return referencingObjects;
+                       
                }
         } catch (Exception e) {
             logger.error("Error retrieving referencing objects", e);
         }
                return null;
        }
-
+       
        class ReferencingClassComparator implements Comparator<CdmBase> {
 
                /* (non-Javadoc)
                 * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
                 */
-               @Override
-        public int compare(CdmBase o1, CdmBase o2) {
+               public int compare(CdmBase o1, CdmBase o2) {
                        String string1 = o1.getClass().getSimpleName();
                        String string2 = o2.getClass().getSimpleName();
                        int classCompare = string1.compareToIgnoreCase(string2);
@@ -177,44 +216,46 @@ public class ReferencingObjectsView extends AbstractCdmViewPart implements INull
                        }
                }
        }
-
+       
        /**
-        *
+        * 
         */
        private void updateView(List<CdmBase> referencingObjects) {
-               viewer.setInput(referencingObjects);
-               setContentDescription("'" + referencedObject + "' is referenced by:");
-               showViewer();
+               if (viewer != null && !viewer.getControl().isDisposed()){
+                       viewer.setInput(referencingObjects);
+                       /*if (referencedObjectTitleCache != null){
+                               setContentDescription("'" + referencedObjectTitleCache + "' is referenced by:");
+                       } else {
+                               setContentDescription("");
+                       }*/
+                       showViewer();
+               }
        }
 
        /** {@inheritDoc} */
-       @Override
-    public void selectionChanged(IWorkbenchPart part, ISelection selection) {
-           if(part==null){
-               return;
-           }
+       public void selectionChanged(IWorkbenchPart part, ISelection selection) {
                if(! (part instanceof BulkEditor)){
                        setContentDescription("");
                        showEmptyPage();
                        return;
                }
-
+               
                if(! (selection instanceof LineSelection)){
                        return;
                }
                LineSelection lineSelection = (LineSelection) selection;
-
+               
                if(lineSelection.size() != 1){
                        return;
                }
-
+                       
                if(! (lineSelection.getFirstElement() instanceof IdentifiableEntity)){
                        return;
                }
-
+               
                showViewer(part, lineSelection);
        }
-
+       
        /* (non-Javadoc)
         * @see eu.etaxonomy.taxeditor.model.AbstractCdmViewPart#showViewer(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
         */
@@ -222,17 +263,17 @@ public class ReferencingObjectsView extends AbstractCdmViewPart implements INull
        @Override
        public void showViewer(IWorkbenchPart part, IStructuredSelection selection) {
                this.part = part;
-
-               updateReferencingObjects((IdentifiableEntity) selection.getFirstElement());
+               
+               updateReferencingObjects(((IdentifiableEntity) selection.getFirstElement()).getUuid(),selection.getFirstElement().getClass() );
        }
-
+       
        /** {@inheritDoc} */
        @Override
        public void dispose() {
                selectionService.removePostSelectionListener(this);
                selectionService.removeSelectionListener(this);
                super.dispose();
-
+               
        }
 
        /* (non-Javadoc)
@@ -252,7 +293,7 @@ public class ReferencingObjectsView extends AbstractCdmViewPart implements INull
        public void changed(Object object) {
                // no editing in this view
        }
-
+       
        /* (non-Javadoc)
         * @see eu.etaxonomy.taxeditor.operations.IPostOperationEnabled#onComplete()
         */
@@ -261,13 +302,13 @@ public class ReferencingObjectsView extends AbstractCdmViewPart implements INull
        public boolean onComplete() {
                return false;
        }
-
+       
        public void refresh(){
                selectionService.removePostSelectionListener(this);
                selectionService.removeSelectionListener(this);
                selectionService.addPostSelectionListener(this);
                selectionService.addSelectionListener(this);
-
+               
        }
 
 
index c622997aa5d878408c93efcf106af684def7cfcc..24ea70f115b96167c99dd03d563d7a841512f8d8 100644 (file)
@@ -653,6 +653,7 @@ public class TaxonNameEditor extends EditorPart implements
        /** {@inheritDoc} */
        @Override
        public void dispose() {
+               conversation.unregisterForDataStoreChanges(this);
                super.dispose();
        }
 
index c9320f10904cb28dd2db065db9cdc837884642fb..5660e6bb669d1eea7d6b1190315090d9416d506a 100644 (file)
@@ -49,6 +49,7 @@ import eu.etaxonomy.cdm.model.description.IDescribable;
 import eu.etaxonomy.cdm.model.description.IndividualsAssociation;
 import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
 import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
 import eu.etaxonomy.taxeditor.editor.EditorUtil;
 import eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditor;
 import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView;
@@ -137,7 +138,7 @@ public class DescriptiveViewPart extends AbstractCdmEditorViewPart implements IP
                             EditorUtil.open(new DerivateViewEditorInput(Collections.singleton(specimen.getUuid())));
                         } catch (PartInitException e) {
                             MessagingUtils.error(DescriptiveViewPart.class, "Could not open Derivate Editor", e);
-                        }
+       }
                     }
 
 
@@ -229,7 +230,7 @@ public class DescriptiveViewPart extends AbstractCdmEditorViewPart implements IP
         }
                if(selection instanceof IStructuredSelection
                        && ((IStructuredSelection) selection).getFirstElement() instanceof IDescribable<?>
-                       && part instanceof IPartContentHasFactualData){
+                       && part instanceof IPartContentHasFactualData  && !(((IStructuredSelection) selection).getFirstElement() instanceof SpecimenOrObservationBase && part instanceof BulkEditor)){
                    featureNodeContainerCache.clear();
                    showViewer(part, (IStructuredSelection) selection);
                    return;
@@ -307,6 +308,9 @@ public class DescriptiveViewPart extends AbstractCdmEditorViewPart implements IP
                        StructuredSelection selection = new StructuredSelection(object);
                        viewer.setSelection(selection, true);
                }
+               if(part instanceof BulkEditor && !(object instanceof SpecimenOrObservationBase<?>)){
+                   ((BulkEditor) part).forceDirty();
+               }
 
                super.changed(object);
        }
index 2f33924064864a8392e22b8b7f3951672c5fda8f..0d743e1026a21d5e2e000b3c68d2a15939898b49 100644 (file)
@@ -13,6 +13,7 @@ import org.eclipse.core.commands.AbstractHandler;
 import org.eclipse.core.commands.ExecutionEvent;
 import org.eclipse.core.commands.ExecutionException;
 import org.eclipse.core.commands.common.NotDefinedException;
+import org.eclipse.core.expressions.EvaluationContext;
 import org.eclipse.ui.IEditorInput;
 import org.eclipse.ui.IEditorPart;
 import org.eclipse.ui.IWorkbenchPart;
@@ -21,6 +22,7 @@ import org.eclipse.ui.handlers.HandlerUtil;
 
 import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
 import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.cdm.model.taxon.TaxonBase;
 import eu.etaxonomy.taxeditor.editor.EditorUtil;
 import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
 import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptiveViewPart;
@@ -77,6 +79,15 @@ public class CreateDescriptionHandler extends AbstractHandler {
                            MessagingUtils.warn(getClass(), "Command name not set.");
                        }
                    }
+                   if(viewerInput instanceof TaxonBase){
+                       try{
+                               operation = createTaxonOperation(event.getCommand().getName(), (Taxon) viewerInput, postOperationEnabled);
+                           AbstractUtility.executeOperation(operation);
+                        } catch (NotDefinedException e) {
+                                   MessagingUtils.warn(getClass(), "Command name not set.");
+                            }
+                       
+                   }
                }
                return null;
        }
index d544df5fbdeedeb1c6c1c7b3d681b7218f56156b..cd780fc68c5d3f0d2e66420cae3c283d081f1aaf 100644 (file)
@@ -116,8 +116,9 @@ public class DetailsViewPart extends AbstractCdmEditorViewPart implements IPartC
        /** {@inheritDoc} */
        @Override
        public void dispose() {
-               super.dispose();
                selectionService.removePostSelectionListener(this);
+               super.dispose();
+               
        }
 
        /**