Commit 02fd233c authored by Simon Barner's avatar Simon Barner
Browse files

Bug fix: consider provided source model element annotations when determining ...

Bug fix: consider provided source model element annotations when determining  list estructural features to be watched for changes
refs 2950,2562
parent 730ee1d2
AllocationTableEditor.java a730c13e6adbc226dccf5bca44e623ff36a25512 YELLOW
AllocationTableEditorUtils.java 3f53fc3ce279be40ca18d6d63f3f7f830ec4eb86 YELLOW
ModelListenerEditorBase.java 422273b832625f15c28390c07fb0ab8167741b0f YELLOW
ParameterTableEditor.java e3cd80a4f39e49b19f7f0febab1068f3aece66bb YELLOW
ParameterTableEditor.java 10b1d1d3c05f75f9ad4d7f7031fe69d733894919 YELLOW
......@@ -16,11 +16,16 @@
package org.fortiss.af3.allocation.ui.editor;
import static java.util.Collections.emptyList;
import static java.util.stream.Collectors.toList;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.getEClassForClass;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.jface.viewers.TreeViewer;
import org.fortiss.af3.allocation.model.ParameterEntry;
import org.fortiss.af3.allocation.model.ParameterTable;
......@@ -44,13 +49,33 @@ public class ParameterTableEditor<T extends ParameterTable> extends AllocationTa
*/
private Collection<Class<? extends IAnnotatedSpecification>> sourceEntityAnnotationTypes;
/**
* Helper method to compile the list of {@link EStructuralFeature}s to be observed based on the
* {@code annotationType} backing the parameter edited in this {@link ParameterTableEditor}, and
* the list of {@code sourceEntityAnnotationTypes} that are additionally accessible here.
*/
private static List<EStructuralFeature> getStructuralFeatures(
Class<? extends IAnnotatedSpecification> annotationType,
Collection<Class<? extends IAnnotatedSpecification>> sourceEntityAnnotationTypes) {
Set<EStructuralFeature> rval =
new HashSet<EStructuralFeature>(getEClassForClass(annotationType)
.getEAllStructuralFeatures());
if(sourceEntityAnnotationTypes != null) {
for(Class<? extends IAnnotatedSpecification> clazz : sourceEntityAnnotationTypes) {
rval.addAll(getEClassForClass(clazz).getEAllStructuralFeatures());
}
}
return rval.stream().collect(toList());
}
/** Constructor. */
public ParameterTableEditor(Class<? extends ParameterEntry> allocationEntryType,
Class<? extends IAnnotatedSpecification> annotationType,
Collection<Class<? extends IAnnotatedSpecification>> sourceEntityAnnotationTypes,
ViewElementFilter sourceViewElementFilter, ViewElementFilter targetViewElementFilter) {
super(allocationEntryType, sourceViewElementFilter, targetViewElementFilter, false,
getEClassForClass(annotationType).getEAllStructuralFeatures());
getStructuralFeatures(annotationType, sourceEntityAnnotationTypes));
this.annotationType = annotationType;
this.sourceEntityAnnotationTypes = sourceEntityAnnotationTypes;
}
......
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