Fixes adding, editing and deleting of terms in preferences. "About the EDIT Platform...
authorn.hoffmann <n.hoffmann@localhost>
Fri, 28 Jan 2011 12:39:56 +0000 (12:39 +0000)
committern.hoffmann <n.hoffmann@localhost>
Fri, 28 Jan 2011 12:39:56 +0000 (12:39 +0000)
18 files changed:
taxeditor-application/src/main/java/eu/etaxonomy/taxeditor/OpenExternalAboutPlatformHandler.java
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/preference/menu/AbstractMenuPreferences.java
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/preference/menu/ExtensionTypeMenuPreferences.java
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/preference/menu/FeatureMenuPreferences.java
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/preference/menu/LanguageMenuPreferences.java
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/preference/menu/MarkerTypeMenuPreferences.java
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/preference/menu/MeasurementUnitMenuPreferences.java
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/preference/menu/NameRelationshipTypeMenuPreferences.java
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/preference/menu/NameTypeDesignationStatusMenuPreferences.java
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/preference/menu/NamedAreaTypeMenuPreferences.java
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/preference/menu/NomenclaturalStatusTypeMenuPreferences.java
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/preference/menu/PresenceAbsenceMenuPreferences.java
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/preference/menu/PreservationMethodMenuPreferences.java
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/preference/menu/RankMenuPreferences.java
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/preference/menu/SpecimenTypeDesignationStatusMenuPreferences.java
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/preference/menu/StageMenuPreferences.java
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/preference/menu/TaxonRelationshipTypeMenuPreferences.java
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/preference/wizard/VocabularyTermWizard.java

