Introduces a handler to delete all empty names; Cleans up the name editors context...
authorn.hoffmann <n.hoffmann@localhost>
Fri, 28 Jan 2011 16:48:01 +0000 (16:48 +0000)
committern.hoffmann <n.hoffmann@localhost>
Fri, 28 Jan 2011 16:48:01 +0000 (16:48 +0000)
15 files changed:
.gitattributes
taxeditor-editor/plugin.xml
taxeditor-editor/src/main/java/eu/etaxonomy/taxeditor/editor/MultiPageTaxonEditor.java
taxeditor-editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/TaxonNameEditor.java
taxeditor-editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/CreateHomotypicSynonymHandler.java
taxeditor-editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/DeleteAllEmptyNamesHandler.java [new file with mode: 0644]
taxeditor-editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/DeleteTaxonBaseHandler.java
taxeditor-editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/NameEditorMenuPropertyTester.java
taxeditor-editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/ConceptViewPart.java
taxeditor-editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/DeleteConceptRelationHandler.java
taxeditor-editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/DeleteHandler.java
taxeditor-editor/src/main/java/eu/etaxonomy/taxeditor/section/AbstractCdmDetailSection.java
taxeditor-editor/src/main/java/eu/etaxonomy/taxeditor/section/name/NameDetailElement.java
taxeditor-editor/src/main/java/eu/etaxonomy/taxeditor/section/name/NonViralNameDetailElement.java
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/preference/wizard/VocabularyTermWizard.java

index 162555bfd3a9db82d8226e61d70af5037030fc4d..587665351ee34027318286b5837fee3142f76dfe 100644 (file)
@@ -408,6 +408,7 @@ taxeditor-editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/Create
 taxeditor-editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/CreateHomotypicSynonymHandler.java -text
 taxeditor-editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/CreateMisapplicationHandler.java -text
 taxeditor-editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/CreateSynonymInHomotypicalGroupHandler.java -text
+taxeditor-editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/DeleteAllEmptyNamesHandler.java -text
 taxeditor-editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/DeleteTaxonBaseHandler.java -text
 taxeditor-editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/GroupBasionymContributionItem.java -text
 taxeditor-editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/NameEditorMenuPropertyTester.java -text
index 5ed9dcce5e231727831337072cbf271d36b9114c..0d4e2910a755a32adc0bd370afe3f1463e0a1a39 100644 (file)
                      name="separator1"
                      visible="true">
                </separator>
-               <menu
-                     label="Concept Relation">
-                  <visibleWhen>
-                     <or>
-                        <reference
-                              definitionId="isAcceptedTaxon">
-                        </reference>
-                        <reference
-                              definitionId="isConceptRelation">
-                        </reference>
-                     </or>
-                  </visibleWhen>
-                  <dynamic
-                        class="eu.etaxonomy.taxeditor.editor.name.handler.CreateConceptRelationMenu"
-                        id="eu.etaxonomy.taxeditor.editor.dynamicConceptRelationMenu">
-                  </dynamic>
-               </menu>
                <command
                      commandId="eu.etaxonomy.taxeditor.editor.name.createMisapplication"
                      label="Misapplication"
                            <reference
                                  definitionId="isAcceptedTaxon">
                            </reference>
-                           <reference
-                                 definitionId="isConceptRelation">
-                           </reference>
                            <reference
                                  definitionId="isMisapplication">
                            </reference>
                   </visibleWhen>
                </command>
             </menu>
-            <menu
-                  label="Change Relation Type">
-               <visibleWhen>
-                  <reference
-                        definitionId="isConceptRelation">
-                  </reference>
-               </visibleWhen>
-               <dynamic
-                     class="eu.etaxonomy.taxeditor.editor.view.concept.handler.ChangeConceptRelationshipTypeMenu"
-                     id="eu.etaxonomy.taxeditor.editor.dynamicConceptRelationMenu">
-               </dynamic>
-            </menu>
             <separator
                   name="taxeditor-editor.separator1"
                   visible="true">
                   </or>
                </visibleWhen>
             </command>
