Checking for changes before selecting a different node

"Atrament" <[email protected]>
Newsgroups gmane.comp.java.netbeans.modules.openide.devel
Message-ID <[email protected]>
Hi all,
I have been following the basic CRUD tutorial on https://platform.netbeans.org/tutorials/nbm-crud.html
and I got stuck with one thing. 

When a user changes something in the Editor they put MySavable instance into an InstanceContent to enable Save action :

Code:

if (getLookup().lookup(MySavable.class) == null) {
  instanceContent.add(new MySavable());
}



This works ok. I can click Save button.
But when a user makes some changes and then selects a different node in explorer, the changes are not saved and I would like to be able to ask him to save the changes before he goes to the different node. I assumed that if I do something like this in resultChanged():

Code:

if (getLookup().lookup(MySavable.class) != null) {
  //here I inform user about changes and ask him to save
}



I would know whether something has been changed or not and I could react to that. The problem is that it is always false. I guess this is not the correct way of doing it. Can anybody explain please how to correctly check for changes before selecting a different node in explorer? 


Thanks
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.