index 3f36ffecddb0c59067a74f8921efa2966aac606b..228aaa17bb87325a8e9a78cedc6ed29fab458676 100644 (file)
@@ -36,7 +36,7 @@ public class OpenExternalAboutPlatformHandler extends AbstractHandler {
         */
        /** {@inheritDoc} */
        public Object execute(ExecutionEvent event) throws ExecutionException {
-               String url = "http://wp5.e-taxonomy.eu/blog/";
+               String url = "http://wp5.e-taxonomy.eu/";
 
                try {
                        PlatformUI.getWorkbench().getBrowserSupport().createBrowser
index d14dc02cd92ae3e21ffd44145d32b71b43c67913..05beaa4347de2bdecbbe5f71c346cde72bd749b8 100644 (file)
@@ -34,8 +34,11 @@ import org.eclipse.swt.widgets.Control;
 import org.eclipse.ui.IWorkbench;
 import org.eclipse.ui.IWorkbenchPreferencePage;
 
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
 import eu.etaxonomy.cdm.api.service.ITermService;
 import eu.etaxonomy.cdm.model.common.DefinedTermBase;
+import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 import eu.etaxonomy.taxeditor.preference.wizard.VocabularyTermWizard;
 import eu.etaxonomy.taxeditor.store.CdmStore;
@@ -50,7 +53,7 @@ import eu.etaxonomy.taxeditor.store.TermStore;
  * @version 1.0
  */
 public abstract class AbstractMenuPreferences<T extends DefinedTermBase> extends PreferencePage implements
-               IWorkbenchPreferencePage{
+               IWorkbenchPreferencePage, IConversationEnabled{
 
        private Button toggleButton;
        protected HashMap<DefinedTermBase<T>, Button> menuButtons;
@@ -58,13 +61,12 @@ public abstract class AbstractMenuPreferences<T extends DefinedTermBase> extends
        protected Button newButton;
        protected Button editButton;
        protected Button removeButton;
-       
-       protected List<T> terms;
-       
+               
        protected CheckboxTableViewer tableViewer;
        
        private boolean state = true;
        private boolean vocabularyIsEditable;
+       private ConversationHolder conversation;
        
        /**
         * Constructs a new menu preference page.
@@ -80,12 +82,13 @@ public abstract class AbstractMenuPreferences<T extends DefinedTermBase> extends
         *                      Handler for these buttons have to be overriding addEditButtonListeners()
         * @param <T> a T object.
         */
-       public AbstractMenuPreferences(List<T> initialVocabulary, String title, String description, boolean editable) {
+       public AbstractMenuPreferences(String title, String description, boolean editable) {
                super(title);
-               terms = initialVocabulary;
                vocabularyIsEditable = editable;
                setDescription(description);
        }
+       
+       protected abstract List<T> getTerms();
 
        /**
         * {@inheritDoc}
@@ -108,7 +111,7 @@ public abstract class AbstractMenuPreferences<T extends DefinedTermBase> extends
                tableViewer.setContentProvider(new DefinedTermBaseContentProvider());
                tableViewer.setLabelProvider(new DefinedTermBaseLabelProvider());
 
-               refresh(terms);
+               refresh(getTerms());
                
                tableViewer.addCheckStateListener(new ICheckStateListener() {
                        
@@ -207,11 +210,11 @@ public abstract class AbstractMenuPreferences<T extends DefinedTermBase> extends
                         */
                        @Override
                        public void widgetSelected(SelectionEvent e) {
-                               VocabularyTermWizard<T> wizard = new VocabularyTermWizard<T>(getTermClass()); 
+                               VocabularyTermWizard<T> wizard = new VocabularyTermWizard<T>(getTermClass(), getConversationHolder()); 
                                
                                WizardDialog dialog = new WizardDialog(StoreUtil.getShell(), wizard);
                            if(dialog.open() == IStatus.OK){
-                               tableViewer.setInput(TermStore.getFeatures());
+                               tableViewer.setInput(getTerms());
                            }
                        }
 
@@ -232,13 +235,14 @@ public abstract class AbstractMenuPreferences<T extends DefinedTermBase> extends
                        public void widgetSelected(SelectionEvent e) {
                                T selection = (T) ((StructuredSelection) tableViewer.getSelection()).getFirstElement();
                                
-                               VocabularyTermWizard<T> wizard = new VocabularyTermWizard<T>(getTermClass(), selection); 
+                               VocabularyTermWizard<T> wizard = new VocabularyTermWizard<T>(getTermClass(), selection, getConversationHolder()); 
                                
                                WizardDialog dialog = new WizardDialog(StoreUtil.getShell(), wizard);
-                           dialog.open();
                            
-                           tableViewer.setInput(TermStore.getFeatures());
-                           tableViewer.reveal(selection);
+                               if(dialog.open() == IStatus.OK){                            
+                                   tableViewer.setInput(TermStore.getFeatures());
+                                   tableViewer.reveal(selection);
+                           }
                        }
                });
        }
@@ -262,8 +266,19 @@ public abstract class AbstractMenuPreferences<T extends DefinedTermBase> extends
                                        Iterator<T> selectionIterator = selection.iterator();
                                        
                                        while(selectionIterator.hasNext()){
-                                               CdmStore.getService(ITermService.class).delete(selectionIterator.next());
+                                               T term = selectionIterator.next();
+
+                                               tableViewer.remove(term);
+                                               
+                                               if(getConversationHolder().getSessionHolder().getSession().contains(term)){
+                                                       ITermService service = CdmStore.getService(ITermService.class);
+                                                       DefinedTermBase theTerm = service.load(term.getUuid());
+                                                       
+                                                       service.delete(theTerm);
+                                               }
                                        }
+                                       
+//                                     tableViewer.refresh();
                                }
                        }
                });
@@ -272,6 +287,7 @@ public abstract class AbstractMenuPreferences<T extends DefinedTermBase> extends
        /** {@inheritDoc} */
        public void init(IWorkbench workbench) {
                setPreferenceStore(PreferencesUtil.getPreferenceStore());
+               getConversationHolder().bind();
        }
 
        /*
@@ -304,12 +320,14 @@ public abstract class AbstractMenuPreferences<T extends DefinedTermBase> extends
                        return false;
                }
                
+               getConversationHolder().commit(true);
+               
                List<T> preferredTerms = new ArrayList<T>();
                for (Object element : getTableViewer().getCheckedElements()){
                        preferredTerms.add((T) element);
                }
                
-               CdmStore.getTermManager().setPreferredTerms(preferredTerms, this.terms);
+               CdmStore.getTermManager().setPreferredTerms(preferredTerms, getTerms());
                
                PreferencesUtil.firePreferencesChanged(this.getClass());
                
@@ -333,4 +351,23 @@ public abstract class AbstractMenuPreferences<T extends DefinedTermBase> extends
         * @return a {@link java.lang.Class} object.
         */
        protected abstract Class<T> getTermClass();