+            <command
+                  commandId="eu.etaxonomy.taxeditor.editor.name.deleteAllEmptyNames"
+                  label="Delete All Empty Names"
+                  style="push">
+               <visibleWhen>
+                  <reference
+                        definitionId="hasEmptyNames">
+                  </reference>
+               </visibleWhen>
+            </command>
             <separator
                   name="taxeditor-editor.separator2"
                   visible="true">
             id="eu.etaxonomy.taxeditor.editor.name.changeToAcceptedTaxon"
             name="Change To Accepted Taxon">
       </command>
-      <command
-            defaultHandler="eu.etaxonomy.taxeditor.editor.name.handler.ChangeToConceptRelationHandler"
-            id="eu.etaxonomy.taxeditor.editor.name.changeToConceptRelation"
-            name="Change To Concept Relation">
-      </command>
       <command
             defaultHandler="eu.etaxonomy.taxeditor.editor.name.handler.ChangeToMisapplicationHandler"
             id="eu.etaxonomy.taxeditor.editor.name.changeToMisapplication"
             name="Change To Misapplication">
       </command>
-      <command
-            defaultHandler="eu.etaxonomy.taxeditor.editor.view.concept.handler.ChangeConceptRelationshipTypeHandler"
-            id="eu.etaxonomy.taxeditor.editor.name.changeConceptRelationshipType"
-            name="Change Concept Relationship Type">
-      </command>
       <command
             defaultHandler="eu.etaxonomy.taxeditor.editor.name.handler.SwapSynonymAndAcceptedHandler"
             id="eu.etaxonomy.taxeditor.editor.name.swapSynonymAndAccepted"
             id="eu.etaxonomy.taxeditor.editor.name.changeAcceptedToSynonym"
             name="Change Accepted Taxon to Synonym">
       </command>
+      <command
+            defaultHandler="eu.etaxonomy.taxeditor.editor.name.handler.DeleteAllEmptyNamesHandler"
+            id="eu.etaxonomy.taxeditor.editor.name.deleteAllEmptyNames"
+            name="Delete All Empty Names">
+      </command>
    </extension>
    <extension
          point="org.eclipse.core.expressions.definitions">
       <definition
             id="isAcceptedTaxon">
          <with
-               variable="activeMenuSelection">
+               variable="selection">
             <test
                   property="eu.etaxonomy.taxeditor.editor.name.propertyTester.isAcceptedTaxon">
             </test>
       <definition
             id="isSynonym">
          <with
-               variable="activeMenuSelection">
+               variable="selection">
             <test
                   property="eu.etaxonomy.taxeditor.editor.name.propertyTester.isSynonym">
             </test>
       <definition
             id="isMisapplication">
          <with
-               variable="activeMenuSelection">
+               variable="selection">
             <test
                   property="eu.etaxonomy.taxeditor.editor.name.propertyTester.isMisapplication">
             </test>
          </with>
       </definition>
       <definition
-            id="isConceptRelation">
+            id="isTaxonBase">
          <with
-               variable="activeMenuSelection">
+               variable="selection">
             <test
-                  property="eu.etaxonomy.taxeditor.editor.name.propertyTester.isConceptRelation">
+                  property="eu.etaxonomy.taxeditor.editor.name.propertyTester.isTaxonBase">
             </test>
          </with>
       </definition>
       <definition
-            id="isTaxonBase">
+            id="hasEmptyNames">
          <with
-               variable="activeMenuSelection">
+               variable="selection">
             <test
-                  property="eu.etaxonomy.taxeditor.editor.name.propertyTester.isTaxonBase">
+                  property="eu.etaxonomy.taxeditor.editor.name.propertyTester.hasEmptyNames">
             </test>
          </with>
       </definition>
             class="eu.etaxonomy.taxeditor.editor.name.handler.NameEditorMenuPropertyTester"
             id="eu.etaxonomy.taxeditor.editor.name.propertyTester"
             namespace="eu.etaxonomy.taxeditor.editor.name.propertyTester"
-            properties="isAcceptedTaxon,isSynonym,isMisapplication,isTaxonBase,isConceptRelation"
+            properties="isAcceptedTaxon,isSynonym,isMisapplication,isTaxonBase,hasEmptyNames"
             type="org.eclipse.jface.viewers.IStructuredSelection">
       </propertyTester>
    </extension>
          <definition
                id="isDeletable">
             <with
