Ticket #373 (closed task: fixed)

Opened 8 years ago

Last modified 8 years ago

Setup preferences correctly at program startup

Reported by: bdezonia Owned by: bdezonia
Priority: major Milestone: imagej-2.0-alpha5
Component: Core Version:
Severity: serious Keywords:
Cc: Blocked By:


IJ1 & IJ2 maintain similar settings. We will have code for keeping them in sync so that IJ1 commands, looking at IJ1 prefs, act accordingly when IJ2 prefs have been set.

But we need to initialize the IJ2 preferences at some time. We can take one of two approaches.

1) On startup check for IJ2 prefs and load them if existing. If not existing set the IJ2 preferences to defaults. Then set each pref to its corresponding IJ1 value if it exists in the IJ1 prefs. Save the pref keys to disk.

2) once only, set the IJ2 preferences to their default values and write them out. User's current settings are lost. After that always load the prefs from IJ2's store. From then on the prefs will always reflect the user's choices. Cleaner but may ruffle some users' feathers.

Change History

comment:1 Changed 8 years ago by curtis

  • Milestone changed from imagej-2.0-alpha1 to imagej-2.0-alpha2

comment:2 Changed 8 years ago by bdezonia

Taking approach number 2. I have stubbed out fake initialization in Main.java as a placeholder for actual code. To be implemented.

comment:3 Changed 8 years ago by bdezonia

  • Milestone changed from imagej-2.0-beta1 to imagej-2.0-alpha5

Removed stub from Main. Need to determine where to do this.

comment:4 Changed 8 years ago by bdezonia

The way to handle this is to change the Prefs.get() to take a default value. Then if the setting does not exist via disk load it will get initialized correctly and persisted from then on. Update calls as needed with defaults.

comment:5 Changed 8 years ago by bdezonia

Updated OptionsSynchronizer to pass defaults. This turns out not to be sufficient. The initialization of values in IJ2 has to happen somewhere other than the legacy layer. By the time the legacy layer latches on to them they have been initialized to 0, "", etc.

comment:6 Changed 8 years ago by bdezonia

  • Status changed from new to closed
  • Resolution set to fixed

Fixes by Curtis and Barry. Final commit in 0c803bfcb23b34910d2221e1e7192b5c0e6a2761.

Note: See TracTickets for help on using tickets.