Removal of unavailable profiles [message #476541] |
Wed, 14 November 2007 12:00  |
Eclipse User |
|
|
|
Hi,
I have some UML models that have profiles applied that no longer exist. Is
there a way to programmatically remove all the annotations and the
profile application, without the profile being loaded?
Thanks,
Fredrik
|
|
|
Re: Removal of unavailable profiles [message #476640 is a reply to message #476541] |
Fri, 16 November 2007 10:37  |
Eclipse User |
|
|
|
Fredrik,
There's no built-in API for this... but it should be straightforward to
accomplish, by destroying any profile application whose applied profile is a
proxy and by clearing the resource's extension map before resaving it. For
example, something like this (untested) code might do the trick:
for (Iterator<ProfileApplication> i =
model.getAllProfileApplications().iterator(); i.hasNext(); ) {
ProfileApplication pa = i.next();
Profile p = pa.getAppliedProfile();
if (p != null && p.eIsProxy()) {
pa.destroy();
}
}
((XMLResource) model.eResource()).getEObjectToExtensionMap().clear();
Kenn
"Fredrik" <robertssen@googlemail.com> wrote in message
news:48d87b53805ebed6ff6513622d9df7eb$1@www.eclipse.org...
> Hi,
>
> I have some UML models that have profiles applied that no longer exist. Is
> there a way to programmatically remove all the annotations and the profile
> application, without the profile being loaded?
>
> Thanks,
>
> Fredrik
>
|
|
|
Re: Removal of unavailable profiles [message #625535 is a reply to message #476541] |
Fri, 16 November 2007 10:37  |
Eclipse User |
|
|
|
Fredrik,
There's no built-in API for this... but it should be straightforward to
accomplish, by destroying any profile application whose applied profile is a
proxy and by clearing the resource's extension map before resaving it. For
example, something like this (untested) code might do the trick:
for (Iterator<ProfileApplication> i =
model.getAllProfileApplications().iterator(); i.hasNext(); ) {
ProfileApplication pa = i.next();
Profile p = pa.getAppliedProfile();
if (p != null && p.eIsProxy()) {
pa.destroy();
}
}
((XMLResource) model.eResource()).getEObjectToExtensionMap().clear();
Kenn
"Fredrik" <robertssen@googlemail.com> wrote in message
news:48d87b53805ebed6ff6513622d9df7eb$1@www.eclipse.org...
> Hi,
>
> I have some UML models that have profiles applied that no longer exist. Is
> there a way to programmatically remove all the annotations and the profile
> application, without the profile being loaded?
>
> Thanks,
>
> Fredrik
>
|
|
|
Powered by
FUDForum. Page generated in 0.02941 seconds