Minor bug fix. Now allows a config file to be created if it does not exist.
committer: Jonathan Bernard <jdbernard@gmail.com>
This commit is contained in:
parent
cb419c658f
commit
ed5bdce87c
@ -4,6 +4,7 @@
|
||||
|
||||
package jdbernard.timestamper;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
@ -51,19 +52,16 @@ implements Application.ExitListener {
|
||||
|
||||
try {
|
||||
config = new Properties();
|
||||
FileInputStream cfgIn = new FileInputStream("timestamper.config");
|
||||
File cfgFile = new File("timestamper.config");
|
||||
if (!cfgFile.exists()) cfgFile.createNewFile();
|
||||
FileInputStream cfgIn = new FileInputStream(cfgFile);
|
||||
config.load(cfgIn);
|
||||
cfgIn.close();
|
||||
} catch (IOException ioe) {
|
||||
log.warning("Could not load configuration options.");
|
||||
}
|
||||
|
||||
try {
|
||||
activeTimeline = Timeline.readFromFile(
|
||||
config.getProperty("lastUsedTimelineFilename"));
|
||||
} catch (IOException ioe) {
|
||||
log.warning("Could not load the last used timeline file.");
|
||||
}
|
||||
loadTimeline(config.getProperty("lastUsedTimelineFilename"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -73,11 +73,13 @@ public class TimeStamperView extends FrameView implements MouseMotionListener {
|
||||
Timeline t = ((TimeStamperApp) getApplication()).getActiveTimeline();
|
||||
Timeline.TimelineMarker lastMarker = t.getLastMarker(new Date());
|
||||
|
||||
if (lastMarker != null) {
|
||||
mostRecentTask = lastMarker.getTimestamp();
|
||||
startTimeLabel.setText(Timeline.shortFormat.format(lastMarker.getTimestamp()));
|
||||
|
||||
taskTextField.setText(lastMarker.getMark());
|
||||
}
|
||||
}
|
||||
|
||||
/** This method is called from within the constructor to
|
||||
* initialize the form.
|
||||
@ -401,9 +403,11 @@ private void optionsButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIR
|
||||
Timeline t = ((TimeStamperApp) getApplication()).getActiveTimeline();
|
||||
Timeline.TimelineMarker lastMarker = t.getLastMarker(new Date());
|
||||
|
||||
if (lastMarker != null) {
|
||||
mostRecentTask = lastMarker.getTimestamp();
|
||||
startTimeLabel.setText(Timeline.shortFormat.format(lastMarker.getTimestamp()));
|
||||
|
||||
taskTextField.setText(lastMarker.getMark());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +0,0 @@
|
||||
#
|
||||
#Fri Aug 29 18:18:08 CDT 2008
|
||||
lastUsedTimelineFilename=default-timeline.txt
|
||||
lastUsedTimelineFile=default-timeline.txt
|
Loading…
x
Reference in New Issue
Block a user