Search in sources :

Example 1 with StereotypeApplication

use of org.modelversioning.emfprofileapplication.StereotypeApplication 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());
    }
}
Also used : EObject(org.eclipse.emf.ecore.EObject) StereotypeApplication(org.modelversioning.emfprofileapplication.StereotypeApplication) ProfileImport(org.modelversioning.emfprofileapplication.ProfileImport) System(org.palladiosimulator.pcm.system.System)

Example 2 with StereotypeApplication

use of org.modelversioning.emfprofileapplication.StereotypeApplication in project Palladio-Editors-Sirius by PalladioSimulator.

the class RemoveATRoleAction method execute.

/**
 * Asks the user to select a {@link Role} and attaches it to the given {@link AssemblyContext}.
 */
@Override
public void execute(final Collection<? extends EObject> selections, final Map<String, Object> parameters) {
    final StereotypeApplication stereotypeApplication = (StereotypeApplication) (selections.isEmpty() ? null : selections.iterator().next());
    ArchitecturalTemplateAPI.unapplyRole(stereotypeApplication.getAppliedTo(), stereotypeApplication.getStereotype());
}
Also used : StereotypeApplication(org.modelversioning.emfprofileapplication.StereotypeApplication)

Aggregations

StereotypeApplication (org.modelversioning.emfprofileapplication.StereotypeApplication)2 EObject (org.eclipse.emf.ecore.EObject)1 ProfileImport (org.modelversioning.emfprofileapplication.ProfileImport)1 System (org.palladiosimulator.pcm.system.System)1