*/
package eu.etaxonomy.taxeditor.editor.definedterm;
+import java.util.ArrayList;
+import java.util.List;
+
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerComparator;
import eu.etaxonomy.cdm.api.service.l10n.TermRepresentation_L10n;
import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.common.Language;
import eu.etaxonomy.cdm.model.term.DefinedTermBase;
import eu.etaxonomy.cdm.persistence.dto.TermDto;
import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
/**
* @author pplitzner
// location <-> add term method used in the MoveDefinedTermOperation
// execute call
//FIXME: remove this when all viewer are changed to use DTOs
+ List<Language> languages = new ArrayList<>();
+ languages.add(PreferencesUtil.getGlobalLanguage());
if(e1 instanceof DefinedTermBase && CdmBase.deproxy(e1, DefinedTermBase.class).isOrderRelevant()
&& e2 instanceof DefinedTermBase && CdmBase.deproxy(e2, DefinedTermBase.class).isOrderRelevant()) {
DefinedTermBase<?> otbe1 = (DefinedTermBase<?>)e1;
}
else {
// order indexes are equal or null -> compare by label
- termDto1.localize(new TermRepresentation_L10n());
- termDto2.localize(new TermRepresentation_L10n());
+
+ termDto1.localize(new TermRepresentation_L10n(), languages);
+ termDto2.localize(new TermRepresentation_L10n(), languages);
if(termDto1.getRepresentation_L10n()!=null){
if(termDto2.getRepresentation_L10n()!=null) {
return termDto1.getRepresentation_L10n().toLowerCase().compareTo(termDto2.getRepresentation_L10n().toLowerCase());
else if(e1 instanceof TermVocabularyDto && e2 instanceof TermVocabularyDto) {
TermVocabularyDto termVoc1 = (TermVocabularyDto)e1;
TermVocabularyDto termVoc2 = (TermVocabularyDto)e2;
- termVoc1.localize(new TermRepresentation_L10n());
- termVoc2.localize(new TermRepresentation_L10n());
+ termVoc1.localize(new TermRepresentation_L10n(), languages);
+ termVoc2.localize(new TermRepresentation_L10n(), languages);
if(termVoc1.getRepresentation_L10n()!=null){
if(termVoc2.getRepresentation_L10n()!=null) {
return termVoc1.getRepresentation_L10n().toLowerCase().compareTo(termVoc2.getRepresentation_L10n().toLowerCase());