Interface ConditionalDeleteService

  • All Superinterfaces:
    DeleteService, ViewModelService
    All Known Implementing Classes:
    EMFDeleteServiceImpl

    public interface ConditionalDeleteService
    extends DeleteService
    An extension of the DeleteService protocol that supports conditional deletion, respecting a model's edit providers when they provide unexecutable commands to veto deletion. Implementations of this interface should be registered as OSGi services providing DeleteService because the framework looks for that service interface but will test whether the implementation also provides this extension. Whether the extension interface is also declared to OSGi is left to the provider's discretion.
    Since:
    1.23
    • Method Detail

      • canDelete

        default boolean canDelete​(java.lang.Object object)
        Queries whether an object can be deleted. By convention a null value cannot be deleted.
        Parameters:
        object - an object to be deleted
        Returns:
        false if the object cannot be deleted or is null; true, otherwise
      • canDelete

        boolean canDelete​(java.lang.Iterable<?> objects)
        Queries whether all of the given objects can be deleted.
        Parameters:
        objects - a number of objects to be deleted
        Returns:
        false if any of the objects cannot be deleted; true otherwise, including the case of no objects
      • canRemove

        default boolean canRemove​(java.lang.Object owner,
                                  java.lang.Object reference,
                                  java.lang.Object object)
        Query whether an object in some reference feature of an owner of that feature can be removed from the reference feature. In the case of containment references, this amounts to deletion of the object.
        Parameters:
        owner - the owner of a reference to some object
        reference - a reference feature of the owner
        object - an object referenced by the owner from which it is to be removed
        Returns:
        whether the object may be removed
        Since:
        1.24
      • canRemove

        default boolean canRemove​(java.lang.Object owner,
                                  java.lang.Object reference,
                                  java.lang.Iterable<?> objects)
        Query whether all of the given objects in some reference feature of an owner of that feature can be removed from the reference feature. In the case of containment references, this amounts to deletion of the object.
        Parameters:
        owner - the owner of a reference to some object
        reference - a reference feature of the owner
        objects - a group of objects referenced by the owner from which they are to be removed
        Returns:
        whether the objects may be removed
        Since:
        1.24
      • getDeleteService

        static ConditionalDeleteService getDeleteService​(EMFFormsViewContext context)
        Obtain a conditional delete service for a given context, if necessary adapting its service implementation.
        Parameters:
        context - a form context
        Returns:
        the delete service, or an adapter if the actual delete service implementation does not provide the ConditionalDeleteService protocol or if there isn't a delete service at all (in which case nothing can be deleted)
        See Also:
        adapt(DeleteService)
      • adapt

        static ConditionalDeleteService adapt​(DeleteService service)
        Obtain a view of a given service as conditional delete service, if necessary adapting a service implementation that does not provide the ConditionalDeleteService protocol with a default deletion condition. In that case, an object is assumed to be deletable if it is not null and it is an EObject that has some container from which it can be removed (root elements not logically being deletable).
        Parameters:
        service - a delete service
        Returns:
        the delete service, or an adapter if the actual delete service implementation does not provide the ConditionalDeleteService protocol or if the original service is null