+       
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.cdm.api.conversation.IConversationEnabled#getConversationHolder()
+        */
+       @Override
+       public ConversationHolder getConversationHolder() {
+               if(conversation == null){
+                       conversation = CdmStore.createConversation();
+               }
+               return conversation;
+       }
+       
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.cdm.persistence.hibernate.ICdmPostDataChangeObserver#update(eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap)
+        */
+       @Override
+       public void update(CdmDataChangeMap changeEvents) {
+               // implement where needed
+       }
 }
index 17679195c46d0e97833867b5d5f212b216341832..0c00d5540414d25c9c8065dbcac0dd5c14702a8b 100644 (file)
@@ -10,6 +10,8 @@
 
 package eu.etaxonomy.taxeditor.preference.menu;
 
+import java.util.List;
+
 import eu.etaxonomy.cdm.model.common.ExtensionType;
 import eu.etaxonomy.taxeditor.store.TermStore;
 
@@ -26,8 +28,7 @@ public class ExtensionTypeMenuPreferences extends AbstractMenuPreferences<Extens
         * <p>Constructor for ExtensionTypeMenuPreferences.</p>
         */
        public ExtensionTypeMenuPreferences() {
-               super(TermStore.getExtensionTypes(),
-                               "Extension Type Preferences" , 
+               super("Extension Type Preferences" , 
                                "Choose which extension types to display",
                                true);
        }
@@ -40,4 +41,12 @@ public class ExtensionTypeMenuPreferences extends AbstractMenuPreferences<Extens
        protected Class<ExtensionType> getTermClass() {
                return ExtensionType.class;
        }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.preference.menu.AbstractMenuPreferences#getTerms()
+        */
+       @Override
+       protected List<ExtensionType> getTerms() {
+               return TermStore.getExtensionTypes();
+       }
 }
index e1391acc63d0542042d2ef270afe2135d057001f..0375bf2a8f692c236cbcbaf1f02b8f9ba774d0d7 100644 (file)
@@ -8,15 +8,9 @@
 */
 package eu.etaxonomy.taxeditor.preference.menu;
 
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
+import java.util.List;
 
 import eu.etaxonomy.cdm.model.description.Feature;
