Search in sources :

Example 11 with ModelAccessor

use of org.eclipse.sirius.ecore.extender.business.api.accessor.ModelAccessor in project InformationSystem by ObeoNetwork.

the class DeleteServices method delete.

private void delete(EObject object, Session session, ModelAccessor modelAccessor) {
    Session vpSession = session;
    ModelAccessor vpModelAccessor = modelAccessor;
    if (vpSession == null) {
        vpSession = getSession(object);
    }
    if (vpModelAccessor == null) {
        vpModelAccessor = vpSession.getModelAccessor();
    }
    vpModelAccessor.eDelete(object, vpSession.getSemanticCrossReferencer(), new EReferencePredicate() {

        public boolean apply(EReference reference) {
            return DSemanticDecorator.class.isAssignableFrom(reference.getContainerClass());
        }
    });
}
Also used : DSemanticDecorator(org.eclipse.sirius.viewpoint.DSemanticDecorator) ModelAccessor(org.eclipse.sirius.ecore.extender.business.api.accessor.ModelAccessor) EReferencePredicate(org.eclipse.sirius.ext.emf.EReferencePredicate) EReference(org.eclipse.emf.ecore.EReference) Session(org.eclipse.sirius.business.api.session.Session)

Example 12 with ModelAccessor

use of org.eclipse.sirius.ecore.extender.business.api.accessor.ModelAccessor in project InformationSystem by ObeoNetwork.

the class DeleteServices method deleteInteractionUse.

public void deleteInteractionUse(InteractionUse interactionUse) {
    if (interactionUse == null) {
        return;
    }
    Session session = SessionManager.INSTANCE.getSession(interactionUse);
    ModelAccessor modelAccessor = session.getModelAccessor();
    delete(interactionUse.getStartingEnd(), session, modelAccessor);
    delete(interactionUse.getFinishingEnd(), session, modelAccessor);
    delete(interactionUse, session, modelAccessor);
}
Also used : ModelAccessor(org.eclipse.sirius.ecore.extender.business.api.accessor.ModelAccessor) Session(org.eclipse.sirius.business.api.session.Session)

Example 13 with ModelAccessor

use of org.eclipse.sirius.ecore.extender.business.api.accessor.ModelAccessor in project InformationSystem by ObeoNetwork.

the class TaskUtils method deleteTask.

/**
 * Deletes a task and all its attached TaskReference instances
 *
 * @param task
 *            Task to be deleted
 */
public void deleteTask(Task task) {
    Session session = SessionManager.INSTANCE.getSession(task);
    ModelAccessor modelAccessor = session.getModelAccessor();
    // Deletion of all TaskReference instances associated with the task
    deleteTaskReferences(task, session, modelAccessor);
    DeleteUtils.delete(task, session, modelAccessor);
}
Also used : ModelAccessor(org.eclipse.sirius.ecore.extender.business.api.accessor.ModelAccessor) Session(org.eclipse.sirius.business.api.session.Session)

Example 14 with ModelAccessor

use of org.eclipse.sirius.ecore.extender.business.api.accessor.ModelAccessor in project InformationSystem by ObeoNetwork.

the class DeleteUtils method delete.

public static void delete(EObject object, Session session, ModelAccessor modelAccessor) {
    Session vpSession = session;
    ModelAccessor vpModelAccessor = modelAccessor;
    if (vpSession == null) {
        vpSession = SessionManager.INSTANCE.getSession(object);
    }
    if (vpModelAccessor == null) {
        vpModelAccessor = vpSession.getModelAccessor();
    }
    vpModelAccessor.eDelete(object, vpSession.getSemanticCrossReferencer(), new EReferencePredicate() {

        public boolean apply(EReference reference) {
            return DSemanticDecorator.class.isAssignableFrom(reference.getContainerClass());
        }
    });
}
Also used : DSemanticDecorator(org.eclipse.sirius.viewpoint.DSemanticDecorator) ModelAccessor(org.eclipse.sirius.ecore.extender.business.api.accessor.ModelAccessor) EReferencePredicate(org.eclipse.sirius.ext.emf.EReferencePredicate) EReference(org.eclipse.emf.ecore.EReference) Session(org.eclipse.sirius.business.api.session.Session)

Aggregations

Session (org.eclipse.sirius.business.api.session.Session)14 ModelAccessor (org.eclipse.sirius.ecore.extender.business.api.accessor.ModelAccessor)14 EReference (org.eclipse.emf.ecore.EReference)5 EReferencePredicate (org.eclipse.sirius.ext.emf.EReferencePredicate)5 DSemanticDecorator (org.eclipse.sirius.viewpoint.DSemanticDecorator)5 Collection (java.util.Collection)2 ECrossReferenceAdapter (org.eclipse.emf.ecore.util.ECrossReferenceAdapter)2 RecordingCommand (org.eclipse.emf.transaction.RecordingCommand)2 TransactionalEditingDomain (org.eclipse.emf.transaction.TransactionalEditingDomain)2 IEditingSession (org.eclipse.sirius.ui.business.api.session.IEditingSession)2 DRepresentationDescriptor (org.eclipse.sirius.viewpoint.DRepresentationDescriptor)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 EObject (org.eclipse.emf.ecore.EObject)1 CompoundEnd (org.obeonetwork.dsl.interaction.CompoundEnd)1 End (org.obeonetwork.dsl.interaction.End)1 Interaction (org.obeonetwork.dsl.interaction.Interaction)1 StateMachine (org.obeonetwork.dsl.statemachine.StateMachine)1 AbstractTask (org.obeonetwork.graal.AbstractTask)1 Task (org.obeonetwork.graal.Task)1