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;
}
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())));
}
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());
}
Aggregations