blob: 89a71cf3c61778bdcb1e636420b165f94ae1e5f4 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
package org.eclipse.papyrus.requirements.sysml.matrix.satisfiedBy.config.cellmanager;
import org.eclipse.emf.common.util.EList;
import org.eclipse.papyrus.infra.nattable.manager.cell.AbstractCellManager;
import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
import org.eclipse.papyrus.infra.nattable.utils.AxisUtils;
import org.eclipse.papyrus.requirements.sysml.matrix.satisfiedBy.config.Activator;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.Stereotype;
public class SameStereotypeCellManager extends AbstractCellManager {
public static final String CELL_MANAGER_ID = Activator.PLUGIN_ID + ".SameStereotypeCellManager";
@Override
public boolean handles(Object columnElement, Object rowElement) {
Object column = AxisUtils.getRepresentedElement(columnElement);
Object row = AxisUtils.getRepresentedElement(rowElement);
if (column instanceof Element && row instanceof Element) {
Element colUMLElement = (Element) column;
Element rowUMLElement = (Element) row;
EList <Stereotype> stereotypesInRowUMLElement = rowUMLElement.getAppliedStereotypes();
for (Stereotype s: colUMLElement.getAppliedStereotypes()){
if (stereotypesInRowUMLElement.contains(s)){
return true;
}
}
}
return false;
}
@Override
protected Object doGetValue(Object columnElement, Object rowElement, INattableModelManager tableManager) {
return "No relationship";
}
}
|