Jskad's "About" dialog box now lists the time of compilation. Ant

creates source/org/thdl/util/ThdlVersion.java when you execute the
jskad-compile target.
This commit is contained in:
dchandler 2002-11-16 19:18:44 +00:00
parent 9f232fc5e2
commit 5ffb813019
3 changed files with 61 additions and 2 deletions

View file

@ -175,6 +175,7 @@
<target name="jskad-compile" depends="init"
description="compiles Jskad" >
<antcall target="create-timestamp-source-code"/>
<antcall target="our-internal-javac-task">
<param name="mybin" value="${jskadbin}"/>
<param name="my.included.source.file"
@ -582,6 +583,7 @@
<delete file="${dist}/Savant.jnlp"/>
<delete file="${dist}/QuillDriver.jnlp"/>
<delete file="${dist}/Jskad.jnlp"/>
<delete file="${source}/org/thdl/util/ThdlVersion.java"/>
</target>
@ -1105,9 +1107,45 @@
<antcall target="compile-QT4J-classes-accessed-by-reflection"/>
</target>
<target name="create-timestamp-source-code"
description="writes out a Java source file that contains the time of compilation">
<tstamp>
<format property="compilation.time" pattern="d-MMMM-yyyy hh:mm aa"
offset="0" unit="hour"/>
</tstamp>
<delete file="${source}/org/thdl/util/ThdlVersion.java"/>
<echo file="${source}/org/thdl/util/ThdlVersion.java"
append="false"><![CDATA[// This file was automatically generated by the Ant build process.
// Your edits will be lost when you run Ant again.
package org.thdl.util;
/** Contains methods for determining the time at which this class
was compiled. This is useful for filling out bug reports about
nightly builds. This class is not instantiable. */
public class ThdlVersion {
/** Do not instantiate this class. */
private ThdlVersion() { }
/** Returns a string indicating the time this program was compiled. */
public static String getTimeOfCompilation() {
return "]]></echo>
<echo file="${source}/org/thdl/util/ThdlVersion.java"
append="true">${compilation.time}</echo>
<echo file="${source}/org/thdl/util/ThdlVersion.java"
append="true"><![CDATA[";
}
}
]]></echo>
</target>
</project>
<!-- My TO-DO list: -->
<!-- DLC FIXME: If we use bootclasspath and -target 1.1, do we need a
separate tt-handheld and tt-standalone? -->
<!-- DLC FIXME: Allow for signing the vanilla JARs. -->

View file

@ -36,6 +36,7 @@ import java.util.Vector;
import org.thdl.tib.text.*;
import org.thdl.util.ThdlDebug;
import org.thdl.util.ThdlOptions;
import org.thdl.util.ThdlVersion;
import org.thdl.util.StatusBar;
import org.thdl.util.ThdlActionListener;
import org.thdl.util.RTFPane;
@ -310,13 +311,17 @@ public class Jskad extends JPanel implements DocumentListener {
"Copyright 2001-2002 Tibetan and Himalayan Digital Library\n"+
"Programmed by Edward Garrett\n\n"+
"This software is protected by the terms of the\n"+
"THDL Open Community License, Version 1.0.\n"+
"THDL Open Community License, Version 1.0.\n"+ /* FIXME HARD-CODED VERSION NUMBER */
"It uses Tibetan Computer Company (http://www.tibet.dk/tcc/)\n"+
"fonts created by Tony Duff and made available by the\n"+
"Trace Foundation (http://trace.org/).\n\n"+
"For more information, or to download the source code\n"+
"for Jskad, see our web site:\n"+
" http://www.thdl.org/",
" http://www.thdl.org/\n" +
"\n" +
"When submitting bug reports, please indicate that the\n" +
"time of compilation is "
+ ThdlVersion.getTimeOfCompilation() + "\n",
"About Jskad 1.0", /* FIXME HARD-CODED VERSION NUMBER */
JOptionPane.PLAIN_MESSAGE);
}
@ -481,6 +486,8 @@ public class Jskad extends JPanel implements DocumentListener {
JOptionPane pane = new JOptionPane(preferencesPanel);
JDialog dialog = pane.createDialog(this, "Preferences");
// This returns only when the user has closed the dialog:
dialog.show();
int size;
@ -561,10 +568,13 @@ public class Jskad extends JPanel implements DocumentListener {
newFrame.setVisible(true);
}
catch (FileNotFoundException fnfe) {
ThdlDebug.noteIffyCode();
}
catch (IOException ioe) {
ThdlDebug.noteIffyCode();
}
catch (BadLocationException ble) {
ThdlDebug.noteIffyCode();
}
}
else {
@ -598,10 +608,13 @@ public class Jskad extends JPanel implements DocumentListener {
}
}
catch (FileNotFoundException fnfe) {
ThdlDebug.noteIffyCode();
}
catch (IOException ioe) {
ThdlDebug.noteIffyCode();
}
catch (BadLocationException ble) {
ThdlDebug.noteIffyCode();
}
}
setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
@ -792,10 +805,12 @@ public class Jskad extends JPanel implements DocumentListener {
t_doc.writeRTFOutputStream(new FileOutputStream(new File(rtf_fileName)));
}
catch (IOException ioe) {
ThdlDebug.noteIffyCode();
System.out.println("problem reading or writing file");
}
}
catch (FileNotFoundException fnfe) {
ThdlDebug.noteIffyCode();
System.out.println("problem reading file");
}
}
@ -965,6 +980,7 @@ public class Jskad extends JPanel implements DocumentListener {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
catch (Exception e) {
ThdlDebug.noteIffyCode();
}
JFrame f = new JFrame("Jskad");
@ -976,8 +992,10 @@ public class Jskad extends JPanel implements DocumentListener {
f.getContentPane().add(new Jskad(f));
f.setVisible(true);
} catch (ThdlLazyException e) {
// FIXME: tell the users how to submit bug reports.
System.err.println("Jskad has a BUG:");
e.getRealException().printStackTrace(System.err);
System.exit(1);
}
}
}

View file

@ -1 +1,4 @@
*~
.#*
ThdlVersion.java