FieldEditor does not write default-value [message #462974] |
Mon, 24 October 2005 12:49 |
arne anka Messages: 133 Registered: July 2009 |
Senior Member |
|
|
in a prefgerences-page i have two FieldEditors. to ease the use i display
default-values, so the suer has not to type in any values if he's happy
with default ones.
but the default values are not stored to the prefs -- thus any attempt to
use those values causes an error.
if i fill in arbitrary values, different from the default, it's stored --
but thus the ability to present default values seems meaningless to me.
what do i wrong, how do i force the FieldEditors to save even the
unchanged default?
public class LocalDBPreferencePage extends FieldEditorPreferencePage
implements IWorkbenchPreferencePage {
IPreferenceStore ips;
public LocalDBPreferencePage() {
super(GRID);
setPreferenceStore(ips=MyPlugin.getDefault().getPreferenceSt ore());
setDescription("Preference page for the local Derby-DB");
ips.setDefault("derbydbpath",
Platform.getLocation().toOSString());
ips.setDefault("derbydbname", "NJVDB");
}
public void createFieldEditors() {
Composite fep=getFieldEditorParent();
DirectoryFieldEditor dfe=new
DirectoryFieldEditor(PreferenceConstants.P_PATH, "&Speicherort der DB:",
fep);
dfe.setPreferenceName("derbydbpath");
addField(dfe);
StringFieldEditor sfeDBN=new
StringFieldEditor(PreferenceConstants.P_STRING, "Datenbankname:", fep);
sfeDBN.setPreferenceName("derbydbname");
addField(sfeDBN);
}
public void init(IWorkbench workbench) {}
}
|
|
|
|
Re: FieldEditor does not write default-value [message #462979 is a reply to message #462974] |
Mon, 24 October 2005 16:07 |
Haris Peco Messages: 1072 Registered: July 2009 |
Senior Member |
|
|
arne,
set default values in preference initializer
see extension point org.eclipse.core.runtime.preferences
and class
org.eclipse.core.runtime.preferences.AbstractPreferencesInit ializer
Peco
arne anka wrote:
> in a prefgerences-page i have two FieldEditors. to ease the use i display
> default-values, so the suer has not to type in any values if he's happy
> with default ones.
> but the default values are not stored to the prefs -- thus any attempt to
> use those values causes an error.
> if i fill in arbitrary values, different from the default, it's stored --
> but thus the ability to present default values seems meaningless to me.
> what do i wrong, how do i force the FieldEditors to save even the
> unchanged default?
>
>
> public class LocalDBPreferencePage extends FieldEditorPreferencePage
> implements IWorkbenchPreferencePage {
>
> IPreferenceStore ips;
>
> public LocalDBPreferencePage() {
> super(GRID);
> setPreferenceStore(ips=MyPlugin.getDefault().getPreferenceSt ore());
> setDescription("Preference page for the local Derby-DB");
> ips.setDefault("derbydbpath",
> Platform.getLocation().toOSString());
> ips.setDefault("derbydbname", "NJVDB");
> }
>
> public void createFieldEditors() {
> Composite fep=getFieldEditorParent();
>
> DirectoryFieldEditor dfe=new
> DirectoryFieldEditor(PreferenceConstants.P_PATH, "&Speicherort der DB:",
> fep);
> dfe.setPreferenceName("derbydbpath");
> addField(dfe);
>
> StringFieldEditor sfeDBN=new
> StringFieldEditor(PreferenceConstants.P_STRING, "Datenbankname:", fep);
> sfeDBN.setPreferenceName("derbydbname");
> addField(sfeDBN);
> }
>
> public void init(IWorkbench workbench) {}
>
> }
|
|
|
|
Powered by
FUDForum. Page generated in 0.03357 seconds