Package org.eclipse.emf.ecp.edit.spi
Interface ConditionalDeleteService
-
- All Superinterfaces:
DeleteService
,ViewModelService
- All Known Implementing Classes:
EMFDeleteServiceImpl
public interface ConditionalDeleteService extends DeleteService
An extension of theDeleteService
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 providingDeleteService
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 Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static ConditionalDeleteService
adapt(DeleteService service)
Obtain a view of a givenservice
as conditional delete service, if necessary adapting a service implementation that does not provide theConditionalDeleteService
protocol with a default deletion condition.boolean
canDelete(java.lang.Iterable<?> objects)
Queries whether all of the givenobjects
can be deleted.default boolean
canDelete(java.lang.Object object)
Queries whether anobject
can be deleted.default boolean
canRemove(java.lang.Object owner, java.lang.Object reference, java.lang.Iterable<?> objects)
Query whether all of the givenobjects
in somereference
feature of anowner
of that feature can be removed from thereference
feature.default boolean
canRemove(java.lang.Object owner, java.lang.Object reference, java.lang.Object object)
Query whether anobject
in somereference
feature of anowner
of that feature can be removed from thereference
feature.static ConditionalDeleteService
getDeleteService(EMFFormsViewContext context)
Obtain a conditional delete service for a givencontext
, if necessary adapting its service implementation.-
Methods inherited from interface org.eclipse.emf.ecp.edit.spi.DeleteService
deleteElement, deleteElements
-
Methods inherited from interface org.eclipse.emf.ecp.view.spi.context.ViewModelService
dispose, getPriority, instantiate
-
-
-
-
Method Detail
-
canDelete
default boolean canDelete(java.lang.Object object)
Queries whether anobject
can be deleted. By convention anull
value cannot be deleted.- Parameters:
object
- an object to be deleted- Returns:
false
if theobject
cannot be deleted or isnull
;true
, otherwise
-
canDelete
boolean canDelete(java.lang.Iterable<?> objects)
Queries whether all of the givenobjects
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 noobjects
-
canRemove
default boolean canRemove(java.lang.Object owner, java.lang.Object reference, java.lang.Object object)
Query whether anobject
in somereference
feature of anowner
of that feature can be removed from thereference
feature. In the case of containment references, this amounts to deletion of theobject
.- Parameters:
owner
- the owner of areference
to someobject
reference
- a reference feature of theowner
object
- an object referenced by theowner
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 givenobjects
in somereference
feature of anowner
of that feature can be removed from thereference
feature. In the case of containment references, this amounts to deletion of theobject
.- Parameters:
owner
- the owner of areference
to someobject
reference
- a reference feature of theowner
objects
- a group of objects referenced by theowner
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 givencontext
, 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 givenservice
as conditional delete service, if necessary adapting a service implementation that does not provide theConditionalDeleteService
protocol with a default deletion condition. In that case, an object is assumed to be deletable if it is notnull
and it is anEObject
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 originalservice
isnull
-
-