-import eu.etaxonomy.taxeditor.preference.wizard.VocabularyTermWizard;
-import eu.etaxonomy.taxeditor.store.StoreUtil;
 import eu.etaxonomy.taxeditor.store.TermStore;
 
 /**
@@ -36,63 +30,10 @@ public class FeatureMenuPreferences extends AbstractMenuPreferences<Feature> {
         * <p>Constructor for FeatureMenuPreferences.</p>
         */
        public FeatureMenuPreferences() {
-               super(TermStore.getFeatures(), 
-                               "Feature Preferences", 
+               super("Feature Preferences", 
                                "Choose which features you would like to use for descriptive elements.", 
                                true);
        }
-       
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.preference.AbstractMenuPreferences#addEditButtonListeners()
-        * 
-        * TODO refactor into superclass
-        */
-       /** {@inheritDoc} */
-       @Override
-       protected void addNewButtonListeners() {
-               newButton.addSelectionListener(new SelectionAdapter(){
-                       /* (non-Javadoc)
-                        * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
-                        */
-                       @Override
-                       public void widgetSelected(SelectionEvent e) {
-                               super.widgetSelected(e);
-                               VocabularyTermWizard<Feature> wizard = new VocabularyTermWizard<Feature>(Feature.class); 
-                               
-                               WizardDialog dialog = new WizardDialog(StoreUtil.getShell(), wizard);
-                           if(dialog.open() == IStatus.OK){
-                               tableViewer.setInput(TermStore.getFeatures());
-                           }
-                       }
-               });
-       }
-       
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.preference.AbstractMenuPreferences#addEditButtonListeners()
-        */
-       /** {@inheritDoc} */
-       @Override
-       protected void addEditButtonListeners() {
-               editButton.addSelectionListener(new SelectionAdapter(){
-                       /* (non-Javadoc)
-                        * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
-                        */
-                       @Override
-                       public void widgetSelected(SelectionEvent e) {
-                               super.widgetSelected(e);
-                               Feature selection = (Feature) ((StructuredSelection) tableViewer.getSelection()).getFirstElement();
-                               
-                               VocabularyTermWizard<Feature> wizard = new VocabularyTermWizard<Feature>(Feature.class, selection); 
-                               
-                               WizardDialog dialog = new WizardDialog(StoreUtil.getShell(), wizard);
-                           dialog.open();
-                           
-                           
-                           tableViewer.setInput(TermStore.getFeatures());
-                           tableViewer.reveal(selection);
-                       }
-               });
-       }
 
        /* (non-Javadoc)
         * @see eu.etaxonomy.taxeditor.preference.menu.AbstractMenuPreferences#getTermClass()
@@ -102,31 +43,12 @@ public class FeatureMenuPreferences extends AbstractMenuPreferences<Feature> {
        protected Class<Feature> getTermClass() {
                return Feature.class;
        }
-       
+
        /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.preference.AbstractMenuPreferences#addEditButtonListeners()
-        * 
-        * TODO refactor into superclass
+        * @see eu.etaxonomy.taxeditor.preference.menu.AbstractMenuPreferences#getTerms()
         */
-//     @Override
-//     protected void addDeleteButtonListeners() {
-//             removeButton.addMouseListener(new MouseAdapter(){
-//
-//                     /* (non-Javadoc)
-//                      * @see org.eclipse.swt.events.MouseAdapter#mouseUp(org.eclipse.swt.events.MouseEvent)
-//                      */
-//                     @Override
-//                     public void mouseUp(MouseEvent e) {
-//                             super.mouseUp(e);
-//
-//                             Feature selected = (Feature) ((StructuredSelection) tableViewer.getSelection()).getFirstElement();
-//                         
-//                             VocabularyStore.delete(selected);
-//                             
-//                             
-//                         tableViewer.setInput(VocabularyStore.getFeatures());
-//                     }
-//                     
-//             });
-//     }
+       @Override
+       protected List<Feature> getTerms() {
+               return TermStore.getFeatures();
+       }
 }
index 11e950a446ea31cf3c28ed5333d8e77fb271f338..e630441c997dc066a83fa3bf381f043a8887528f 100644 (file)
@@ -10,6 +10,8 @@
 
 package eu.etaxonomy.taxeditor.preference.menu;
 
+import java.util.List;
+
 import org.eclipse.jface.viewers.ITableLabelProvider;
 import org.eclipse.jface.viewers.LabelProvider;
 import org.eclipse.jface.viewers.ViewerComparator;
