commit 566e18a237dc686acfdeafb05882d5300d20fb3b
Author: Katja Luther <k.luther@bgbm.org>
Date:   Fri Oct 19 11:59:23 2018 +0200

    presenceAbsence terms in distribution editor are sorted, labels instead of abbrevLabels for areas

diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/ChecklistLabelProvider.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/ChecklistLabelProvider.java
index 42fee9652..e9d1caaa6 100644
--- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/ChecklistLabelProvider.java
+++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/ChecklistLabelProvider.java
@@ -122,10 +122,8 @@ public class ChecklistLabelProvider extends LabelProvider implements ITableLabel
                                 }
                                 PresenceAbsenceTerm term = distribution.getStatus();
                                 Representation rep = distribution.getStatus().getPreferredRepresentation(CdmStore.getDefaultLanguage());
-                                String label = rep.getAbbreviatedLabel();
-                                if (label == null){
-                                    label = rep.getLabel();
-                                }
+                                String label = rep.getLabel();
+
                                 if (label == null){
                                     distribution.getStatus().getTitleCache();
                                 }
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/ChecklistEditorE4.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/ChecklistEditorE4.java
index f89ce33d0..c35f07e03 100644
--- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/ChecklistEditorE4.java
+++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/ChecklistEditorE4.java
@@ -142,6 +142,7 @@ public class ChecklistEditorE4 implements  IConversationEnabled,
     private ChecklistEditorFilter filter;
 
     private Label statusLabel;
+    private Label statusLabelSourceReference;
 
     private ChecklistLabelProvider labelProvider;
 
@@ -252,9 +253,7 @@ public class ChecklistEditorE4 implements  IConversationEnabled,
         parent.setLayout(gridLayout);
 
        searchText = createSearchBar(parent);
-      // createSetDefaultReferenceButton(parent);
 
-       // getSite().setSelectionProvider(viewer);
 
     }
 
@@ -316,6 +315,7 @@ public class ChecklistEditorE4 implements  IConversationEnabled,
         Button button1 = new Button(parent, SWT.PUSH );
         GridData gridData2 = new GridData();
         gridData2.horizontalSpan = 1;
+        gridData2.horizontalAlignment = SWT.RIGHT;
         button1.setLayoutData(gridData2);
 
 
@@ -348,7 +348,8 @@ public class ChecklistEditorE4 implements  IConversationEnabled,
             @Override
             public void widgetSelected(SelectionEvent event) {
                 defaultSource = ReferenceSelectionDialog.select(AbstractUtility.getShell(), null);
-
+                statusLabelSourceReference.setText("Default Source Reference: " + defaultSource.getAbbrevTitleCache());
+                button2.setBackground(EditorUtil.getColor(Resources.COLOR_CONTROL_SELECTED));
             }
 
         });
@@ -395,6 +396,8 @@ public class ChecklistEditorE4 implements  IConversationEnabled,
             @Override
             public void widgetSelected(SelectionEvent event) {
                 defaultSource = ReferenceSelectionDialog.select(AbstractUtility.getShell(), null);
+                statusLabelSourceReference.setText("Default Source Reference: " + defaultSource.getAbbrevTitle() != null? defaultSource.getAbbrevTitle() : defaultSource.getAbbrevTitleCache());
+
             }
         });
 
@@ -405,13 +408,20 @@ public class ChecklistEditorE4 implements  IConversationEnabled,
 
     private void createStatusBar(Composite composite) {
         GridData gridData = new GridData();
-        gridData.horizontalSpan = 3;
+        gridData.horizontalSpan = 1;
         gridData.grabExcessHorizontalSpace = true;
         gridData.horizontalAlignment = GridData.FILL;
 
         statusLabel = new Label(composite, SWT.LEFT);
         statusLabel.setText(ELEMENT_COUNT + (countNodes != null ? countNodes : UNKNOWN));
         statusLabel.setLayoutData(gridData);
+
+        statusLabelSourceReference = new Label(composite, SWT.RIGHT);
+        statusLabelSourceReference.setLayoutData(gridData);
+        if (defaultSource != null){
+            statusLabelSourceReference.setText("Default Source Reference: " + defaultSource.getAbbrevTitle() != null? defaultSource.getAbbrevTitle() : defaultSource.getAbbrevTitleCache());
+
+        }
     }
 
     private void createTable() {
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/DistributionEditingSupportE4.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/DistributionEditingSupportE4.java
index cb9ba1b0b..0aeee7eb7 100644
--- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/DistributionEditingSupportE4.java
+++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/DistributionEditingSupportE4.java
@@ -3,6 +3,7 @@ package eu.etaxonomy.taxeditor.editor.view.checklist.e4;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
 import java.util.Map;
@@ -104,7 +105,9 @@ public final class DistributionEditingSupportE4 extends EditingSupport {
         Collection<DefinedTermBase> input = CdmStore.getTermManager().getPreferredTerms(TermType.PresenceAbsenceTerm);
         List<DefinedTermBase> inputList = new ArrayList(input);
         Comparator<DefinedTermBase> comp = new OrderedTermComparator<>();
-       // Collections.sort(inputList, comp);
+        Collections.sort(inputList, comp);
+        Collections.sort(inputList, Collections.reverseOrder());
+
         inputAll.addAll(1,inputList);
 
 
@@ -138,7 +141,7 @@ public final class DistributionEditingSupportE4 extends EditingSupport {
 
             }
 
-           //fireStateChanged(distributionForColumn);
+           //fireStateChanged();
             return null;
         }
         return null;
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java
index 13f7e12a7..b55d6d8b1 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java
@@ -140,10 +140,6 @@ public class PreferencesUtil implements IPreferenceKeys {
     			if (preference == null){
     				return null;
     			} else{
-//    				int index = StringUtils.lastIndexOf(preference.getValue(), ".");
-//    				UUID uuid = UUID.fromString(preference.getValue().substring(index +1, preference.getValue().length()));
-//    				preferredCode = NomenclaturalCode.getByUuid(uuid);
-
     				getPreferenceStore().setValue(PREFERRED_NOMENCLATURAL_CODE_KEY,
     				        preferenceKey);
     				getPreferenceStore().setValue(ALLOW_OVERRIDE_NOMENCLATURAL_CODE_KEY,preference.isAllowOverride());
@@ -1639,6 +1635,8 @@ public static void updateDBPreferences() {
         if(!prefStore.getBoolean(SHOW_IO_MENU) ||  !preference.isAllowOverride()){
             prefStore.setValue(SHOW_IO_MENU, preference.getValue());
         }
+    }else{
+        prefStore.setValue(SHOW_IO_MENU, true);
     }
 
     preference = getPreferenceFromDB(PreferencePredicate.ShowMediaView);
@@ -1646,6 +1644,8 @@ public static void updateDBPreferences() {
         if(!prefStore.getBoolean(SHOW_MEDIA) ||  !preference.isAllowOverride()){
             prefStore.setValue(SHOW_MEDIA, preference.getValue());
         }
+    }else{
+        prefStore.setValue(SHOW_MEDIA, true);
     }
 
     preference = getPreferenceFromDB(PreferencePredicate.ShowChecklistPerspective);
