Implement choosing of directory.
authorDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Tue, 22 Dec 2009 17:08:42 +0000 (18:08 +0100)
committerDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Tue, 22 Dec 2009 17:08:42 +0000 (18:08 +0100)
src/de/todesbaum/jsite/gui/PreferencesPage.java
src/de/todesbaum/jsite/i18n/jSite.properties

index a5fa43a..513c23f 100644 (file)
@@ -29,6 +29,7 @@ import javax.swing.AbstractAction;
 import javax.swing.Action;
 import javax.swing.ButtonGroup;
 import javax.swing.JButton;
+import javax.swing.JFileChooser;
 import javax.swing.JLabel;
 import javax.swing.JPanel;
 import javax.swing.JRadioButton;
@@ -242,7 +243,14 @@ public class PreferencesPage extends TWizardPage {
         * Lets the user choose a new temp directory.
         */
        private void chooseTempDirectory() {
-               /* TODO */
+               JFileChooser fileChooser = new JFileChooser(tempDirectory);
+               fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+               int returnValue = fileChooser.showDialog(wizard, I18n.getMessage("jsite.preferences.temp-directory.choose.approve"));
+               if (returnValue == JFileChooser.CANCEL_OPTION) {
+                       return;
+               }
+               tempDirectory = fileChooser.getSelectedFile().getPath();
+               tempDirectoryTextField.setText(tempDirectory);
        }
 
 }
index 0c0932d..c19d043 100644 (file)
@@ -70,6 +70,7 @@ jsite.preferences.temp-directory=Temporary Directory
 jsite.preferences.temp-directory.default=Default
 jsite.preferences.temp-directory.custom=Custom
 jsite.preferences.temp-directory.choose=Choose
+jsite.preferences.temp-directory.choose.approve=Choose
 
 jsite.insert.heading=Project insert
 jsite.insert.description=Please wait while the project is being inserted.