@@ -36,8 +38,7 @@ public class LanguageMenuPreferences extends AbstractMenuPreferences<Language> {
         * <p>Constructor for LanguageMenuPreferences.</p>
         */
        public LanguageMenuPreferences() {
-               super(TermStore.getLanguages(), 
-                               "Language Preferences", 
+               super("Language Preferences", 
                                "Configure language preferences.",
                                false);
        }
@@ -86,4 +87,12 @@ public class LanguageMenuPreferences extends AbstractMenuPreferences<Language> {
        protected Class<Language> getTermClass() {
                return Language.class;
        }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.preference.menu.AbstractMenuPreferences#getTerms()
+        */
+       @Override
+       protected List<Language> getTerms() {
+               return TermStore.getLanguages();
+       }
 }
index 5805f81cd71bff984569634ab1fe99397cfb2e49..406ae6162621c21459ccfe5df1b5b40a568d89f7 100644 (file)
@@ -10,6 +10,8 @@
 
 package eu.etaxonomy.taxeditor.preference.menu;
 
+import java.util.List;
+
 import eu.etaxonomy.cdm.model.common.MarkerType;
 import eu.etaxonomy.taxeditor.store.TermStore;
 
@@ -26,8 +28,7 @@ public class MarkerTypeMenuPreferences extends AbstractMenuPreferences<MarkerTyp
         * <p>Constructor for MarkerTypeMenuPreferences.</p>
         */
        public MarkerTypeMenuPreferences() {
-               super(TermStore.getNonTechnicalMarkerTypes(), 
-                               "Marker Type Preferences" , 
+               super("Marker Type Preferences" , 
                                "Choose which markers to display",
                                true);
        }
@@ -40,4 +41,12 @@ public class MarkerTypeMenuPreferences extends AbstractMenuPreferences<MarkerTyp
        protected Class<MarkerType> getTermClass() {
                return MarkerType.class;
        }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.preference.menu.AbstractMenuPreferences#getTerms()
+        */
+       @Override
+       protected List<MarkerType> getTerms() {
+               return TermStore.getNonTechnicalMarkerTypes();
+       }
 }
index a8fed677a8c312921741a65079a630e2c01e158d..545fe62f96a3a78083d786e042499cb25a3b6009 100644 (file)
@@ -3,6 +3,8 @@
  */
 package eu.etaxonomy.taxeditor.preference.menu;
 
+import java.util.List;
+
 import eu.etaxonomy.cdm.model.description.MeasurementUnit;
 import eu.etaxonomy.taxeditor.store.TermStore;
 
@@ -18,8 +20,7 @@ public class MeasurementUnitMenuPreferences extends AbstractMenuPreferences<Meas
         * <p>Constructor for MeasurementUnitMenuPreferences.</p>
         */
        public MeasurementUnitMenuPreferences() {
-               super(TermStore.getMeasurementUnits(), 
-                               "Measurement Units", 
+               super("Measurement Units", 
                                "Edit displayed measurement units", 
                                true);
        }
@@ -33,4 +34,12 @@ public class MeasurementUnitMenuPreferences extends AbstractMenuPreferences<Meas
                return MeasurementUnit.class;
        }
 
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.preference.menu.AbstractMenuPreferences#getTerms()
+        */
+       @Override
+       protected List<MeasurementUnit> getTerms() {
+               return TermStore.getMeasurementUnits();
+       }
+
 }
index d9eb81759f6006c5e6230c6ffd82db12b6918c03..5cb22dc4e90e3bb654b6dd72a0b27398b228fad4 100644 (file)
@@ -10,6 +10,8 @@
 
 package eu.etaxonomy.taxeditor.preference.menu;
 
+import java.util.List;
+
 import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
@@ -35,8 +37,7 @@ public class NameRelationshipTypeMenuPreferences extends
         * <p>Constructor for NameRelationshipTypeMenuPreferences.</p>
         */
        public NameRelationshipTypeMenuPreferences() {
-               super(TermStore.getNameRelationshipTypes(), 
-                               "Name relationship types", 
+               super("Name relationship types", 
                                "Configure name relationship types",
                                false);
        }
@@ -96,4 +97,12 @@ public class NameRelationshipTypeMenuPreferences extends
        protected Class<NameRelationshipType> getTermClass() {
                return NameRelationshipType.class;
        }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.preference.menu.AbstractMenuPreferences#getTerms()
+        */
+       @Override
+       protected List<NameRelationshipType> getTerms() {
+               return TermStore.getNameRelationshipTypes();
+       }
 }
index 4541b8926b3439339972e1bb22c4c07ace2c1752..bfdd50f744dfd2f1d1a960aed24aad83c42841d9 100644 (file)
@@ -10,6 +10,8 @@
 
 package eu.etaxonomy.taxeditor.preference.menu;
 
+import java.util.List;
+
 import eu.etaxonomy.cdm.model.name.NameTypeDesignationStatus;
 import eu.etaxonomy.taxeditor.store.TermStore;
 
@@ -26,8 +28,7 @@ public class NameTypeDesignationStatusMenuPreferences extends
         * <p>Constructor for NameTypeDesignationStatusMenuPreferences.</p>
         */
        public NameTypeDesignationStatusMenuPreferences() {
-               super(TermStore.getNameTypeDesignationStatus(), 
-                               "Name Type Designation Status Preferences", 
+               super("Name Type Designation Status Preferences", 
                                "Configure name type designation status",
                                false);
        }
@@ -41,4 +42,12 @@ public class NameTypeDesignationStatusMenuPreferences extends
                return NameTypeDesignationStatus.class;
        }
 
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.preference.menu.AbstractMenuPreferences#getTerms()
+        */
+       @Override
+       protected List<NameTypeDesignationStatus> getTerms() {
+               return TermStore.getNameTypeDesignationStatus();
+       }
+
 }
