Search in sources :

Example 41 with Classifier

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;
}
Also used : AadlPackage(org.osate.aadl2.AadlPackage) PackageSection(org.osate.aadl2.PackageSection) Element(org.osate.aadl2.Element) PropertySet(org.osate.aadl2.PropertySet) Classifier(org.osate.aadl2.Classifier) PropertyType(org.osate.aadl2.PropertyType) Property(org.osate.aadl2.Property) ClassifierFeature(org.osate.aadl2.ClassifierFeature) PropertyConstant(org.osate.aadl2.PropertyConstant)

Example 42 with Classifier

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();
}
Also used : ComponentInstance(org.osate.aadl2.instance.ComponentInstance) URI(org.eclipse.emf.common.util.URI) PackageSection(org.osate.aadl2.PackageSection) EObject(org.eclipse.emf.ecore.EObject) AadlPackage(org.osate.aadl2.AadlPackage) ResourceSetImpl(org.eclipse.emf.ecore.resource.impl.ResourceSetImpl) PropertySet(org.osate.aadl2.PropertySet) UiUtil(org.osate.ui.UiUtil) PropertyAssociation(org.osate.aadl2.PropertyAssociation) Stream(java.util.stream.Stream) Classifier(org.osate.aadl2.Classifier) SystemOperationMode(org.osate.aadl2.instance.SystemOperationMode) Resource(org.eclipse.emf.ecore.resource.Resource) IFile(org.eclipse.core.resources.IFile) ClassifierFeature(org.osate.aadl2.ClassifierFeature) ITreeContentProvider(org.eclipse.jface.viewers.ITreeContentProvider) AnnexLibrary(org.osate.aadl2.AnnexLibrary) EObjectURIWrapper(org.osate.aadl2.modelsupport.EObjectURIWrapper) ContributedAadlStorage(org.osate.xtext.aadl2.ui.resource.ContributedAadlStorage) ResourceSetImpl(org.eclipse.emf.ecore.resource.impl.ResourceSetImpl) IFile(org.eclipse.core.resources.IFile) AadlPackage(org.osate.aadl2.AadlPackage) PropertyAssociation(org.osate.aadl2.PropertyAssociation) PackageSection(org.osate.aadl2.PackageSection) Resource(org.eclipse.emf.ecore.resource.Resource) SystemOperationMode(org.osate.aadl2.instance.SystemOperationMode) Classifier(org.osate.aadl2.Classifier) URI(org.eclipse.emf.common.util.URI) ClassifierFeature(org.osate.aadl2.ClassifierFeature) ContributedAadlStorage(org.osate.xtext.aadl2.ui.resource.ContributedAadlStorage) EObject(org.eclipse.emf.ecore.EObject) EObjectURIWrapper(org.osate.aadl2.modelsupport.EObjectURIWrapper) ComponentInstance(org.osate.aadl2.instance.ComponentInstance) PropertySet(org.osate.aadl2.PropertySet) AnnexLibrary(org.osate.aadl2.AnnexLibrary)

Example 43 with Classifier

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);
    }
}
Also used : ComponentImplementation(org.osate.aadl2.ComponentImplementation) Subcomponent(org.osate.aadl2.Subcomponent) Classifier(org.osate.aadl2.Classifier) ComponentClassifier(org.osate.aadl2.ComponentClassifier) PropagationPoint(org.osate.xtext.aadl2.errormodel.errorModel.PropagationPoint) QualifiedPropagationPoint(org.osate.xtext.aadl2.errormodel.errorModel.QualifiedPropagationPoint)

Example 44 with Classifier

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());
}
Also used : ErrorModelSubclause(org.osate.xtext.aadl2.errormodel.errorModel.ErrorModelSubclause) Classifier(org.osate.aadl2.Classifier) ComponentClassifier(org.osate.aadl2.ComponentClassifier)

Example 45 with Classifier

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;
}
Also used : ErrorSource(org.osate.xtext.aadl2.errormodel.errorModel.ErrorSource) ConnectionReference(org.osate.aadl2.instance.ConnectionReference) Connection(org.osate.aadl2.Connection) Classifier(org.osate.aadl2.Classifier) ComponentClassifier(org.osate.aadl2.ComponentClassifier)

Aggregations

Classifier (org.osate.aadl2.Classifier)203 ComponentClassifier (org.osate.aadl2.ComponentClassifier)90 ComponentImplementation (org.osate.aadl2.ComponentImplementation)49 NamedElement (org.osate.aadl2.NamedElement)40 AadlPackage (org.osate.aadl2.AadlPackage)38 Subcomponent (org.osate.aadl2.Subcomponent)37 ComponentType (org.osate.aadl2.ComponentType)34 EObject (org.eclipse.emf.ecore.EObject)31 ArrayList (java.util.ArrayList)29 BasicEList (org.eclipse.emf.common.util.BasicEList)28 Feature (org.osate.aadl2.Feature)26 DataClassifier (org.osate.aadl2.DataClassifier)22 FeatureGroupType (org.osate.aadl2.FeatureGroupType)21 ProcessorClassifier (org.osate.aadl2.ProcessorClassifier)21 AnnexSubclause (org.osate.aadl2.AnnexSubclause)17 Element (org.osate.aadl2.Element)17 EList (org.eclipse.emf.common.util.EList)15 ComponentInstance (org.osate.aadl2.instance.ComponentInstance)15 FeatureGroup (org.osate.aadl2.FeatureGroup)14 PropertyExpression (org.osate.aadl2.PropertyExpression)14