Issue #229 make sure default cache directory exists when opening the preference page.
Change-Id: I25ba5cba8c74b764e39c1a42c78ee14f861ba283 Former-commit-id: 0a4001bf8c3ef6272cd52ad8706e104235de4417
This commit is contained in:
parent
73f6e9e322
commit
34f45958ce
1 changed files with 11 additions and 0 deletions
|
@ -20,6 +20,8 @@
|
|||
|
||||
package com.raytheon.uf.viz.thinclient.cave.preferences;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.eclipse.jface.preference.BooleanFieldEditor;
|
||||
import org.eclipse.jface.preference.DirectoryFieldEditor;
|
||||
import org.eclipse.jface.preference.FieldEditorPreferencePage;
|
||||
|
@ -71,6 +73,15 @@ public class ThinClientCachePreferences extends FieldEditorPreferencePage {
|
|||
@Override
|
||||
protected void createFieldEditors() {
|
||||
// Add cache directory preference
|
||||
if (getPreferenceStore().isDefault(
|
||||
ThinClientPreferenceConstants.P_CACHE_DIR)) {
|
||||
// If they are using the default directory we will create it before
|
||||
// making a field editor because the field editor is considered
|
||||
// invalid if it is refering to a directory which does not exist and
|
||||
// the default should be considered valid.
|
||||
new File(getPreferenceStore().getString(
|
||||
ThinClientPreferenceConstants.P_CACHE_DIR)).mkdirs();
|
||||
}
|
||||
addField(new DirectoryFieldEditor(
|
||||
ThinClientPreferenceConstants.P_CACHE_DIR, "&Cache Directory",
|
||||
getFieldEditorParent()));
|
||||
|
|
Loading…
Add table
Reference in a new issue