This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
|Summary:||Form text changes can be reverted with automatic internationalization without knowing until repopened|
|Product:||guibuilder||Reporter:||_ wadechandler <wadechandler>|
|Issue Type:||DEFECT||Exception Reporter:|
Description _ wadechandler 2007-12-04 00:13:52 UTC
While working on a UI form with automatic internalization turned on, changes to text and resources can be inadvertently rolled back to all previously values if the form has not been saved yet and the user opens the bundle by hand. This happens when the user opens the Bundle.properties file and closes it before the form module has been saved if they choose to discard changes. The Bundle will be marked as changed and not yet saved. When the user opens it and close it it will tell them changes have been made and ask if they want to save them or discard them. Discarding them discards changes the form module made though the form retains the values it had previously entered which changed the bundle. Then, the user can save the form and close it and think the changes took. This will not be the case however as old values will reside within the Bundle where the changes were discarded. It seems a listener needs to be applied to the bundle file and a temporary bundle be loaded into memory for the pieces the form is concerned about or linked. Then when the real bundle changes and is saved the temporary bundle can be updated with those values. Then when the form is saved the bundle can be synchronized. The simple workaround is to not open the bundle while editing the UI. The main problem however is there is no clean way to alert the user what they are doing. I suppose a quick solution, if possible, would be to have a listener on the bundle and when the file is opened in the editor a dialog be presented to the user to make sure they understand the implications. It could ask them if they want to go ahead and close the file without discarding or saving...if this is possible to do from the editor API perspective. It might require changes to the bundle/properties bits or the editor API itself.
Comment 1 Tomas Pavek 2007-12-04 01:54:13 UTC
I understand the user problem, but am not sure if the suggested solutions are better - once the user discards the properties file changes, the result is likely not what they want. A warning displayed when opening the properties file is a bit awkward. And the same problem may happen if the properties file was already opened. Maybe we should just save the properties file after every change done in a form (if it is not a performance problem). There is already a mechanism implemented that removes the changes from the properties file if the form is closed - discarded.
Comment 2 _ wadechandler 2007-12-04 15:55:52 UTC
The last solution Tomas posted would work well. I had thought about that one before, and didn't write it because I figured the changes would not be good to save as the .java and .form are not saved until the user actually saves the changes. But, if there is a mechanism for reverting them if the form is not saved, then that works just as well.