Fixes #2358
authorn.hoffmann <n.hoffmann@localhost>
Wed, 4 May 2011 16:41:40 +0000 (16:41 +0000)
committern.hoffmann <n.hoffmann@localhost>
Wed, 4 May 2011 16:41:40 +0000 (16:41 +0000)
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/ChangeAcceptedTaxonToSynonymHandler.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/ChangeSynonymToAcceptedTaxonHandler.java
eu.etaxonomy.taxeditor.feature/buckminster.cspex
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/MoveTaxonHandler.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialogs/filteredSelection/TaxonBaseSelectionDialog.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialogs/filteredSelection/TaxonNodeSelectionDialog.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/classification/TaxonNodeDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/TaxonNodeSelectionElement.java

index 3b4ff58e83a3c5f22132a8a444d7fb1d71da1b42..ca896c33cba837baa77c6de12e9148c2496a6325 100644 (file)
@@ -57,7 +57,7 @@ public class ChangeAcceptedTaxonToSynonymHandler extends AbstractHandler
                // Choose new accepted taxon    
                List<UUID> excludeTaxa = new ArrayList<UUID>();
                excludeTaxa.add(oldAcceptedTaxonNode.getUuid());
                // Choose new accepted taxon    
                List<UUID> excludeTaxa = new ArrayList<UUID>();
                excludeTaxa.add(oldAcceptedTaxonNode.getUuid());
