I would like to do some modifications on references of an object before removing it from my model. I tried to create a new remove command where, for example, I'd like to avoid removing the object. I was surprised that the object still there but not the references it has for other objects. I think they are removed somewhere else.

How could I "properly" avoid that?

Here is an other question: if some modifications are done some where else than in command, is this still coherent with Command Design Pattern and its purposes? this behaviour is surprising me but maybe I'm wrong?!?

Probably you should have a look at how the DeleteCommand behaves and how
DeleteAction uses it. By default it will remove all references to the
deleted object and will use commands to do all that cleanup. You could
configure DeleteAction not to do that or to do something a little different.

Fateh SAADA KHELKHAL wrote:
> Hello.
>
> Here is my situation:
>
> I would like to do some modifications on references of an object before removing it from my model. I tried to create a new remove command where, for example, I'd like to avoid removing the object. I was surprised that the object still there but not the references it has for other objects. I think they are removed somewhere else.
>
> How could I "properly" avoid that?
>
> Here is an other question: if some modifications are done some where else than in command, is this still coherent with Command Design Pattern and its purposes? this behaviour is surprising me but maybe I'm wrong?!?
>
> Could anyone help me please?
>
> Thanks.
>

I think I've found something that may help me: the <b>protected boolean removeAllReferencesOnDelete()</b> method in the concerned <b>ActionBarContributor</b> class. Retruning false avoid Delete Action to remove references.