Search in sources :

Example 1 with EReferencePredicate

use of org.eclipse.sirius.ext.emf.EReferencePredicate 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 (vpSession != null) {
        if (vpModelAccessor == null) {
            vpModelAccessor = vpSession.getModelAccessor();
        }
        if (vpModelAccessor != null) {
            vpModelAccessor.eDelete(object, vpSession.getSemanticCrossReferencer(), new EReferencePredicate() {

                public boolean apply(EReference reference) {
                    return DSemanticDecorator.class.isAssignableFrom(reference.getContainerClass());
                }
            });
        }
    }
    // If this code is executed it means that either the session or the model accessor is null (probably the session)
    // We use EcoreUtil.delete() then
    EcoreUtil.delete(object, true);
}
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 2 with EReferencePredicate

use of org.eclipse.sirius.ext.emf.EReferencePredicate in project InformationSystem by ObeoNetwork.

the class DeleteServices 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)

Example 3 with EReferencePredicate

use of org.eclipse.sirius.ext.emf.EReferencePredicate in project InformationSystem by ObeoNetwork.

the class DocumentationLinkImpl method delete.

/**
 * {@inheritDoc}
 * @see org.obeonetwork.tools.doc.core.DocumentationLink#delete()
 */
public void delete() {
    Session session = SessionManager.INSTANCE.getSession(annotation);
    if (session != null) {
        ModelAccessor vpModelAccessor = session.getModelAccessor();
        vpModelAccessor.eDelete(annotation, session.getSemanticCrossReferencer(), new EReferencePredicate() {

            public boolean apply(EReference reference) {
                return DSemanticDecorator.class.isAssignableFrom(reference.getContainerClass());
            }
        });
    } else {
        EcoreUtil.delete(annotation);
    }
    // $NON-NLS-1$
    name = "";
    // $NON-NLS-1$
    value = "";
    annotation = null;
}
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 4 with EReferencePredicate

use of org.eclipse.sirius.ext.emf.EReferencePredicate 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 5 with EReferencePredicate

use of org.eclipse.sirius.ext.emf.EReferencePredicate 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

EReference (org.eclipse.emf.ecore.EReference)5 Session (org.eclipse.sirius.business.api.session.Session)5 ModelAccessor (org.eclipse.sirius.ecore.extender.business.api.accessor.ModelAccessor)5 EReferencePredicate (org.eclipse.sirius.ext.emf.EReferencePredicate)5 DSemanticDecorator (org.eclipse.sirius.viewpoint.DSemanticDecorator)5