-                  variable="activeMenuSelection">
+                  variable="selection">
                <test
                      property="eu.etaxonomy.taxeditor.descriptions.propertyTester.isDeletable">
                </test>
          <definition
                id="isMedia">
             <with
-                  variable="activeMenuSelection">
+                  variable="selection">
                <test
                      property="eu.etaxonomy.taxeditor.descriptions.propertyTester.isMedia">
                </test>
          <definition
                id="isDescription">
             <with
-                  variable="activeMenuSelection">
+                  variable="selection">
                <test
                      property="eu.etaxonomy.taxeditor.descriptions.propertyTester.isDescription">
                </test>
          <definition
                id="isDescriptionElement">
             <with
-                  variable="activeMenuSelection">
+                  variable="selection">
                <test
                      property="eu.etaxonomy.taxeditor.descriptions.propertyTester.isDescriptionElement">
                </test>
          <definition
                id="isFeatureNodeContainer">
             <with
-                  variable="activeMenuSelection">
+                  variable="selection">
                <test
                      property="eu.etaxonomy.taxeditor.descriptions.propertyTester.isFeatureNodeContainer">
                </test>
          <handler
                class="eu.etaxonomy.taxeditor.editor.view.concept.handler.DeleteConceptRelationHandler"
                commandId="org.eclipse.ui.edit.delete">
+            <activeWhen>
+               <with
+                     variable="activePartId">
+                  <equals
+                        value="eu.etaxonomy.taxeditor.editor.view.concept">
+                  </equals>
+               </with>
+            </activeWhen>
          </handler>
       </extension>
 </plugin>
index 9aade67d3e4bd44213972a83bac7aad40bd52c63..40d94f879ab75d6119b5fb959bfbd25ec1d01b72 100644 (file)
@@ -16,6 +16,7 @@ import java.util.UUID;
 import org.eclipse.core.commands.operations.IUndoContext;
 import org.eclipse.core.commands.operations.UndoContext;
 import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.ui.IEditorInput;
 import org.eclipse.ui.IEditorPart;
 import org.eclipse.ui.IEditorSite;