index 9ea29eafea1203f21d956f2d32a2399f01a928c6..335e293d7f98cc97f6009800110f3b341a62cf19 100644 (file)
@@ -10,6 +10,8 @@
 
 package eu.etaxonomy.taxeditor.preference.menu;
 
+import java.util.List;
+
 import eu.etaxonomy.cdm.model.location.NamedAreaType;
 import eu.etaxonomy.taxeditor.store.TermStore;
 
@@ -26,8 +28,7 @@ public class NamedAreaTypeMenuPreferences extends AbstractMenuPreferences<NamedA
         * <p>Constructor for NamedAreaTypeMenuPreferences.</p>
         */
        public NamedAreaTypeMenuPreferences() {
-               super(TermStore.getNamedAreaTypes(), 
-                               "Named Area Types", 
+               super("Named Area Types", 
                                "Edit displayed named area types", 
                                true);
        }
@@ -40,4 +41,12 @@ public class NamedAreaTypeMenuPreferences extends AbstractMenuPreferences<NamedA
        protected Class<NamedAreaType> getTermClass() {
                return NamedAreaType.class;
        }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.preference.menu.AbstractMenuPreferences#getTerms()
+        */
+       @Override
+       protected List<NamedAreaType> getTerms() {
+               return TermStore.getNamedAreaTypes();
+       }
 }
index 06889d80733a76097be679ea0cb79c0c97dc662a..4ec3a86fc11697249268bf85ecce1f5f344950ad 100644 (file)
@@ -10,6 +10,8 @@
 
 package eu.etaxonomy.taxeditor.preference.menu;
 
+import java.util.List;
+
 import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType;
 import eu.etaxonomy.taxeditor.store.TermStore;
 
@@ -27,8 +29,7 @@ public class NomenclaturalStatusTypeMenuPreferences extends
         * <p>Constructor for NomenclaturalStatusTypeMenuPreferences.</p>
         */
        public NomenclaturalStatusTypeMenuPreferences() {
-               super(TermStore.getNomenclaturalStatusTypes(), 
-                               "Nomenlcatural Status Type Preferences", 
+               super("Nomenlcatural Status Type Preferences", 
                                "Configure nomenclatural status types",
                                false);
        }
@@ -41,5 +42,13 @@ public class NomenclaturalStatusTypeMenuPreferences extends
        protected Class<NomenclaturalStatusType> getTermClass() {
                return NomenclaturalStatusType.class;
        }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.preference.menu.AbstractMenuPreferences#getTerms()
+        */
+       @Override
+       protected List<NomenclaturalStatusType> getTerms() {
+               return TermStore.getNomenclaturalStatusTypes();
+       }
        
 }
index 59113bfbd2b8024d68bdb3605379af06b4c0d2d3..8a5c7b669219f5f5f4e9499a229c8c8ab88180d8 100644 (file)
@@ -10,6 +10,8 @@
 
 package eu.etaxonomy.taxeditor.preference.menu;
 
+import java.util.List;
+
 import org.eclipse.ui.IWorkbenchPreferencePage;
 
 import eu.etaxonomy.cdm.model.description.PresenceAbsenceTermBase;
@@ -29,8 +31,7 @@ public class PresenceAbsenceMenuPreferences extends AbstractMenuPreferences<Pres
         * <p>Constructor for PresenceAbsenceMenuPreferences.</p>
         */
        public PresenceAbsenceMenuPreferences() {
-               super(TermStore.getPresenceAbsenceTerms(), 
-                               "Distribution Status Preferences", 
+               super("Distribution Status Preferences", 
                                "Choose which distribution states should be shown.",
                                false);
        }
@@ -43,5 +44,13 @@ public class PresenceAbsenceMenuPreferences extends AbstractMenuPreferences<Pres
        protected Class<PresenceAbsenceTermBase> getTermClass() {
                return PresenceAbsenceTermBase.class;
        }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.preference.menu.AbstractMenuPreferences#getTerms()
+        */
+       @Override
+       protected List<PresenceAbsenceTermBase> getTerms() {
+               return TermStore.getPresenceAbsenceTerms();
+       }
        
 }
index b4549f81cd98385f164271d1952764de41daab53..40486bfe3444b96fc995e1ef1f50bc11c5128e49 100644 (file)
@@ -10,6 +10,8 @@
 
 package eu.etaxonomy.taxeditor.preference.menu;
 
