commit 2d7d6704d437d8d698819614b942ee7a4621a0ab
Author: Patrick Plitzner <p.plitzner@bgbm.org>
Date:   Wed Aug 3 17:15:25 2016 +0200

    fix #5801 Make concept relations view work with taxon bulk editor

diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/ConceptContentProvider.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/ConceptContentProvider.java
index 2acbc4a01..2e116e3ef 100644
--- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/ConceptContentProvider.java
+++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/ConceptContentProvider.java
@@ -10,8 +10,8 @@
 
 package eu.etaxonomy.taxeditor.editor.view.concept;
 
-import java.util.HashSet;
-import java.util.Set;
+import java.util.HashMap;
+import java.util.Map;
 
 import org.eclipse.jface.viewers.IStructuredContentProvider;
 import org.eclipse.jface.viewers.Viewer;
@@ -28,42 +28,34 @@ import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
  */
 public class ConceptContentProvider implements IStructuredContentProvider {
 
-	/* (non-Javadoc)
-	 * @see org.eclipse.jface.viewers.IContentProvider#dispose()
-	 */
 	@Override
 	public void dispose() {
-		// TODO Auto-generated method stub
 		
 	}
 
-	/* (non-Javadoc)
-	 * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
-	 */
 	@Override
 	public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
-		// TODO Auto-generated method stub
-		
 	}
 
-	/* (non-Javadoc)
-	 * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
-	 */
 	@Override
 	public Object[] getElements(Object inputElement) {
+		Taxon taxon = null;
 		if(inputElement instanceof TaxonEditorInput){
-			Taxon taxon = ((TaxonEditorInput) inputElement).getTaxon();
-			
-			Set<TaxonRelationship> filteredTaxonRelations = new HashSet<TaxonRelationship>();
+			taxon = ((TaxonEditorInput) inputElement).getTaxon();
+		}
+		else if(inputElement instanceof Taxon){
+			taxon = (Taxon) inputElement;
+		}
+		if(taxon!=null){
+			Map<TaxonRelationship, Taxon> taxonToTaxonRelationsMap = new HashMap<>();
 			
 			for (TaxonRelationship relationship : taxon.getTaxonRelations()) {
 				if (! relationship.getType().equals(TaxonRelationshipType.MISAPPLIED_NAME_FOR()) ||
 						 relationship.getType().equals(TaxonRelationshipType.TAXONOMICALLY_INCLUDED_IN())) {
-					filteredTaxonRelations.add(relationship);
+					taxonToTaxonRelationsMap.put(relationship, taxon);
 				}
 			}
-			
-			return filteredTaxonRelations.toArray();
+			return taxonToTaxonRelationsMap.entrySet().toArray();
 		}
 		return new Object[0];
 	}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/ConceptLabelProvider.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/ConceptLabelProvider.java
index 6fb3d9c37..157defcca 100644
--- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/ConceptLabelProvider.java
+++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/ConceptLabelProvider.java
@@ -10,22 +10,18 @@
 
 package eu.etaxonomy.taxeditor.editor.view.concept;
 
+import java.util.Map.Entry;
+
 import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider;
 import org.eclipse.jface.viewers.LabelProvider;
 import org.eclipse.jface.viewers.StyledString;
 import org.eclipse.swt.graphics.Image;
 
-import eu.etaxonomy.cdm.model.common.Language;
-import eu.etaxonomy.cdm.model.common.Representation;
-import eu.etaxonomy.cdm.model.reference.IReference;
 import eu.etaxonomy.cdm.model.taxon.Taxon;
 import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
 import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
 import eu.etaxonomy.taxeditor.model.ImageResources;
 import eu.etaxonomy.taxeditor.model.TaxonRelationshipTypeInverseContainer;
