Editor doesn't recognizes model changes. [message #13072] |
Wed, 09 August 2006 10:38  |
Eclipse User |
|
|
|
Hi,
First of all my apologies if I'm posting in the wrong section.
I'm using an advanced property section to edit a feature of a diagram part. This feature contains a list of strings.
In my property section I'm using an AddCommand,SetCommand and RemoveCommand from EMF.Edit to manipulate the elements in this list.
This works, but the editor doesn't recognize the changes (the save action is not enabled).
I added an CommandStackListener to examine if the command stack changed when executing the command, and it changed.
But when I checked the isDirty(), of xxxxDiagramEditor, it was false.
I use the following code to execute the AddCommand:
EditingDomain editingDomain = ((BpmnDiagramEditor) getPart()).getEditingDomain();
Command cmd = AddCommand.create(editingDomain, eObject, BpmnPackage.eINSTANCE.getGraphicalElement_Categories(), category);
editingDomain.getCommandStack().execute(cmd);
I have other property sections where I change string and enumeration properties and this problem doesn't occur.
Thank you.
Joao
|
|
|
|
Re: Editor doesn't recognizes model changes. [message #23645 is a reply to message #19637] |
Fri, 18 August 2006 13:46  |
Eclipse User |
|
|
|
Alex Shatalin wrote:
> Hello Joao,
>
> Generated XXXDocumentProvider is responsible for marking editor as
> changed. Hope, you'll be able to found the problem by debuggin it.
>
> -----------------
> Alex Shatalin
Hello Alex,
Thank you for your tip. It really helped. The problem was in the generated CustomModificationListener. It was only listening to SET notifications.
Combining multiple filters I managed to solve my problem.
Thank you one more time.
My best regards,
Joao
,----[ CustomModificationListener ]
| ...
| NotificationFilter setFilter = NotificationFilter.createEventTypeFilter(Notification.SET);
| NotificationFilter addFilter = NotificationFilter.createEventTypeFilter(Notification.ADD);
| NotificationFilter addManyFilter = NotificationFilter.createEventTypeFilter(Notification.ADD_MA NY);
| NotificationFilter removeFilter = NotificationFilter.createEventTypeFilter(Notification.REMOVE );
| NotificationFilter removeManyFilter = NotificationFilter.createEventTypeFilter(Notification.REMOVE _MANY);
| NotificationFilter diagramResourceModifiedFilter = setFilter.or(addFilter.or(addManyFilter.or(removeFilter.or(r emoveManyFilter))));
| ...
`----
|
|
|
Powered by
FUDForum. Page generated in 0.24882 seconds