Search in sources :

Example 1 with ModelReference

use of org.eclipse.vorto.core.api.model.model.ModelReference in project vorto by eclipse.

the class AbstractModelElement method getReferences.

public Set<IModelElement> getReferences() {
    Set<IModelElement> references = new TreeSet<>();
    for (ModelReference modelReference : getModel().getReferences()) {
        for (ModelType possibleType : getPossibleReferenceTypes()) {
            ModelId modelId = ModelIdFactory.newInstance(possibleType, modelReference);
            IModelElement modelElementReference = this.modelProject.getModelElementById(modelId);
            if (modelElementReference != null) {
                references.add(modelElementReference);
                break;
            }
        }
    }
    return references;
}
Also used : TreeSet(java.util.TreeSet) ModelType(org.eclipse.vorto.core.api.model.model.ModelType) ModelId(org.eclipse.vorto.core.api.model.model.ModelId) ModelReference(org.eclipse.vorto.core.api.model.model.ModelReference)

Example 2 with ModelReference

use of org.eclipse.vorto.core.api.model.model.ModelReference in project vorto by eclipse.

the class InformationModelElement method addModelReference.

@Override
public void addModelReference(IModelElement modelElementReference) {
    ModelReference modelReference = modelElementReference.getId().asModelReference();
    if (!containsModelReference(modelReference)) {
        getModel().getReferences().add(modelReference);
        getModel().eResource().getContents().add(modelElementReference.getModel());
    }
    InformationModel infomodel = (InformationModel) getModel();
    infomodel.getProperties().add(createFunctionblockProperty((FunctionblockModel) modelElementReference.getModel(), getVariableNames(infomodel.getProperties())));
}
Also used : FunctionblockModel(org.eclipse.vorto.core.api.model.functionblock.FunctionblockModel) InformationModel(org.eclipse.vorto.core.api.model.informationmodel.InformationModel) ModelReference(org.eclipse.vorto.core.api.model.model.ModelReference)

Example 3 with ModelReference

use of org.eclipse.vorto.core.api.model.model.ModelReference in project vorto by eclipse.

the class AbstractModelElement method addModelReference.

public void addModelReference(IModelElement modelElementReference) {
    ModelReference referenceToAdd = modelElementReference.getId().asModelReference();
    for (ModelReference modelReference : getModel().getReferences()) {
        if (EcoreUtil.equals(modelReference, referenceToAdd)) {
            // model reference already exists
            return;
        }
    }
    getModel().getReferences().add(referenceToAdd);
    getModel().eResource().getContents().add(modelElementReference.getModel());
    EcoreUtil.resolveAll(getModel());
}
Also used : ModelReference(org.eclipse.vorto.core.api.model.model.ModelReference)

Aggregations

ModelReference (org.eclipse.vorto.core.api.model.model.ModelReference)3 TreeSet (java.util.TreeSet)1 FunctionblockModel (org.eclipse.vorto.core.api.model.functionblock.FunctionblockModel)1 InformationModel (org.eclipse.vorto.core.api.model.informationmodel.InformationModel)1 ModelId (org.eclipse.vorto.core.api.model.model.ModelId)1 ModelType (org.eclipse.vorto.core.api.model.model.ModelType)1