Added Javadoc files overview.html and several package.html files.
Added a "Quit" option to Savant's File menu. Factored out the Close option in doing so. Exceptions in many action listeners are now handled by org.thdl.util.ThdlActionListener or org.thdl.util.ThdlAbstractAction. Many exceptions that we used to just log now optionally cause aborts. This option is on by default for developers using 'ant savant-run'-style targets, but it is off for users. An erroneous CLASSPATH now causes a useful error message in almost all situations. Fixed some typos and bad links in Javadoc comments. Added a simple assertion facility, but the overhead is suffered even in release builds. Factored out the code that sets up log files like savant.log and jskad.log.
This commit is contained in:
parent
14adf0d607
commit
403f21c8db
47 changed files with 2439 additions and 1567 deletions
|
@ -23,30 +23,85 @@ import java.util.*;
|
|||
import javax.swing.*;
|
||||
import javax.swing.filechooser.*;
|
||||
|
||||
import org.thdl.util.ThdlDebug;
|
||||
|
||||
/**
|
||||
* The SavantFileView "sees through" a <code>*.savant</code> file and
|
||||
* returns the title associated with it. A <code>*.savant</code> file
|
||||
* is a properties file like the following:
|
||||
* <pre>
|
||||
* #Tue May 14 16:07:15 EDT 2002
|
||||
* TRANSCRIPT=MST4.xml
|
||||
* PROJECT=THDL
|
||||
* MEDIA=MST4.mpg
|
||||
* TITLE=MST Chapter 4 (video)
|
||||
* </pre>
|
||||
* @author Edward Garrett */
|
||||
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";
|
||||
|
||||
/** This loads <code>*.savant</code> files as properties files and
|
||||
returns an associated TITLE attribute. For any other type of
|
||||
file, or for a properties file that does not specify a
|
||||
non-empty-string TITLE attribute, this returns null. */
|
||||
public String getName(File f) {
|
||||
if (f.isDirectory())
|
||||
return null;
|
||||
|
||||
/* Unless a developer has chosen to do otherwise, examine only
|
||||
*.savant files. If you don't do this, you waste a lot of
|
||||
time, making any file chooser that uses this class
|
||||
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))
|
||||
return null;
|
||||
}
|
||||
Properties p = new Properties();
|
||||
try {
|
||||
p.load(new FileInputStream(f));
|
||||
return p.getProperty("TITLE");
|
||||
String ttl = p.getProperty("TITLE");
|
||||
if (ttl.equals(""))
|
||||
return null; /* We never want the user to see nothing
|
||||
at all, so let the L&F file view
|
||||
handle this. */
|
||||
else
|
||||
return ttl;
|
||||
} catch (FileNotFoundException fnfe) {
|
||||
fnfe.printStackTrace();
|
||||
ThdlDebug.noteIffyCode();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
ThdlDebug.noteIffyCode();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/** Returns null always, which lets the default look-and-feel's
|
||||
* FileView take over.
|
||||
* @return null */
|
||||
public String getDescription(File f) {
|
||||
return null;
|
||||
return null; // let the L&F FileView figure this out
|
||||
}
|
||||
|
||||
/** Returns null always, which lets the default look-and-feel's
|
||||
* FileView take over.
|
||||
* @return null */
|
||||
public Boolean isTraversable(File f) {
|
||||
return null; // let the L&F FileView figure this out
|
||||
}
|
||||
|
||||
/** Returns null always, which lets the default look-and-feel's
|
||||
* FileView take over.
|
||||
* @return null */
|
||||
public String getTypeDescription(File f) {
|
||||
return null;
|
||||
return null; // let the L&F FileView figure this out
|
||||
}
|
||||
|
||||
/* FIXME: why not same as above? */
|
||||
/*
|
||||
public Icon getIcon(File f) {
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue