Skip to main content



      Home
Home » Modeling » UML2 » Removal of unavailable profiles
Removal of unavailable profiles [message #476541] Wed, 14 November 2007 12:00 Go to next message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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
>
Previous Topic:UML2 & OCL version compatibility
Next Topic:Generalization of an Aggregation
Goto Forum:
  


Current Time: Sat Aug 30 23:53:22 EDT 2025

Powered by FUDForum. Page generated in 0.06479 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top