@@ -115,7 +116,8 @@ public class MultiPageTaxonEditor extends FormEditor implements IConversationEna
                        for(IEditorPart editorPage : getPages()){
                                if(editorPage instanceof TaxonNameEditor){
                                        if(((TaxonNameEditor) editorPage).checkForEmptyNames()){
-                                               // abort
+                                               MessageDialog.openWarning(EditorUtil.getShell(), "No Name Specified", "An attempt was made to save a taxon or synonym with " +
+                                               "an empty name. Operation was cancelled.");
                                                return;
                                        }
                                }
index ba6295d4f269f5adb8b3568c97482f12de413a09..cc5f95fbdbe07a12360223effae774cfa067ddea 100644 (file)
@@ -14,6 +14,7 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
+import org.apache.commons.lang.StringUtils;
 import org.eclipse.core.commands.operations.IUndoContext;
 import org.eclipse.core.runtime.IAdaptable;
 import org.eclipse.core.runtime.IProgressMonitor;
@@ -369,15 +370,26 @@ public class TaxonNameEditor extends EditorPart implements IMultiPageTaxonEditor
         */
        public boolean checkForEmptyNames() {
                for(AbstractGroupedContainer container : getGroupedContainers()){
-                       if(container.getName() == null || container.getName().getTitleCache().equals("")){
-                               MessageDialog.openWarning(EditorUtil.getShell(), "No Name Specified", "An attempt was made to save a taxon or synonym with " +
-                               "an empty name. Operation was cancelled.");
+                       if(container.getName() == null || StringUtils.isEmpty(container.getName().getTitleCache())){
                                return true;
                        }
                }
                return false;
        }
     
+
+       public Set<AbstractGroupedContainer> getEmptyContainers(){
+               Set<AbstractGroupedContainer> containersWithEmptyNames = new HashSet<AbstractGroupedContainer>();
+               
+               for(AbstractGroupedContainer container : getGroupedContainers()){
+                       if(container.getName() == null || StringUtils.isEmpty(container.getName().getTitleCache())){
+                               containersWithEmptyNames.add(container);
+                       }
+               }
+               
+               return containersWithEmptyNames;
+       }
+       
        /** {@inheritDoc} */
        @Override
        public void doSave(IProgressMonitor monitor) {
@@ -750,8 +762,6 @@ public class TaxonNameEditor extends EditorPart implements IMultiPageTaxonEditor
                }
        }
 
-
-
        /**
         * @param element
         * @return
index a926d9a2ab1b0b166d04bd4ab35bfaac2ab26ae3..514d9dcae5554b00650d49971655d25e6b59acbf 100644 (file)
@@ -9,7 +9,6 @@
 
 package eu.etaxonomy.taxeditor.editor.name.handler;
 
-import org.apache.log4j.Logger;
 import org.eclipse.core.commands.AbstractHandler;
 import org.eclipse.core.commands.ExecutionEvent;
 import org.eclipse.core.commands.ExecutionException;
@@ -35,8 +34,6 @@ import eu.etaxonomy.taxeditor.parser.ParseHandler;
  */
 public class CreateHomotypicSynonymHandler extends AbstractHandler implements
                IHandler {
-       private static final Logger logger = Logger
-                       .getLogger(CreateHomotypicSynonymHandler.class);
 
        /* (non-Javadoc)
         * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
@@ -55,7 +52,7 @@ public class CreateHomotypicSynonymHandler extends AbstractHandler implements
                                        editor.getUndoContext(), taxon, group, newSynonymName, editor);
                        EditorUtil.executeOperation(operation);
                } catch (NotDefinedException e) {
-                       logger.warn("Command name not set");
+                       EditorUtil.error(getClass(), e);
                }
                
 
diff --git a/taxeditor-editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/DeleteAllEmptyNamesHandler.java b/taxeditor-editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/DeleteAllEmptyNamesHandler.java
new file mode 100644 (file)
index 0000000..009edab
--- /dev/null
@@ -0,0 +1,43 @@
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* 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.
+*/
+
+package eu.etaxonomy.taxeditor.editor.name.handler;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+
+import eu.etaxonomy.cdm.model.taxon.TaxonBase;
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.editor.Page;
+import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;
+import eu.etaxonomy.taxeditor.editor.name.container.AbstractGroupedContainer;
+
+/**
+ * @author n.hoffmann
+ * @created Jan 28, 2011
+ * @version 1.0
+ */
+public class DeleteAllEmptyNamesHandler extends DeleteTaxonBaseHandler {
+
+       /* (non-Javadoc)
+        * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+        */
+       @Override
+       public Object execute(ExecutionEvent event) throws ExecutionException {
+               TaxonNameEditor editor = (TaxonNameEditor) EditorUtil.getActiveEditorPage(Page.NAME);
+
+               for(AbstractGroupedContainer<TaxonBase> containerWithEmptyName : editor.getEmptyContainers()){
+                       doExecute(event, editor, containerWithEmptyName.getData());
+               }
+               
+               return null;
+       }
+
+}
index adf0798134375d28c1a5deaaa7237994c2cb3064..1d3678ee3f4d8d0df1bcff6e7ef771a6213127c0 100644 (file)
@@ -8,7 +8,6 @@
 */
 
 package eu.etaxonomy.taxeditor.editor.name.handler;
-import org.apache.log4j.Logger;
 import org.eclipse.core.commands.AbstractHandler;
 import org.eclipse.core.commands.ExecutionEvent;
 import org.eclipse.core.commands.ExecutionException;
@@ -22,7 +21,6 @@ import eu.etaxonomy.taxeditor.editor.Page;
 import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;
 import eu.etaxonomy.taxeditor.editor.name.operation.DeleteMisapplicationOperation;
 import eu.etaxonomy.taxeditor.editor.name.operation.DeleteSynonymOperation;
-import eu.etaxonomy.taxeditor.editor.view.concept.operation.DeleteConceptRelationOperation;
 import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
 
 /**
@@ -33,8 +31,7 @@ import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
  * @version 1.0
  */
 public class DeleteTaxonBaseHandler extends AbstractHandler implements IHandler {
-       private static final Logger logger = Logger
-                                                               .getLogger(DeleteTaxonBaseHandler.class);
+
        /* (non-Javadoc)
         * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
         */
@@ -44,18 +41,27 @@ public class DeleteTaxonBaseHandler extends AbstractHandler implements IHandler
                                
                Object selectedElement = EditorUtil.getSelection(event).getFirstElement();
                
-               AbstractPostOperation operation = null;
-               String commandName = null;
-               
+               doExecute(event, editor, selectedElement);
                
+               return null;
+       }
+       
+       /**
+        * @param editor
+        * @param selectedElement
+        * @param operation
+        * @param commandName
+        */
+       protected void doExecute(ExecutionEvent event, TaxonNameEditor editor, Object selectedElement) {
+               AbstractPostOperation operation = null;
+               String commandName = null;              
+
                try {
                        commandName = event.getCommand().getName();
                } catch (NotDefinedException e) {
-                       logger.error(e);
-                       throw new RuntimeException(e);
+                       EditorUtil.error(getClass(), e);
                }
                
-               
                // synonym
                if(selectedElement instanceof Synonym){
                        operation = new DeleteSynonymOperation(commandName, editor.getUndoContext(), editor.getTaxon(), (Synonym) selectedElement, editor);
@@ -70,8 +76,6 @@ public class DeleteTaxonBaseHandler extends AbstractHandler implements IHandler
                }
                                
                EditorUtil.executeOperation(operation);
-               
-               return null;
        }
 
 }
index b30d362e7d0a21f4e48f6f37d399547f66d1f1fa..59ae7296b4ea8a945861f74e21fcf33fd2b3d096 100644 (file)
@@ -12,10 +12,14 @@ package eu.etaxonomy.taxeditor.editor.name.handler;
 
 import org.apache.log4j.Logger;
 import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IEditorPart;
 
 import eu.etaxonomy.cdm.model.taxon.Synonym;
 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.Page;
+import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;
 
 /**
  * <p>NameEditorMenuPropertyTester class.</p>
@@ -25,13 +29,13 @@ import eu.etaxonomy.cdm.model.taxon.TaxonBase;
  * @version 1.0
  */
 public class NameEditorMenuPropertyTester extends org.eclipse.core.expressions.PropertyTester {
-       private static final Logger logger = Logger.getLogger(NameEditorMenuPropertyTester.class);
 
        private static final String ACCEPTED = "isAcceptedTaxon";
        private static final String SYNONYM = "isSynonym";
        private static final String MISAPPLICATION = "isMisapplication";
        private static final String TAXONBASE = "isTaxonBase";
        private static final String CONCEPT = "isConceptRelation";
+       private static final String EMPTY_NAMES = "hasEmptyNames";
        
        /**
         * <p>Constructor for NameEditorMenuPropertyTester.</p>
@@ -46,32 +50,42 @@ public class NameEditorMenuPropertyTester extends org.eclipse.core.expressions.P
        public boolean test(Object receiver, String property, Object[] args,
                        Object expectedValue) {
                
-               if(!(receiver instanceof IStructuredSelection)){
-                       return false;
+               if(receiver instanceof IStructuredSelection){
+                       
+                       IStructuredSelection selection = (IStructuredSelection) receiver;
+                       
+                       Object selectedElement = selection.getFirstElement();
+                       
+                       if(ACCEPTED.equals(property)){
+                               return isAccepted(selectedElement);
+                       }
+                       else if(SYNONYM.equals(property)){
+                               return isSynonym(selectedElement);
+                       }
+                       else if(MISAPPLICATION.equals(property)){
+                               return isMisapplication(selectedElement);
+                       }
+                       else if(TAXONBASE.equals(property)){
+                               return isTaxonBase(selectedElement);
+                       }
+                       else if(CONCEPT.equals(property)){
+                               return isRelatedConcept(selectedElement);
+                       }
+                       else if(EMPTY_NAMES.equals(property)){
+                               return hasEmptyNames(receiver);
+                       }
                }
                
-               IStructuredSelection selection = (IStructuredSelection) receiver;
-               
-               Object selectedElement = selection.getFirstElement();
+               return false;
                
-               if(ACCEPTED.equals(property)){
-                       return isAccepted(selectedElement);
-               }
-               else if(SYNONYM.equals(property)){
-                       return isSynonym(selectedElement);
-               }
-               else if(MISAPPLICATION.equals(property)){
-                       return isMisapplication(selectedElement);
-               }
-               else if(TAXONBASE.equals(property)){
-                       return isTaxonBase(selectedElement);
-               }
-               else if(CONCEPT.equals(property)){
-                       return isRelatedConcept(selectedElement);
-               }
-               else{
-                       return false;
-               }
+       }
+
+       /**
+        * @param receiver
+        * @return
+        */
+       private boolean hasEmptyNames(Object receiver) {
+               return ((TaxonNameEditor) EditorUtil.getActiveEditorPage(Page.NAME)).checkForEmptyNames();
        }
 
        private boolean isRelatedConcept(Object selectedElement) {
@@ -97,6 +111,6 @@ public class NameEditorMenuPropertyTester extends org.eclipse.core.expressions.P
        }
 
        private boolean isAccepted(Object selectedElement) {
-               return (selectedElement instanceof Taxon  && ! ((Taxon) selectedElement).isRelatedConcept() && ! ((Taxon) selectedElement).isMisapplication()) ? true : false;
+               return (selectedElement instanceof Taxon  && ! ((Taxon) selectedElement).isMisapplication()) ? true : false;
        }
 }
index 72426bea715bd83b27b070d81ad67e94752e6597..dea4553a524bde7f630af2cdcd2910645d937dbf 100644 (file)
@@ -101,6 +101,8 @@ public class ConceptViewPart extends AbstractCdmEditorViewPart {
                
                viewer.setSorter(new ConceptViewerSorter());
                
+               getSite().setSelectionProvider(viewer);
+               
                createMenu();
                
                createToolbar();
index 33655414370bf74833e0657be0dab3613e164036..bc5a8eb654d170c85e8b185fb0c97036feccff67 100644 (file)
@@ -46,7 +46,7 @@ public class DeleteConceptRelationHandler extends AbstractHandler {
                TaxonNameEditor editor = (TaxonNameEditor) EditorUtil.getActiveEditorPage(
                                Page.NAME);
                
-               ISelection selection = HandlerUtil.getActiveMenuSelection(event);
+               ISelection selection = HandlerUtil.getActiveSite(event).getSelectionProvider().getSelection();
                
                Set<TaxonRelationship> relations = new HashSet<TaxonRelationship>();
                
index 0e8324c4ebe724b7a61cbcf75b6fa7c622a41988..04fbab44f75cd005592cd878bc4129cc8f91d778 100644 (file)
@@ -49,7 +49,7 @@ public class DeleteHandler extends AbstractHandler {
         */
        /** {@inheritDoc} */
        public Object execute(ExecutionEvent event) throws ExecutionException {
-               IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getActiveMenuSelection(event);
+               IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getActiveSite(event).getSelectionProvider().getSelection();
 
                IWorkbenchPart part = HandlerUtil.getActivePart(event);
                IPostOperationEnabled postOperationEnabled = (part instanceof IPostOperationEnabled) ? (IPostOperationEnabled) part : null;
@@ -77,12 +77,12 @@ public class DeleteHandler extends AbstractHandler {
                                        List<DescriptionElementBase> descriptions = ((FeatureNodeContainer) object).getDescriptionElementsForEntireBranch();
                                        
                                        for(DescriptionElementBase description : descriptions){
-                                               operations.add(new DeleteDescriptionElementOperation(label, undoContext, (DescriptionElementBase) object, postOperationEnabled)); 
+                                               operations.add(new DeleteDescriptionElementOperation(label, undoContext, description, postOperationEnabled)); 
                                        }
                                }
                                // Media
                                else if(object instanceof Media){
-                                       TreeSelection treeSelection = (TreeSelection) HandlerUtil.getActiveMenuSelection(event);
+                                       TreeSelection treeSelection = (TreeSelection) selection;
                                        
                                        TreePath[] path = treeSelection.getPathsFor(object);
                                        
index ab8995e51c3f1421c9a4f3816db5605ccf286ae1..82cb3e6f620ca5911dcee974329febe33b0d0824 100644 (file)
@@ -21,7 +21,6 @@ import org.eclipse.ui.forms.widgets.Section;
 import org.eclipse.ui.forms.widgets.TableWrapLayout;
 
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.model.common.IAnnotatableEntity;
 import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
 import eu.etaxonomy.taxeditor.forms.AbstractFormSection;
 import eu.etaxonomy.taxeditor.forms.CdmFormFactory;
@@ -29,7 +28,6 @@ import eu.etaxonomy.taxeditor.forms.CdmFormFactory.DetailType;
 import eu.etaxonomy.taxeditor.forms.ICdmFormElement;
 import eu.etaxonomy.taxeditor.forms.IEnableableFormElement;
 import eu.etaxonomy.taxeditor.forms.ISelectableElement;
-import eu.etaxonomy.taxeditor.forms.SelectionArbitrator;
 
 /**
  * <p>Abstract AbstractCdmDetailSection class.</p>
@@ -42,8 +40,6 @@ public abstract class AbstractCdmDetailSection<ENTITY> extends AbstractFormSecti
        
        protected AbstractCdmDetailElement<ENTITY> detailElement;
        
-       protected SelectionArbitrator selectionArbitrator;
-       
        /**
         * <p>Constructor for AbstractCdmDetailSection.</p>
         *
@@ -99,7 +95,10 @@ public abstract class AbstractCdmDetailSection<ENTITY> extends AbstractFormSecti
        @Override
        public void dispose() {
                if(detailElement instanceof ISelectableElement){
-                       formFactory.destroySelectionArbitrator(((ISelectableElement)detailElement).getSelectionArbitrator());
+                       ISelectableElement selectableElement = (ISelectableElement) detailElement;
+                       if(selectableElement.getSelectionArbitrator() != null){
+                               formFactory.destroySelectionArbitrator(selectableElement.getSelectionArbitrator());
+                       }
                }
                super.dispose();
        }
index 27794d7694eb23f4b11bb1962e0f3b2c830268d7..80d68c9c2dd3ce83d38685b1f3f4b40f9a14af14 100644 (file)
@@ -30,7 +30,6 @@ import eu.etaxonomy.taxeditor.forms.CheckboxElement;
 import eu.etaxonomy.taxeditor.forms.ICdmFormElement;
 import eu.etaxonomy.taxeditor.forms.IEnableableFormElement;
 import eu.etaxonomy.taxeditor.forms.ISelectableElement;
-import eu.etaxonomy.taxeditor.forms.LabelElement;
 import eu.etaxonomy.taxeditor.forms.NumberWithLabelElement;
 import eu.etaxonomy.taxeditor.forms.SelectionArbitrator;
 import eu.etaxonomy.taxeditor.forms.TextWithLabelElement;
@@ -189,14 +188,6 @@ public class NameDetailElement extends AbstractCdmDetailElement<NonViralName> im
                if(eventSource == combo_rank){
                        getEntity().setRank(combo_rank.getSelection());
                        clearCheckRankWarnings();       
-                       // TODO
-//                     logger.warn("Refreshing the details view at this stage may lead to 'Widget is disposed' errors. They can be ignored.");
-                       try{
-                               EditorUtil.refreshDetailsViewer();
-                               getParentElement().getParentElement().getParentElement().refresh();
-                       }catch(SWTException e){
-                               // ignore
-                       }
                }               
                else if(eventSource == text_appendedPhrase){
                        getEntity().setAppendedPhrase(text_appendedPhrase.getText());
index fe310970f5850cd5eee15e38be60f4d47102c7e6..b1ad97843bd769c2e9ca8a18057921ca619457e8 100644 (file)
@@ -133,5 +133,9 @@ public class NonViralNameDetailElement extends AbstractCdmDetailElement<NonViral
                                toggleable_cache.setText(getEntity().getTitleCache());
                        }
                }
+               if(eventSource == section_name){
+                       section_name.setEntity(getEntity());
+                       getLayoutComposite().layout();
+               }
        }
 }
index 4226d3e40b92c30143c4df1b22da7ce842d60ad8..aef968d20521226352de5578e279d222f6891f46 100644 (file)
@@ -86,7 +86,6 @@ public class VocabularyTermWizard<T extends DefinedTermBase> extends Wizard impl
                }
                
                getConversationHolder().commit(true);
-//             getConversationHolder().close();
                
                return true;
        }