-import eu.etaxonomy.taxeditor.store.CdmStore;
 
 /**
  * @author n.hoffmann
@@ -34,24 +30,18 @@ import eu.etaxonomy.taxeditor.store.CdmStore;
  */
 public class ConceptLabelProvider extends LabelProvider implements IStyledLabelProvider {
 
-	/* (non-Javadoc)
-	 * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
-	 */
 	@Override
 	public Image getImage(Object element) {
-		if(element instanceof TaxonRelationship){
-			return getTaxonRelationshipImage((TaxonRelationship) element);
+		if(element instanceof Entry){
+			return getTaxonRelationshipImage((TaxonRelationship) ((Entry<TaxonRelationship, Taxon>) element).getKey());
 		}
 		return super.getImage(element);
 	}
 	
-	/* (non-Javadoc)
-	 * @see org.eclipse.jface.viewers.ColumnLabelProvider#getText(java.lang.Object)
-	 */
 	@Override
 	public String getText(Object element) {
-		if(element instanceof TaxonRelationship){
-			return formatRelationship((TaxonRelationship) element);
+		if(element instanceof Entry){
+			return formatRelationship((Entry<TaxonRelationship, Taxon>) element);
 		}
 		
 		return "";
@@ -59,23 +49,20 @@ public class ConceptLabelProvider extends LabelProvider implements IStyledLabelP
 	
 	/**
 	 * Creates a string that holds a representation of the {@link TaxonRelationship} in relation to
-	 * the accepted taxon of the currently active {@link MultiPageTaxonEditor}.
+	 * the currently selected and accepted taxon.
 	 * 
 	 * @param relationship
 	 * @return a formatted String representation of the relationship
 	 */
-	private String formatRelationship(TaxonRelationship relationship){
-		Taxon sourceTaxon = EditorUtil.getActiveMultiPageTaxonEditor().getTaxon();
-		TaxonRelationshipTypeInverseContainer container = TaxonRelationshipTypeInverseContainer.CreateFromSource(sourceTaxon, relationship);
-		Taxon relatedTaxon = TaxonRelationshipTypeInverseContainer.RelatedTaxon(sourceTaxon, relationship);
+	private String formatRelationship(Entry<TaxonRelationship, Taxon> entry){
+		Taxon sourceTaxon = entry.getValue();
+		TaxonRelationshipTypeInverseContainer container = TaxonRelationshipTypeInverseContainer.CreateFromSource(sourceTaxon, entry.getKey());
+		Taxon relatedTaxon = TaxonRelationshipTypeInverseContainer.RelatedTaxon(sourceTaxon, entry.getKey());
 		String string = String.format("%s %s", container.getAbbreviatedLabel(), relatedTaxon);
 		
 		return string;
 	}
 	
-	/* (non-Javadoc)
-	 * @see org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider#getStyledText(java.lang.Object)
-	 */
 	@Override
 	public StyledString getStyledText(Object element) {
 		return  new StyledString(getText(element), StyledString.QUALIFIER_STYLER);
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/ConceptViewPart.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/ConceptViewPart.java
index 5291b6609..074094054 100644
--- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/ConceptViewPart.java
+++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/ConceptViewPart.java
@@ -25,12 +25,14 @@ import org.eclipse.ui.IEditorPart;
 import org.eclipse.ui.IWorkbenchActionConstants;
 import org.eclipse.ui.IWorkbenchPart;
 
+import eu.etaxonomy.cdm.model.taxon.Taxon;
 import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
 import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
 import eu.etaxonomy.taxeditor.editor.key.AbstractGraphKeyEditor;
 import eu.etaxonomy.taxeditor.model.AbstractUtility;
 import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
 import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData;
+import eu.etaxonomy.taxeditor.model.LineSelection;
 import eu.etaxonomy.taxeditor.view.AbstractCdmEditorViewPart;
 
 /**
@@ -51,8 +53,13 @@ public class ConceptViewPart extends AbstractCdmEditorViewPart implements IPartC
 			return;
 		}
 
-		if(part instanceof BulkEditor){
-			showEmptyPage();
+		if(part instanceof BulkEditor && selection instanceof LineSelection){
+			if(((LineSelection) selection).getFirstElement() instanceof Taxon){
+				showViewer(part, (LineSelection) selection);
+			}
+			else{
+				showEmptyPage();
+			}
 			return;
 		}
 