-               TaxonNode newAcceptedTaxonNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event), editor.getConversationHolder(), "Choose the accepted taxon", excludeTaxa, null);
+               TaxonNode newAcceptedTaxonNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event), editor.getConversationHolder(), "Choose the accepted taxon", excludeTaxa, null, null);
 
                if (newAcceptedTaxonNode == null) {
                        return null;
 
                if (newAcceptedTaxonNode == null) {
                        return null;
index 915d6ef6b10340777cdbb34666c52fa8a94d69da..00ab39b944f009056a7108c28e5c574fc764f9ec 100644 (file)
@@ -83,7 +83,7 @@ public class ChangeSynonymToAcceptedTaxonHandler extends AbstractHandler impleme
                
                List<UUID> excludeTaxa = null;
                
                
                List<UUID> excludeTaxa = null;
                
-               TaxonNode newParentNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event), editor.getConversationHolder(), "Select parent", excludeTaxa, null);
+               TaxonNode newParentNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event), editor.getConversationHolder(), "Select parent", excludeTaxa, null, null);
                
                if(newParentNode != null){
                        
                
                if(newParentNode != null){
                        
index e109f90e3e4abf9ee01caeac478f005f89e5e629..a44548434d4c431adcbc2176e1e86f0f92856fec 100644 (file)
@@ -4,15 +4,15 @@
        xmlns="http://www.eclipse.org/buckminster/CSpec-1.0">
 
        <actions>
        xmlns="http://www.eclipse.org/buckminster/CSpec-1.0">
 
        <actions>
-           <public name="package.cdmlib" actor="ant">
+           <!--<public name="package.cdmlib" actor="ant">
                <actorProperties>
                    <property key="buildFile" value="build/package.ant"/>
                    <property key="targets" value="package.cdmlib"/>
                </actorProperties>
                <actorProperties>
                    <property key="buildFile" value="build/package.ant"/>
                    <property key="targets" value="package.cdmlib"/>
                </actorProperties>
-               <prerequisites>
+               <prerequisites alias="action.requirements">
                    <attribute name="copy.plugins"/>
                </prerequisites>
                    <attribute name="copy.plugins"/>
                </prerequisites>
-           </public>
+           </public>-->
                <public name="create.product" actor="ant">
             <actorProperties>
                 <property key="buildFile" value="build/product.ant"/>
                <public name="create.product" actor="ant">
             <actorProperties>
                 <property key="buildFile" value="build/product.ant"/>
index 87d1f5828b212db5b385d949e1252fbaaba93736..2fcb4d7ec8e12ecb10bfd3cee9fdbe8a6d02b15f 100644 (file)
@@ -69,7 +69,7 @@ public class MoveTaxonHandler extends AbstractHandler implements IPostOperationE
                
 //             TaxonNode taxonNode = (TaxonNode) selection.getFirstElement();
                
                
 //             TaxonNode taxonNode = (TaxonNode) selection.getFirstElement();
                
-               parentTaxonNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event), taxonNavigator.getConversationHolder(), "Choose new parent", excludeTaxa, null);
+               parentTaxonNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event), taxonNavigator.getConversationHolder(), "Choose new parent", excludeTaxa, null, null);
                                
                if(parentTaxonNode != null){
                        if(NavigationUtil.isDirty(parentTaxonNode)){
                                
                if(parentTaxonNode != null){
                        if(NavigationUtil.isDirty(parentTaxonNode)){
index 16b8948e6ffd7769c88828c421f3d6acb552fa17..24114bba424641f8659ee9fedc8182efcd28a498 100644 (file)
@@ -73,7 +73,7 @@ public class TaxonBaseSelectionDialog extends
                return (Synonym) getSelectionFromDialog(dialog);
        }
 
                return (Synonym) getSelectionFromDialog(dialog);
        }
 
-       private Class<? extends TaxonBase> clazz;
+       private final Class<? extends TaxonBase> clazz;
        
        /**
         * <p>Constructor for FilteredTaxonBaseSelectionDialog.</p>
        
        /**
         * <p>Constructor for FilteredTaxonBaseSelectionDialog.</p>
index e5699e0eac5e32c86fcd12c4161105e47618cd30..b9a83821404f6dcf76e75970b69168162326c00d 100644 (file)
@@ -43,13 +43,14 @@ public class TaxonNodeSelectionDialog extends AbstractFilteredCdmResourceSelecti
         * @param node a {@link eu.etaxonomy.cdm.model.taxon.TaxonNode} object.
         * @return a {@link eu.etaxonomy.cdm.model.taxon.TaxonNode} object.
         */
         * @param node a {@link eu.etaxonomy.cdm.model.taxon.TaxonNode} object.
         * @return a {@link eu.etaxonomy.cdm.model.taxon.TaxonNode} object.
         */
-       public static TaxonNode select(Shell shell, ConversationHolder conversation, String title, List<UUID> excludeTaxa, TaxonNode node) {
+       public static TaxonNode select(Shell shell, ConversationHolder conversation, String title, List<UUID> excludeTaxa, TaxonNode node, Classification classification) {
                TaxonNodeSelectionDialog dialog = new TaxonNodeSelectionDialog(shell, 
                                conversation,
                                title,
                                excludeTaxa,
                                false,
                TaxonNodeSelectionDialog dialog = new TaxonNodeSelectionDialog(shell, 
                                conversation,
                                title,
                                excludeTaxa,
                                false,
-                               node);
+                               node,
+                               classification);
                return getSelectionFromDialog(dialog);
        }
 
                return getSelectionFromDialog(dialog);
        }
 
@@ -58,6 +59,8 @@ public class TaxonNodeSelectionDialog extends AbstractFilteredCdmResourceSelecti
        private List<Classification> classifications;
        
        private Classification selectedClassification;
        private List<Classification> classifications;
        
        private Classification selectedClassification;
+
+       private final Classification defaultClassification;
        
 
        /**
        
 
        /**
@@ -70,7 +73,7 @@ public class TaxonNodeSelectionDialog extends AbstractFilteredCdmResourceSelecti
         * @param multi a boolean.
         * @param node a {@link eu.etaxonomy.cdm.model.taxon.TaxonNode} object.
         */
         * @param multi a boolean.
         * @param node a {@link eu.etaxonomy.cdm.model.taxon.TaxonNode} object.
         */
-       protected TaxonNodeSelectionDialog(Shell shell, ConversationHolder conversation, String title, List<UUID> excludeTaxa, boolean multi, TaxonNode node) {
+       protected TaxonNodeSelectionDialog(Shell shell, ConversationHolder conversation, String title, List<UUID> excludeTaxa, boolean multi, TaxonNode node, Classification classification) {
                super(shell, conversation, title, multi, TaxonNodeSelectionDialog.class.getCanonicalName(), node);
                
                ILabelProvider labelProvider = new FilteredCdmResourceLabelProvider();
                super(shell, conversation, title, multi, TaxonNodeSelectionDialog.class.getCanonicalName(), node);
                
                ILabelProvider labelProvider = new FilteredCdmResourceLabelProvider();
@@ -78,6 +81,10 @@ public class TaxonNodeSelectionDialog extends AbstractFilteredCdmResourceSelecti
                setListLabelProvider(labelProvider);
                setDetailsLabelProvider(labelProvider);
                
                setListLabelProvider(labelProvider);
                setDetailsLabelProvider(labelProvider);
                
+               if(classification != null){
+                       selectedClassification = classification;
+               }
+               defaultClassification = classification;
        }
 
 
        }
 
 
@@ -87,13 +94,13 @@ public class TaxonNodeSelectionDialog extends AbstractFilteredCdmResourceSelecti
        /** {@inheritDoc} */
        @Override
        protected Control createExtendedContentArea(Composite parent) {
        /** {@inheritDoc} */
        @Override
        protected Control createExtendedContentArea(Composite parent) {
-               return createTreeSelectionCombo(parent);
+               return createClassificationSelectionCombo(parent);
        }
        
        /*
         * currently disabled tree selection composite
         */
        }
        
        /*
         * currently disabled tree selection composite
         */
-       private Control createTreeSelectionCombo(Composite parent){
+       private Control createClassificationSelectionCombo(Composite parent){
 //             classifications = CdmStore.getTaxonTreeService().list(null, null, null, null, null);
                
                Composite classificationSelection = new Composite(parent, SWT.NULL);
 //             classifications = CdmStore.getTaxonTreeService().list(null, null, null, null, null);
                
                Composite classificationSelection = new Composite(parent, SWT.NULL);
@@ -103,7 +110,7 @@ public class TaxonNodeSelectionDialog extends AbstractFilteredCdmResourceSelecti
                classificationSelection.setLayout(layout);
                
                Label label = new Label(classificationSelection, SWT.NULL);
                classificationSelection.setLayout(layout);
                
                Label label = new Label(classificationSelection, SWT.NULL);
-               // TODO not working is not really true but leave it there to remind everyone that this is under construction
+               // TODO not working is not really true but leave it here to remind everyone that this is under construction
                label.setText("Select Classification (experimental)");
                classificationSelectionCombo = new Combo(classificationSelection, SWT.BORDER | SWT.READ_ONLY);
                classificationSelectionCombo.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, true));
                label.setText("Select Classification (experimental)");
                classificationSelectionCombo = new Combo(classificationSelection, SWT.BORDER | SWT.READ_ONLY);
                classificationSelectionCombo.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, true));
