Commit 4746cf00 authored by Simon Barner's avatar Simon Barner
Browse files

- Instead of listing the number of selected elements, print the following list of labels:

  - INamedElement: getName()
  - otherwise: toString()
parent e03c17cd
...@@ -19,6 +19,7 @@ package org.fortiss.tooling.base.ui.annotation.editingsupport; ...@@ -19,6 +19,7 @@ package org.fortiss.tooling.base.ui.annotation.editingsupport;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Iterator;
import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.jface.viewers.CellEditor; import org.eclipse.jface.viewers.CellEditor;
...@@ -29,6 +30,7 @@ import org.fortiss.tooling.base.annotation.AnnotationEntry; ...@@ -29,6 +30,7 @@ import org.fortiss.tooling.base.annotation.AnnotationEntry;
import org.fortiss.tooling.base.annotation.valueprovider.EStructuralFeatureDescriptor; import org.fortiss.tooling.base.annotation.valueprovider.EStructuralFeatureDescriptor;
import org.fortiss.tooling.base.model.element.IAnnotatedSpecification; import org.fortiss.tooling.base.model.element.IAnnotatedSpecification;
import org.fortiss.tooling.kernel.extension.data.ITopLevelElement; import org.fortiss.tooling.kernel.extension.data.ITopLevelElement;
import org.fortiss.tooling.kernel.model.INamedElement;
import org.fortiss.tooling.kernel.service.IPersistencyService; import org.fortiss.tooling.kernel.service.IPersistencyService;
/** /**
...@@ -37,7 +39,7 @@ import org.fortiss.tooling.kernel.service.IPersistencyService; ...@@ -37,7 +39,7 @@ import org.fortiss.tooling.kernel.service.IPersistencyService;
* @author barner * @author barner
* @author $Author$ * @author $Author$
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating GREEN Hash: F34CC0DE59A4E4ADC4040E26C276A653 * @ConQAT.Rating YELLOW Hash: 2FCECDA1772C304CCD3D3B3784749B69
* *
*/ */
public class MultiSelectionEditingSupport extends AnnotationEditingSupportBase { public class MultiSelectionEditingSupport extends AnnotationEditingSupportBase {
...@@ -123,11 +125,23 @@ public class MultiSelectionEditingSupport extends AnnotationEditingSupportBase { ...@@ -123,11 +125,23 @@ public class MultiSelectionEditingSupport extends AnnotationEditingSupportBase {
Object value = entry.getSpecificationValue(specClass, instanceKey); Object value = entry.getSpecificationValue(specClass, instanceKey);
if(value instanceof Collection<?>) { if(value instanceof Collection<?>) {
return "[" + ((Collection<?>)value).size() + " selected]"; StringBuffer valueCollectionString = new StringBuffer();
for(Iterator<?> iter = ((Collection<?>)value).iterator(); iter.hasNext();) {
Object v = iter.next();
if(v instanceof INamedElement) {
valueCollectionString.append(((INamedElement)v).getName());
} else {
valueCollectionString.append(v.toString());
}
if(iter.hasNext()) {
valueCollectionString.append(", ");
}
}
return "[" + valueCollectionString + "]";
} }
} }
return "[0 selected]"; return "[]";
} }
/** {@inheritDoc} */ /** {@inheritDoc} */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment