use of com.archimatetool.model.IJunction in project archi by archimatetool.
the class JunctionsChecker method findBogusJunctions.
List<IIssue> findBogusJunctions() {
List<IIssue> issues = new ArrayList<IIssue>();
for (IArchimateElement element : fArchimateElements) {
if (element instanceof IJunction) {
IArchimateRelationship rel = null;
for (IArchimateRelationship relation : ArchimateModelUtils.getAllRelationshipsForConcept(element)) {
if (rel != null && rel.eClass() != relation.eClass()) {
String name = ArchiLabelProvider.INSTANCE.getLabel(element);
String description = NLS.bind(DESCRIPTION, name);
String explanation = NLS.bind(EXPLANATION, name);
IIssue issue = new ErrorType(NAME, description, explanation, element);
issues.add(issue);
break;
}
rel = relation;
}
}
}
return issues;
}
use of com.archimatetool.model.IJunction in project archi by archimatetool.
the class AllArchimateElementTypeTests method testGetJuntion_Type.
@Test
public void testGetJuntion_Type() {
Assume.assumeTrue(concept instanceof IJunction);
IJunction junction = (IJunction) concept;
assertEquals(IJunction.AND_JUNCTION_TYPE, junction.getType());
junction.setType(IJunction.OR_JUNCTION_TYPE);
assertEquals(IJunction.OR_JUNCTION_TYPE, junction.getType());
}
use of com.archimatetool.model.IJunction in project archi by archimatetool.
the class FixDefaultSizesHandler method getDefaultSize.
Dimension getDefaultSize(IDiagramModelObject dmo) {
IBounds bounds = dmo.getBounds();
if (bounds.getWidth() != -1 && bounds.getHeight() != -1) {
return new Dimension(bounds.getWidth(), bounds.getHeight());
}
// Legacy size of ArchiMate figure
if (dmo instanceof IDiagramModelArchimateObject) {
if (!(((IDiagramModelArchimateObject) dmo).getArchimateElement() instanceof IJunction)) {
return new Dimension(120, 55);
}
}
IGraphicalObjectUIProvider provider = (IGraphicalObjectUIProvider) ObjectUIFactory.INSTANCE.getProvider(dmo);
return provider != null ? provider.getUserDefaultSize() : new Dimension(120, 55);
}
use of com.archimatetool.model.IJunction in project archi by archimatetool.
the class JunctionFigure method paintFigure.
@Override
public void paintFigure(Graphics graphics) {
graphics.pushState();
graphics.setAntialias(SWT.ON);
if (!isEnabled()) {
setDisabledState(graphics);
}
Rectangle bounds = getBounds().getCopy();
String type = ((IJunction) ((DiagramModelArchimateObject) getDiagramModelObject()).getArchimateElement()).getType();
switch(type) {
case IJunction.AND_JUNCTION_TYPE:
default:
graphics.setBackgroundColor(getFillColor());
graphics.fillOval(bounds.getCopy());
break;
case IJunction.OR_JUNCTION_TYPE:
graphics.setBackgroundColor(getFillColor());
graphics.drawOval(bounds.x, bounds.y, bounds.width - 1, bounds.height - 1);
break;
}
graphics.popState();
}
use of com.archimatetool.model.IJunction in project archi by archimatetool.
the class NestedElementsChecker method isNestedWithoutValidRelation.
boolean isNestedWithoutValidRelation(IDiagramModelArchimateObject parent, IDiagramModelArchimateObject child) {
IArchimateElement parentElement = parent.getArchimateElement();
IArchimateElement childElement = child.getArchimateElement();
// Ignore nested Junctions
if (childElement instanceof IJunction) {
return false;
}
// Specialization relationship goes the other way around
for (IArchimateRelationship relation : parentElement.getTargetRelationships()) {
if (relation.getSource() == childElement) {
if (relation instanceof ISpecializationRelationship) {
return false;
}
}
}
// Other relationships
for (IArchimateRelationship relation : parentElement.getSourceRelationships()) {
if (relation.getTarget() == childElement) {
if (relation instanceof ICompositionRelationship || relation instanceof IAggregationRelationship || relation instanceof IAssignmentRelationship || relation instanceof IRealizationRelationship || relation instanceof IAccessRelationship) {
return false;
}
}
}
return true;
}
Aggregations