import eu.etaxonomy.cdm.model.common.DefinedTermBase;
import eu.etaxonomy.cdm.model.common.TermBase;
import eu.etaxonomy.cdm.model.common.TermType;
-import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
+import eu.etaxonomy.cdm.model.common.TermVocabulary;
import eu.etaxonomy.taxeditor.model.ContextListenerAdapter;
import eu.etaxonomy.taxeditor.model.TaxonRelationshipTypeInverseContainer;
return getFilteredTerms(TermStore.getTerms(termType, null));
}
+ /**
+ *
+ * @param clazz
+ * @return
+ */
+ public <T extends DefinedTermBase> List<T> getPreferredTerms(TermVocabulary<T> termVocabulary){
+ return getFilteredTerms(new ArrayList<T>(TermStore.getTerms(termVocabulary, null)));
+ }
+
/**
*
* @param clazz
return getFilteredTerms(TermStore.getTerms(clazz));
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.model.ContextListenerAdapter#contextStart(org.eclipse.ui.IMemento, org.eclipse.core.runtime.IProgressMonitor)
- */
@Override
public void contextStart(IMemento memento, IProgressMonitor monitor) {
// read preferred terms from memento into an in memory representation
}
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.model.ContextListenerAdapter#contextAboutToStop(org.eclipse.ui.IMemento, org.eclipse.core.runtime.IProgressMonitor)
- */
@Override
public void contextStop(IMemento memento, IProgressMonitor monitor) {
saveTerms(memento, monitor);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.model.ContextListenerAdapter#workbenchShutdown(org.eclipse.ui.IMemento, org.eclipse.core.runtime.IProgressMonitor)
- */
@Override
public void workbenchShutdown(IMemento memento, IProgressMonitor monitor) {
saveTerms(memento, monitor);
String typeName = getTermClass(initialTerms);
Collection<UUID> hiddenTermUuids = hiddenTermsMap.get(typeName);
-
+
if(hiddenTermUuids == null){
return initialTerms;
if(! hiddenTermUuids.contains(((TaxonRelationshipTypeInverseContainer) term).getType().getUuid())){
T type = (T)((TaxonRelationshipTypeInverseContainer) term).getType();
filteredTerms.add(type);
-
+
}
}
if(! hiddenTermUuids.contains(term.getUuid())){
}
private <T extends DefinedTermBase> String getTermClass(Collection<T> initialTerms){
-
+
String result = null;
if(!initialTerms.isEmpty()){
-
+
//TODO: there should be a more generic solution!!
T entity = initialTerms.iterator().next();
if (entity instanceof TaxonRelationshipTypeInverseContainer){