Revision as of 02:27, 19 February 2010 by Tboudreau (Talk | contribs)

How can I be notified when a file is modified and saved??

The DataObject.Registry in LoadersAPI gives you a set of modified DataObjects. You can also add a listener and be notified when the set of modified objects changes.

If you have a FileObject and want to listen for save events, you will need to get its DataObject by calling DataObject.find().

To listen on a single DataObject for save events, simply add a PropertyChangeListener and listen for changes in DataObject.PROP_MODIFIED.

Note that listening for something to be saved is not the same as listening for any changes in the file - you are really listening only for (directly or indirectly) user-initiated save events, as in the user pressing CTRL-S when the file is modified and opened in the editor. For notifications about any changes in a file, instead attach a FileChangeListener to the underlying FileObject.

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo