Added a flexible mechanism for persistent boolean-, integer-, and
string-valued preferences built atop java.util.Properties. How it works: the jvm is asked first, and then the user's prefs file, if it exists, then the system-wide prefs file, and then the built-in preferences. Finally, for robustness, a default may be optionally hard-coded in the source. I made several things configurable, too: the default Tibetan keyboard the default font sizes and faces whether you want developer-only features enabled Savant's file extension (.savant) etc. The only known problems are the following: The default location for the user's preferences file is windows-specific, arbitrary, and not in the user documentation. Likewise for the location of the system-wide preferences file. You can change them using 'java -D', though. There is no "Save preferences" option yet, and closing the program does not save preferences either.
This commit is contained in:
parent
b914309dba
commit
08e4e2fc57
8 changed files with 591 additions and 101 deletions
|
@ -24,6 +24,7 @@ import javax.swing.*;
|
|||
import javax.swing.filechooser.*;
|
||||
|
||||
import org.thdl.util.ThdlDebug;
|
||||
import org.thdl.util.ThdlOptions;
|
||||
|
||||
/**
|
||||
* The SavantFileView "sees through" a <code>*.savant</code> file and
|
||||
|
@ -40,7 +41,10 @@ import org.thdl.util.ThdlDebug;
|
|||
public class SavantFileView extends FileView {
|
||||
/** When opening a file, this is the only extension Savant cares
|
||||
about. This is case-insensitive. */
|
||||
public final static String dotSavant = ".savant";
|
||||
public final static String getDotSavant() {
|
||||
return ThdlOptions.getStringOption("thdl.savant.file.extension",
|
||||
".savant");
|
||||
}
|
||||
|
||||
/** This loads <code>*.savant</code> files as properties files and
|
||||
returns an associated TITLE attribute. For any other type of
|
||||
|
@ -56,8 +60,8 @@ public class SavantFileView extends FileView {
|
|||
unresponsive. In addition, you'll cause the floppy drive
|
||||
to spin up every time you refresh or cd in the file
|
||||
chooser. */
|
||||
if (!Boolean.getBoolean("THDL_TREAT_ALL_FILES_AS_DOT_SAVANT_FILES_REGARDLESS_OF_EXTENSION")) { /* FIXME */
|
||||
if (!f.getName().toLowerCase().endsWith(dotSavant))
|
||||
if (!ThdlOptions.getBooleanOption("thdl.treat.all.files.as.dot.savant.files.regardless.of.extension")) { /* FIXME */
|
||||
if (!f.getName().toLowerCase().endsWith(getDotSavant()))
|
||||
return null;
|
||||
}
|
||||
Properties p = new Properties();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue