(no commit message)
authorn.hoffmann <n.hoffmann@localhost>
Mon, 10 Oct 2011 17:00:18 +0000 (17:00 +0000)
committern.hoffmann <n.hoffmann@localhost>
Mon, 10 Oct 2011 17:00:18 +0000 (17:00 +0000)
eu.etaxonomy.taxeditor.cdmlib/.classpath
eu.etaxonomy.taxeditor.cdmlib/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/CdmProgressMonitorAdapter.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/IPreferenceKeys.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/CdmStoreConnector.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/TypeDesignationSection.java

index fd4178ae5cb58c38c24ba9860e81ba666e9da525..c92a755215a239ff5823f86aafa9cc8087b352bd 100644 (file)
@@ -1,13 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-commons-3.0.9-SNAPSHOT.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-ext-3.0.9-SNAPSHOT.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-io-3.0.9-SNAPSHOT.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-model-3.0.9-SNAPSHOT.jar" sourcepath="/Users/n.hoffmann/.m2/repository/eu/etaxonomy/cdmlib-model/3.0.9-SNAPSHOT/cdmlib-model-3.0.9-SNAPSHOT-sources.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-persistence-3.0.9-SNAPSHOT.jar" sourcepath="/Users/n.hoffmann/.m2/repository/eu/etaxonomy/cdmlib-persistence/3.0.9-SNAPSHOT/cdmlib-persistence-3.0.9-SNAPSHOT-sources.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-print-3.0.9-SNAPSHOT.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-remote-3.0.9-SNAPSHOT.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-services-3.0.9-SNAPSHOT.jar"/>
        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
        <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
        <classpathentry exported="true" kind="lib" path="lib/activation-1.1.jar" sourcepath="lib/activation-1.1src.zip"/>
@@ -24,6 +16,7 @@
        <classpathentry exported="true" kind="lib" path="lib/commons-beanutils-1.7.0.jar" sourcepath="lib/commons-beanutils-1.7.0src.zip"/>
        <classpathentry exported="true" kind="lib" path="lib/commons-collections-3.2.jar" sourcepath="lib/commons-collections-3.2src.zip"/>
        <classpathentry exported="true" kind="lib" path="lib/commons-dbcp-1.2.2.jar" sourcepath="lib/commons-dbcp-1.2.2src.zip"/>
+       <classpathentry exported="true" kind="lib" path="lib/commons-io-1.3.1.jar"/>
        <classpathentry exported="true" kind="lib" path="lib/commons-io-1.4.jar" sourcepath="lib/commons-io-1.4src.zip"/>
        <classpathentry exported="true" kind="lib" path="lib/commons-lang-2.4.jar"/>
        <classpathentry exported="true" kind="lib" path="lib/commons-logging-1.0.4.jar"/>
        <classpathentry exported="true" kind="lib" path="lib/xom-1.0.jar"/>
        <classpathentry exported="true" kind="lib" path="lib/xsltc.jar"/>
        <classpathentry exported="true" kind="lib" path="lib/xstream-1.3.1.jar" sourcepath="lib/xstream-1.3.1src.zip"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-commons-3.0.9-SNAPSHOT.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-ext-3.0.9-SNAPSHOT.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-io-3.0.9-SNAPSHOT.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-model-3.0.9-SNAPSHOT.jar" sourcepath="/Users/nph/.m2/repository/eu/etaxonomy/cdmlib-model/3.0.9-SNAPSHOT/cdmlib-model-3.0.9-SNAPSHOT-sources.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-persistence-3.0.9-SNAPSHOT.jar" sourcepath="/Users/n.hoffmann/.m2/repository/eu/etaxonomy/cdmlib-persistence/3.0.9-SNAPSHOT/cdmlib-persistence-3.0.9-SNAPSHOT-sources.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-print-3.0.9-SNAPSHOT.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-remote-3.0.9-SNAPSHOT.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-services-3.0.9-SNAPSHOT.jar" sourcepath="/cdmlib-services"/>
        <classpathentry kind="output" path="target/classes"/>
 </classpath>
index 1873366cdef8130adf573a0146428e5f4acfa01c..b4bfb1ab16183b264f25a0efe7498177ef9e9e1d 100644 (file)
@@ -88,6 +88,7 @@ Export-Package: com.google.api,
    eu.etaxonomy.cdm.model.common",
  eu.etaxonomy.cdm.common;uses:="org.jdom.output,org.jdom",
  eu.etaxonomy.cdm.common.media,
+ eu.etaxonomy.cdm.common.monitor,
  eu.etaxonomy.cdm.database;
   uses:="org.springframework.transaction,
    org.apache.log4j,
@@ -798,7 +799,6 @@ Bundle-ClassPath: .,
  lib/hibernate-annotations-3.4.0-SNAPSHOT.jar,
  lib/hibernate-commons-annotations-3.4.0-SNAPSHOT.jar,
  lib/hibernate-core-3.4.0-SNAPSHOT.jar,
- lib/hibernate-envers-3.4.0-SNAPSHOT.jar,
  lib/hibernate-search-3.1.0.GA.jar,
  lib/hibernate-tools-3.2.0.ga.jar,
  lib/hibernate-validator-4.0.0.CR1.jar,
@@ -882,4 +882,5 @@ Bundle-ClassPath: .,
  lib/cdmlib-persistence-3.0.9-SNAPSHOT.jar,
  lib/cdmlib-print-3.0.9-SNAPSHOT.jar,
  lib/cdmlib-remote-3.0.9-SNAPSHOT.jar,
- lib/cdmlib-services-3.0.9-SNAPSHOT.jar
+ lib/cdmlib-services-3.0.9-SNAPSHOT.jar,
+ lib/hibernate-envers-3.4.0-SNAPSHOT.jar
index 90f2822d4d2363eaba7bb94124c9f03c3c722555..87dec860ab71e9b2dd8b7b14ac8a456cb1a31b5e 100644 (file)
@@ -15,7 +15,7 @@ import eu.etaxonomy.taxeditor.store.StoreUtil;
  * @created Sep 17, 2010
  * @version 1.0
  */
-public class CdmProgressMonitorAdapter implements eu.etaxonomy.cdm.common.IProgressMonitor {
+public class CdmProgressMonitorAdapter implements eu.etaxonomy.cdm.common.monitor.IProgressMonitor {
        
        private IProgressMonitor progressMonitor;
 
index 97bade239fb63896a5a73296498c5f6b6646cdcc..a2382fcee91a24f331026d4332437805fae1d18d 100644 (file)
@@ -115,4 +115,6 @@ public interface IPreferenceKeys {
        public static final String BULK_EDITOR_OCCURRENCE_SHOW_FIELD_OBSERVATIONS = "eu.etaxonomy.taxeditor.bulkeditor.occurrence.showFieldObservations";
 
        public static final String SEARCH_OPEN_RESULTS_IN_SEPARATE_WINDOWS = "eu.etaxonomy.taxeditor.navigation.search.openResultInSeparateWindows";
+
+       public static final String ADD_TYPES_TO_ALL_NAMES = "eu.etaxonomy.taxeditor.store.addTypeToAllNames";
 }
index f4822c2618bb902b10618c36f3e1edfe16f4aafc..4f4901ec34172748f033fa91e89420b624a08e19 100644 (file)
@@ -11,6 +11,7 @@
 package eu.etaxonomy.taxeditor.store;
 
 import java.sql.SQLException;
+import java.util.concurrent.CancellationException;
 
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
@@ -93,12 +94,15 @@ class CdmStoreConnector extends Job {
                                                applicationContextBean, dataSource, dbSchemaValidation,
                                                false, subprogressMonitor);
                        } catch (Exception e) {
+                               if(! causeIsCancelationExceptionRecursive(e)){
+                                       return new Status(IStatus.ERROR, "Could not connect to CDM Store", "An error occurred while trying to connect to datasource: " + dataSource.getName(), e);
+                               }
+                       } finally {
                                monitor.done();
-                               return new Status(IStatus.ERROR, "Could not connect to CDM Store", "An error occurred while trying to connect to datasource: " + dataSource.getName(), e);
                        }
                }
                
-               monitor.done();
+               
 
                if (!monitor.isCanceled()) {
                        CdmStore.setInstance(applicationController, dataSource);
@@ -213,6 +217,16 @@ class CdmStoreConnector extends Job {
                }
        }
 
+       private boolean causeIsCancelationExceptionRecursive(Throwable throwable){
+               if(throwable == null){
+                       return false;
+               }else if(throwable instanceof CancellationException){
+                       return true;
+               }else{
+                       return causeIsCancelationExceptionRecursive(throwable.getCause());
+               }
+       }
+       
        private void checkDatabaseReachable(IProgressMonitor monitor) {
                try {
                        monitor.subTask("Checking if datasource is reachable.");
index d0fb756d557f4e50de9e87903d6f155f90dc8ea4..bdda6b34645771e72d11daba7e3769e6a4136ff1 100644 (file)
@@ -22,6 +22,8 @@ import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation;
 import eu.etaxonomy.cdm.model.name.TaxonNameBase;
 import eu.etaxonomy.cdm.model.name.TypeDesignationBase;
 import eu.etaxonomy.cdm.model.taxon.TaxonBase;
+import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
@@ -55,7 +57,7 @@ public class TypeDesignationSection extends AbstractEntityCollectionSection<Taxo
        /** {@inheritDoc} */
        @Override
        public void addElement(TypeDesignationBase element) {
-               getEntity().addTypeDesignation(element, false);
+               getEntity().addTypeDesignation(element, PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.ADD_TYPES_TO_ALL_NAMES));
        }
 
        /** {@inheritDoc} */
@@ -89,9 +91,9 @@ public class TypeDesignationSection extends AbstractEntityCollectionSection<Taxo
        /** {@inheritDoc} */
        @Override
        public void removeElement(TypeDesignationBase element) {
-               CdmStore.getService(INameService.class).deleteTypeDesignation(getEntity(), element);
-               
-//             getEntity().removeTypeDesignation(element);
+               boolean removeTypeDesignationFromAllTypifiedNames = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.ADD_TYPES_TO_ALL_NAMES);
+               TaxonNameBase entity = removeTypeDesignationFromAllTypifiedNames ? null : getEntity();
+               CdmStore.getService(INameService.class).deleteTypeDesignation(entity, element);
        }
 
        /*