use of org.modelversioning.emfprofileapplication.ProfileImport in project Palladio-Editors-Sirius by PalladioSimulator.
the class RemoveATAction method execute.
/**
* Removes the selected Architectural Template from the {@link System}
*
* @edited by Edith to unapply ResourceEnvironment stereotypesApplications too
*/
@Override
public void execute(final Collection<? extends EObject> selections, final Map<String, Object> parameters) {
final EObject selection = selections.iterator().next();
if (selection instanceof StereotypeApplication) {
final StereotypeApplication stereotypeApplication = (StereotypeApplication) selection;
if (stereotypeApplication.getAppliedTo() instanceof System) {
final System system = (System) stereotypeApplication.getAppliedTo();
ArchitecturalTemplateAPI.unapplyArchitecturalTemplate(system, stereotypeApplication.getStereotype().getProfile());
} else
throw new RuntimeException("Unsupported stereoApplication removal: " + stereotypeApplication.getAppliedTo());
} else if (selection instanceof ProfileImport) {
final ProfileImport profileImport = (ProfileImport) selection;
ProfileAPI.unapplyProfile(profileImport.eResource(), profileImport.getProfile());
}
}
Aggregations