Use formatter framework in DerivateLabelProvider
authorPatrick Plitzner <p.plitzner@bgbm.org>
Tue, 1 Dec 2015 10:46:26 +0000 (11:46 +0100)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Wed, 2 Dec 2015 10:09:38 +0000 (11:09 +0100)
eu.etaxonomy.taxeditor.cdmlib/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateView.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/derivateSearch/DerivateLabelProvider.java

index 1388318fad0b6963d462e0c41275e84a0d4e13ca..274c01e26bfaf56635977678c5a7851963850d52 100644 (file)
@@ -50,6 +50,7 @@ Export-Package: com.google.api,
  eu.etaxonomy.cdm.ext.occurrence.gbif,
  eu.etaxonomy.cdm.ext.openurl,
  eu.etaxonomy.cdm.ext.sru,
+ eu.etaxonomy.cdm.format,
  eu.etaxonomy.cdm.hibernate,
  eu.etaxonomy.cdm.hibernate.search,
  eu.etaxonomy.cdm.io.api.application,
index c526da1f8e55decbbe46728d511cbffa8a3483e3..b5064ddb3638c45d1027853408608b1a0a6771dc 100644 (file)
@@ -347,7 +347,7 @@ public class DerivateView extends EditorPart implements IPartContentHasFactualDa
     public void changed(Object element) {
         setDirty(true);
         firePropertyChange(IEditorPart.PROP_DIRTY);
-        viewer.refresh();
+        viewer.refresh(new TreeNode(element));
     }
 
     @Override
index 92276048f3f058dbca11ba4d618db6c618654bc8..388928ef461ac9687879d202913c435c67940fcf 100644 (file)
@@ -27,6 +27,8 @@ import org.hibernate.LazyInitializationException;
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.service.IOccurrenceService;
 import eu.etaxonomy.cdm.api.service.molecular.ISequenceService;
+import eu.etaxonomy.cdm.format.CdmFormatter;
+import eu.etaxonomy.cdm.format.ICdmFormatter.FormatKey;
 import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
 import eu.etaxonomy.cdm.model.common.CdmBase;
 import eu.etaxonomy.cdm.model.common.DefinedTerm;
@@ -130,7 +132,13 @@ public class DerivateLabelProvider extends ColumnLabelProvider {
     /** {@inheritDoc} */
     @Override
     public String getText(Object element) {
-        return getDerivateText(element);
+        if(element instanceof TreeNode){
+            element = ((TreeNode) element).getValue();
+        }
+        CdmFormatter formatter = new CdmFormatter(FormatKey.ACCESSION_NUMBER, FormatKey.CLOSE_BRACKET, FormatKey.ACCESSION_NUMBER, FormatKey.OPEN_BRACKET,
+                FormatKey.LOCALITY_TEXT, FormatKey.CLOSE_BRACKET);
+        return formatter.format(element);
+//        return getDerivateText(element);
     }
 
     /** {@inheritDoc} */