@@ -115,9 +122,10 @@ public class TaxonNodeSelectionDialog extends AbstractFilteredCdmResourceSelecti
                classificationSelectionCombo.select(classifications.indexOf(selectedClassification));
                
                // TODO remember last selection
                classificationSelectionCombo.select(classifications.indexOf(selectedClassification));
                
                // TODO remember last selection
-               
                classificationSelectionCombo.addSelectionListener(this);
                
                classificationSelectionCombo.addSelectionListener(this);
                
+               
+               
                return classificationSelection;
        }
 
                return classificationSelection;
        }
 
index 51486303bfcbb360d55f98036fd2a9e129ecefd7..e5de8074f8c817bdd7dc8cfe63f4d0c6fa364d72 100644 (file)
@@ -226,11 +226,13 @@ public class TaxonNodeDetailElement extends AbstractCdmDetailElement<ITreeNode>
                        classification = (Classification) parentTreeNode;
                        selection_classification.setEntity(classification);
                        selection_parentTaxonNode.setEntity(null);
                        classification = (Classification) parentTreeNode;
                        selection_classification.setEntity(classification);
                        selection_parentTaxonNode.setEntity(null);
+                       selection_parentTaxonNode.setClassification(classification);
                } else if (parentTreeNode instanceof TaxonNode) {
                        classification = (Classification) HibernateProxyHelper
                                        .deproxy(((TaxonNode) parentTreeNode).getClassification());
                        selection_classification.setEntity(classification);
                        selection_parentTaxonNode.setEntity((TaxonNode) parentTreeNode);
                } else if (parentTreeNode instanceof TaxonNode) {
                        classification = (Classification) HibernateProxyHelper
                                        .deproxy(((TaxonNode) parentTreeNode).getClassification());
                        selection_classification.setEntity(classification);
                        selection_parentTaxonNode.setEntity((TaxonNode) parentTreeNode);
+                       selection_parentTaxonNode.setClassification(classification);
                }
        }
 
                }
        }
 
index 63e0f03cbe71b1c61b2b22d858e1aaa3bc6d5d5d..5be0d3ac67b346b54e4cd329de5457eec3238b05 100644 (file)
@@ -14,6 +14,7 @@ import org.eclipse.swt.events.SelectionEvent;
 
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.common.CdmUtils;
 
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.common.CdmUtils;
+import eu.etaxonomy.cdm.model.taxon.Classification;
 import eu.etaxonomy.cdm.model.taxon.TaxonNode;
 import eu.etaxonomy.taxeditor.ui.dialogs.filteredSelection.TaxonNodeSelectionDialog;
 import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
 import eu.etaxonomy.cdm.model.taxon.TaxonNode;
 import eu.etaxonomy.taxeditor.ui.dialogs.filteredSelection.TaxonNodeSelectionDialog;
 import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
@@ -32,6 +33,7 @@ public class TaxonNodeSelectionElement extends
                AbstractSelectionElement<TaxonNode> {
 
        public static final int DEFAULT = DELETABLE;
                AbstractSelectionElement<TaxonNode> {
 
        public static final int DEFAULT = DELETABLE;
+       private Classification classification;
 
        /**
         * <p>
 
        /**
         * <p>
@@ -72,10 +74,21 @@ public class TaxonNodeSelectionElement extends
        @Override
        public void widgetSelected(SelectionEvent e) {
                TaxonNode newSelection = TaxonNodeSelectionDialog.select(getShell(),
        @Override
        public void widgetSelected(SelectionEvent e) {
                TaxonNode newSelection = TaxonNodeSelectionDialog.select(getShell(),
-                               getConversationHolder(), "Select parent taxon", null, null);
+                               getConversationHolder(), "Select parent taxon", null, null, getClassification());
                setSelectionInternal(newSelection);
        }
 
                setSelectionInternal(newSelection);
        }
 
+       /**
+        * @return
+        */
+       public Classification getClassification() {
+               return classification;
+       }
+       
+       public void setClassification(Classification classification){
+               this.classification = classification;
+       }
+
        /*
         * (non-Javadoc)
         * 
        /*
         * (non-Javadoc)
         *