Reputation: 1
I implemented a custom PropertySheet as described in here.
So I have a main view, which implements the selectionprovider and it works to show the properties in my custom PropertySheet view.
My problem is now, that I want to edit the some properties of the selection in the property view and prevent changing the selection in the main view, if there are unsaved changes in the property view.
What is the best way to solve that problem?
If I implement the ISaveablePart in my custom property view, I can mark it as dirty. How can I prevent to change the selection, if my property view is dirty?
Thanks in advance!
Upvotes: 0
Views: 90
Reputation: 13858
As a view is a non-modal (e.g. non-blocking) UI component, there is no real way to prevent selection changes outside the view. For this reason, the expected way of Properties view to work is to save as soon as possible.
The default, TreeViewer based implementation of EMF models uses a CellEditor to change its values; when the value in a CellEditor changes, the changed values are written back to the original model automatically to avoid the data loss scenarios you have mentioned.
In other words, you have to rely on your data source (e.g. the editor that provides the selection) to store the permanent changes, and the changes can be serialized through that source (editor).
Upvotes: 1