+import java.util.List;
+
 import eu.etaxonomy.cdm.model.occurrence.PreservationMethod;
 import eu.etaxonomy.taxeditor.store.TermStore;
 
@@ -26,8 +28,7 @@ public class PreservationMethodMenuPreferences extends AbstractMenuPreferences<P
         * <p>Constructor for PreservationMethodMenuPreferences.</p>
         */
        public PreservationMethodMenuPreferences() {
-               super(TermStore.getPreservationMethods(), 
-                               "Preservation Method Preferences", 
+               super("Preservation Method Preferences", 
                                "Select preservation methods to be shown in selections", 
                                false);
        }
@@ -40,4 +41,12 @@ public class PreservationMethodMenuPreferences extends AbstractMenuPreferences<P
        protected Class<PreservationMethod> getTermClass() {
                return PreservationMethod.class;
        }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.preference.menu.AbstractMenuPreferences#getTerms()
+        */
+       @Override
+       protected List<PreservationMethod> getTerms() {
+               return TermStore.getPreservationMethods();
+       }
 }
index 84aab425cb4c6c9a62223a3ebc5b822b58a06cc3..78a40b855648a5e44b23f21a22aac194e838fe19 100644 (file)
@@ -8,6 +8,8 @@
 */
 package eu.etaxonomy.taxeditor.preference.menu;
 
+import java.util.List;
+
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
@@ -38,8 +40,7 @@ public class RankMenuPreferences extends AbstractMenuPreferences<Rank> implement
         * <p>Constructor for RankMenuPreferences.</p>
         */
        public RankMenuPreferences() {
-               super(TermStore.getRanks(), 
-                               "Rank Preferences", 
+               super("Rank Preferences", 
                                "Choose which ranks to display in the property sheet drop-down menu.",
                                false);
        }
@@ -80,4 +81,12 @@ public class RankMenuPreferences extends AbstractMenuPreferences<Rank> implement
                return Rank.class;
        }
 
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.preference.menu.AbstractMenuPreferences#getTerms()
+        */
+       @Override
+       protected List<Rank> getTerms() {
+               return TermStore.getRanks();
+       }
+
 }
index a9de5dcb36fe665da2b9b18de98f6a9578e058d6..aa132d05146d9851a91ce9219c8151b0429644f7 100644 (file)
@@ -10,6 +10,8 @@
 
 package eu.etaxonomy.taxeditor.preference.menu;
 
+import java.util.List;
+
 import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus;
 import eu.etaxonomy.taxeditor.store.TermStore;
 
@@ -26,8 +28,7 @@ public class SpecimenTypeDesignationStatusMenuPreferences extends
         * <p>Constructor for SpecimenTypeDesignationStatusMenuPreferences.</p>
         */
        public SpecimenTypeDesignationStatusMenuPreferences() {
-               super(TermStore.getSpecimenTypeDesignationStatus(), 
-                               "Specimen Type Designation Status Preferences", 
+               super("Specimen Type Designation Status Preferences", 
                                "Configure specimen type designation status",
                                false);
        }
@@ -41,4 +42,12 @@ public class SpecimenTypeDesignationStatusMenuPreferences extends
                return SpecimenTypeDesignationStatus.class;
        }
 
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.preference.menu.AbstractMenuPreferences#getTerms()
+        */
+       @Override
+       protected List<SpecimenTypeDesignationStatus> getTerms() {
+               return TermStore.getSpecimenTypeDesignationStatus();
+       }
+
 }
index 96f18c03a127764a9a0792ca26c1e0e41f61330a..5185f29450c43c8385a49e41b2b4c0ec8e081ee6 100644 (file)
@@ -10,6 +10,8 @@
 
 package eu.etaxonomy.taxeditor.preference.menu;
 
+import java.util.List;
+
 import eu.etaxonomy.cdm.model.description.Stage;
 import eu.etaxonomy.taxeditor.store.TermStore;
 
