[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.modeling.mdt.ocl] changing context of existing query
|
Hi everyone,
I have a very specific problem: I'd like to change the EClassifier context
of an existing OCL query.
In my project, there are several (meta)model repositories whose contents
are replicated through EMF copy at certain times.
E.g. eClass1 is located in repository A and copied to repository B.
Because this can happen multiple times, to avoid a severe performance hit
I'd like to prepare the OCL queries for the elements in repository A only
once and exchange their context with the copied elements in B each time a
copy is created, so they can be executed for B.
I realized that the bindings are kept in the OCL environment, so I tried
resetting them there (metaModelMap redirects to the eclass copies in B
according to their name)
for (Iterator iter = OCL_ENV.getEnvironment().getTypeResolver()
.getResource().getAllContents(); iter.hasNext();)
{
Object object = iter.next();
if (object instanceof Variable)
{
String eClassName = ((Variable)object).getEType().getName();
EClass newEClass = metaModelMap.get(eClassName);
((Variable)object).setEType(newEClass);
}
}
but this doesn't seem to do the trick. Maybe you've got some suggestions.
Thanks in advance,
Chris