Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [henshin-dev] Henshin Trace object

Okay, thanks for answer.

Cheers,
Yannic


On 18 June 2013 19:41, Christian Krause <henshin.ck@xxxxxxxxx> wrote:
Hi Yannic,

no, you cannot add objects to two resources. The contents of a resource are essentially like a containment EReference in EMF. And containment means that an object can be contained in at most one other object (or in this case a resource).

Cheers,
Christian



2013/6/18 Yannic Noller <nolleryc@xxxxxxxxx>
Hi all,

I have a problem with the Henshin Trace object. I create in a rule a Trace between two elements of different meta models and I want to add the Trace object to both instance models:

// Add new elements.
for (EObject root : roots) {
if (root.getClass().getPackage().getName().equals(SA_PACKAGE)) {
if (!oldSAElements.contains(root)) {
saInstanceModel.getContents().add(root);
}
} else if (root.getClass().getPackage().getName().equals(FAULTTREE_PACKAGE)) {
if (!oldFaulttreeElements.contains(root)) {
faulttreeInstanceModel.getContents().add(root);
}
} else if (root.getClass().getPackage().getName().equals(TRACE_PACKAGE)) {
if (root instanceof Trace) {
// TODO: Trace is added to only one model?
Trace trace = (Trace) root;
saInstanceModel.getContents().add(trace);
faulttreeInstanceModel.getContents().add(trace);
}
} else {
throw new RuntimeException("Unknown model class: " + root.getClass());
}
}

But the faulttreeInstanceModel gets always the Trace object. Isn't it possible to add a Trace twice or any advice for this problem?

Cheers,
Yannic

_______________________________________________
henshin-dev mailing list
henshin-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/henshin-dev



_______________________________________________
henshin-dev mailing list
henshin-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/henshin-dev



Back to the top