blob: c55581d974a25e6d34850cdc996f404a21f6d216 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
package rba.tool.editor.ui.recordandplay;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jface.preference.DirectoryFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.preferences.ScopedPreferenceStore;
public class RBASimulationRecordPage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
private DirectoryFieldEditor recordPathBrowser;
private IPreferenceStore preferenceStore;
private RBASimulationRecordSettingManager manager = RBASimulationRecordSettingManager.INSTANCE;
private static final String DESCRIPTION = "RBA Simulation Record Path"; //$NON-NLS-1$
public RBASimulationRecordPage() {
super(GRID);
}
@Override
protected void createFieldEditors() {
recordPathBrowser = new DirectoryFieldEditor("RbaToolRecordPath", "", getFieldEditorParent());
addField(recordPathBrowser);
}
@Override
public boolean performOk() {
manager.saveRecordFilePath(recordPathBrowser.getStringValue());
return super.performOk();
}
@Override
public void init(IWorkbench workbench) {
setDescription(DESCRIPTION);
}
@Override
public IPreferenceStore getPreferenceStore() {
if (preferenceStore == null) {
preferenceStore = new ScopedPreferenceStore(InstanceScope.INSTANCE, manager.ID_PREFERENCE_NODE);
}
return preferenceStore;
}
}
|