use of org.geotoolkit.sml.xml.v100.Classifier in project osate2 by osate.
the class AadlStructureBridge method canBeLandmark.
@Override
public boolean canBeLandmark(final String handle) {
// Must be a component classifier, feature, subcomponent, etc, or a property declaration in a property set.
final Element aadlElement = (Element) getObjectForHandle(handle);
final boolean isLandmark = aadlElement instanceof PropertySet || aadlElement instanceof AadlPackage || aadlElement instanceof PackageSection || aadlElement instanceof Classifier || aadlElement instanceof ClassifierFeature || aadlElement instanceof PropertyConstant || aadlElement instanceof PropertyType || aadlElement instanceof Property;
return isLandmark;
}
use of org.geotoolkit.sml.xml.v100.Classifier in project osate2 by osate.
the class AadlElementContentProvider method getChildren.
@Override
public Object[] getChildren(Object parentElement) {
Stream<EObject> children;
final ResourceSetImpl resourceSet = new ResourceSetImpl();
if (parentElement instanceof IFile) {
String path = ((IFile) parentElement).getFullPath().toString();
URI uri = URI.createPlatformResourceURI(path, true);
Resource resource = resourceSet.getResource(uri, true);
children = resource.getContents().stream();
} else if (parentElement instanceof ContributedAadlStorage) {
URI uri = ((ContributedAadlStorage) parentElement).getUri();
Resource resource = resourceSet.getResource(uri, true);
children = resource.getContents().stream();
} else {
EObjectURIWrapper wrapper = (EObjectURIWrapper) parentElement;
EObject eObject = resourceSet.getEObject(wrapper.getUri(), true);
if (eObject instanceof AadlPackage || eObject instanceof PropertySet || eObject instanceof ComponentInstance) {
children = eObject.eContents().stream().filter(element -> !(element instanceof SystemOperationMode || element instanceof PropertyAssociation));
} else if (eObject instanceof PackageSection) {
children = eObject.eContents().stream().filter(element -> element instanceof Classifier || element instanceof AnnexLibrary);
} else if (eObject instanceof Classifier) {
children = eObject.eContents().stream().filter(element -> element instanceof ClassifierFeature || element instanceof PropertyAssociation);
} else {
children = Stream.empty();
}
}
final EObjectURIWrapper.Factory factory = new EObjectURIWrapper.Factory(UiUtil.getModelElementLabelProvider());
// Issue 2430: limit the number of children to 150
return children.limit(150).map(element -> factory.createWrapperFor(element)).toArray();
}
use of org.geotoolkit.sml.xml.v100.Classifier in project osate2 by osate.
the class EMV2Util method findSubcomponentOrIncomingErrorProparation.
public static ErrorPropagation findSubcomponentOrIncomingErrorProparation(Element elem, String name) {
Classifier cl = getAssociatedClassifier(elem);
if (cl == null) {
return null;
}
EList<Subcomponent> subs;
int idx = name.indexOf('.');
boolean foundSub = false;
boolean findMore = true;
while (idx != -1 && findMore) {
String subname = name.substring(0, idx);
findMore = false;
if (cl instanceof ComponentImplementation) {
subs = ((ComponentImplementation) cl).getAllSubcomponents();
for (Subcomponent sub : subs) {
if (sub.getName().equalsIgnoreCase(subname)) {
name = name.substring(idx + 1);
cl = sub.getClassifier();
idx = name.indexOf('.');
foundSub = true;
findMore = true;
}
}
}
}
if (foundSub) {
return EMV2Util.findErrorPropagation(cl, name, DirectionType.OUT);
} else {
return EMV2Util.findErrorPropagation(cl, name, DirectionType.IN);
}
}
use of org.geotoolkit.sml.xml.v100.Classifier in project osate2 by osate.
the class EMV2Util method getAssociatedClassifier.
/**
* return the classifier that this subclause element belongs to.
* The subclause can be embedded or separate.
* @param an EObject in a EMV2 subclause
* @return Classifier
* @since 6.0
*/
public static Classifier getAssociatedClassifier(Element emv2Element) {
Classifier cl = emv2Element.getContainingClassifier();
if (cl != null) {
return cl;
}
ErrorModelSubclause emsc = getContainingErrorModelSubclause(emv2Element);
if (emsc == null || !emsc.getName().equalsIgnoreCase("EMV2")) {
// we are not inside an EMV2 subclause
return null;
}
return Aadl2GlobalScopeUtil.get(emsc, Aadl2Package.eINSTANCE.getComponentClassifier(), emsc.getQualifiedName());
}
use of org.geotoolkit.sml.xml.v100.Classifier in project osate2 by osate.
the class EMV2Util method findConnectionErrorSourceForConnection.
/**
* Find ConnectionErrorSource with given classifier by looking through all connection error sources
* @param conni the connection instance whose connection declarations we're using
* @return the connection error source or null
*/
public static ErrorSource findConnectionErrorSourceForConnection(ConnectionInstance conni) {
for (ConnectionReference connref : conni.getConnectionReferences()) {
Connection conn = connref.getConnection();
Classifier cl = getAssociatedClassifier(conn);
if (cl != null) {
Collection<ErrorSource> ceslist = getAllConnectionErrorSources(cl);
for (ErrorSource ces : ceslist) {
if (ces.isAll() || ces.getSourceModelElement().getName().equalsIgnoreCase(conn.getName())) {
return ces;
}
}
}
}
return null;
}
Aggregations