@@ -26,8 +28,7 @@ public class StageMenuPreferences extends AbstractMenuPreferences<Stage> {
         * <p>Constructor for StageMenuPreferences.</p>
         */
        public StageMenuPreferences() {
-               super(TermStore.getStages(), 
-                               "Stage Preferences", 
+               super("Stage Preferences", 
                                "Choose stages to be shown in selection combos", 
                                false);
        }
@@ -40,4 +41,12 @@ public class StageMenuPreferences extends AbstractMenuPreferences<Stage> {
        protected Class<Stage> getTermClass() {
                return Stage.class;
        }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.preference.menu.AbstractMenuPreferences#getTerms()
+        */
+       @Override
+       protected List<Stage> getTerms() {
+               return TermStore.getStages();
+       }
 }
index f8720b566469ebb7a46b0ae6c1b3abeecc7e9809..243eb00f028ddafd7821a0f9eb34b8e8af37ed66 100644 (file)
@@ -10,6 +10,8 @@
 
 package eu.etaxonomy.taxeditor.preference.menu;
 
+import java.util.List;
+
 import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
 import eu.etaxonomy.taxeditor.store.TermStore;
 
@@ -27,8 +29,7 @@ public class TaxonRelationshipTypeMenuPreferences extends
         * <p>Constructor for TaxonRelationshipTypeMenuPreferences.</p>
         */
        public TaxonRelationshipTypeMenuPreferences() {
-               super(TermStore.getTaxonRelationshipTypes(), 
-                               "Taxon Relationship Type Preferences", 
+               super("Taxon Relationship Type Preferences", 
                                "Configure taxon relationship types",
                                false);
        }
@@ -41,5 +42,13 @@ public class TaxonRelationshipTypeMenuPreferences extends
        protected Class<TaxonRelationshipType> getTermClass() {
                return TaxonRelationshipType.class;
        }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.preference.menu.AbstractMenuPreferences#getTerms()
+        */
+       @Override
+       protected List<TaxonRelationshipType> getTerms() {
+               return TermStore.getTaxonRelationshipTypes();
+       }
        
 }
index da7711b6a19a78a24cb13b9dbf3e6cb9fbfd93cb..4226d3e40b92c30143c4df1b22da7ce842d60ad8 100644 (file)
@@ -44,8 +44,8 @@ public class VocabularyTermWizard<T extends DefinedTermBase> extends Wizard impl
         *
         * @param vocabularyClass a {@link java.lang.Class} object.
         */
-       public VocabularyTermWizard(Class<T> vocabularyClass){  
-               conversation = CdmStore.createConversation();
+       public VocabularyTermWizard(Class<T> vocabularyClass, ConversationHolder conversation){ 
+               this.conversation = conversation;
                termClass = vocabularyClass;
        }
        
@@ -55,8 +55,8 @@ public class VocabularyTermWizard<T extends DefinedTermBase> extends Wizard impl
         * @param vocabularyClass a {@link java.lang.Class} object.
         * @param selectedTerm a T object.
         */
-       public VocabularyTermWizard(Class<T> vocabularyClass, T selectedTerm){
-               this(vocabularyClass);          
+       public VocabularyTermWizard(Class<T> vocabularyClass, T selectedTerm, ConversationHolder conversation){
+               this(vocabularyClass, conversation);            
                term = (T) CdmStore.getService(ITermService.class).load(selectedTerm.getUuid());
                editMode = true;
        }
@@ -85,8 +85,8 @@ public class VocabularyTermWizard<T extends DefinedTermBase> extends Wizard impl
                        TermStore.saveTerm(getTerm());
                }
                
-               getConversationHolder().commit(false);
-               getConversationHolder().close();
+               getConversationHolder().commit(true);
+//             getConversationHolder().close();
                
                return true;
        }
@@ -101,11 +101,9 @@ public class VocabularyTermWizard<T extends DefinedTermBase> extends Wizard impl
        }
 
        /**
-        * <p>Setter for the field <code>term</code>.</p>
+        * <p>Setter for the fields <code>term</code>.</p>
         *
         * @param text
-        * @param text2
-        * @param text3
         * @param label a {@link java.lang.String} object.
         * @param abbreviatedLabel a {@link java.lang.String} object.
         */
@@ -163,8 +161,7 @@ public class VocabularyTermWizard<T extends DefinedTermBase> extends Wizard impl
         */
        @Override
        public void update(CdmDataChangeMap changeEvents) {
-               // TODO Auto-generated method stub
-               
+               // not needed
        }
 
        /* (non-Javadoc)