20
20
import io .sloeber .core .api .Defaults ;
21
21
import io .sloeber .core .api .LibraryManager ;
22
22
import io .sloeber .core .api .Other ;
23
+ import io .sloeber .core .api .Preferences ;
23
24
import io .sloeber .ui .Messages ;
24
25
import io .sloeber .ui .helpers .MyPreferences ;
25
26
@@ -42,14 +43,16 @@ public class PreferencePage extends FieldEditorPreferencePage implements IWorkbe
42
43
private static final String KEY_PRAGMA_ONCE_HEADERS = "Gui entry for add pragma once" ; //$NON-NLS-1$
43
44
private static final String KEY_PRIVATE_HARDWARE_PATHS = "Gui entry for private hardware paths" ; //$NON-NLS-1$
44
45
private static final String KEY_PRIVATE_LIBRARY_PATHS = "Gui entry for private library paths" ; //$NON-NLS-1$
46
+ private static final String KEY_TOOLCHAIN_SELECTION = "Gui entry for toolchain selection" ; //$NON-NLS-1$
45
47
46
- private PathEditor arduinoPrivateLibPath ;
47
- private PathEditor arduinoPrivateHardwarePath ;
48
- private ComboFieldEditor buildBeforeUploadOption ;
49
- private BooleanFieldEditor openSerialMonitorOpensSerialsOption ;
50
- private BooleanFieldEditor automaticallyImportLibrariesOption ;
51
- private BooleanFieldEditor PragmaOnceHeaderOption ;
52
- private BooleanFieldEditor cleanSerialMonitorAfterUpload ;
48
+ private PathEditor arduinoPrivateLibPathPathEditor ;
49
+ private PathEditor arduinoPrivateHardwarePathPathEditor ;
50
+ private ComboFieldEditor buildBeforeUploadOptionEditor ;
51
+ private BooleanFieldEditor openSerialMonitorOpensSerialsOptionEditor ;
52
+ private BooleanFieldEditor automaticallyImportLibrariesOptionEditor ;
53
+ private BooleanFieldEditor useArduinoToolchainSelectionEditor ;
54
+ private BooleanFieldEditor pragmaOnceHeaderOptionEditor ;
55
+ private BooleanFieldEditor cleanSerialMonitorAfterUploadEditor ;
53
56
54
57
public PreferencePage () {
55
58
super (org .eclipse .jface .preference .FieldEditorPreferencePage .GRID );
@@ -63,6 +66,8 @@ public PreferencePage() {
63
66
preferences .setDefault (KEY_PRAGMA_ONCE_HEADERS , true );
64
67
preferences .setDefault (KEY_PRIVATE_HARDWARE_PATHS , Defaults .getPrivateHardwarePath ());
65
68
preferences .setDefault (KEY_PRIVATE_LIBRARY_PATHS , Defaults .getPrivateLibraryPath ());
69
+ preferences .setDefault (KEY_TOOLCHAIN_SELECTION , Defaults .getUseArduinoToolSelection ());
70
+
66
71
setPreferenceStore (preferences );
67
72
}
68
73
@@ -97,24 +102,29 @@ public boolean performOk() {
97
102
boolean ret = super .performOk ();
98
103
String hardWarePaths [] = getPreferenceStore ().getString (KEY_PRIVATE_HARDWARE_PATHS ).split (File .pathSeparator );
99
104
String libraryPaths [] = getPreferenceStore ().getString (KEY_PRIVATE_LIBRARY_PATHS ).split (File .pathSeparator );
100
- BoardsManager .setAutoImportLibraries (this .automaticallyImportLibrariesOption .getBooleanValue ());
101
- BoardsManager .setPragmaOnceHeaders (this .PragmaOnceHeaderOption .getBooleanValue ());
105
+
106
+ Preferences .setUseArduinoToolSelection (this .useArduinoToolchainSelectionEditor .getBooleanValue ());
107
+ Preferences .setAutoImportLibraries (this .automaticallyImportLibrariesOptionEditor .getBooleanValue ());
108
+ Preferences .setPragmaOnceHeaders (this .pragmaOnceHeaderOptionEditor .getBooleanValue ());
102
109
BoardsManager .setPrivateHardwarePaths (hardWarePaths );
103
- BoardsManager .setPrivateLibraryPaths (libraryPaths );
110
+ LibraryManager .setPrivateLibraryPaths (libraryPaths );
104
111
return ret ;
105
112
}
106
113
107
114
@ Override
108
115
public void init (IWorkbench workbench ) {
109
116
String hardWarePaths = BoardsManager .getPrivateHardwarePathsString ();
110
117
String libraryPaths = LibraryManager .getPrivateLibraryPathsString ();
111
- boolean autoImport = BoardsManager .getAutoImportLibraries ();
112
- boolean pragmaOnceHeaders = BoardsManager .getPragmaOnceHeaders ();
118
+ boolean autoImport = Preferences .getAutoImportLibraries ();
119
+ boolean pragmaOnceHeaders = Preferences .getPragmaOnceHeaders ();
120
+ boolean useArduinoToolchainSelection =Preferences .getUseArduinoToolSelection ();
113
121
114
122
getPreferenceStore ().setValue (KEY_AUTO_IMPORT_LIBRARIES , autoImport );
115
123
getPreferenceStore ().setValue (KEY_PRAGMA_ONCE_HEADERS , pragmaOnceHeaders );
116
124
getPreferenceStore ().setValue (KEY_PRIVATE_HARDWARE_PATHS , hardWarePaths );
117
125
getPreferenceStore ().setValue (KEY_PRIVATE_LIBRARY_PATHS , libraryPaths );
126
+ getPreferenceStore ().setValue (KEY_TOOLCHAIN_SELECTION , useArduinoToolchainSelection );
127
+
118
128
}
119
129
120
130
/**
@@ -126,39 +136,45 @@ public void init(IWorkbench workbench) {
126
136
protected void createFieldEditors () {
127
137
final Composite parent = getFieldEditorParent ();
128
138
129
- this .arduinoPrivateLibPath = new PathEditor (KEY_PRIVATE_LIBRARY_PATHS , Messages .ui_private_lib_path ,
139
+ this .arduinoPrivateLibPathPathEditor = new PathEditor (KEY_PRIVATE_LIBRARY_PATHS , Messages .ui_private_lib_path ,
130
140
Messages .ui_private_lib_path_help , parent );
131
- addField (this .arduinoPrivateLibPath );
141
+ addField (this .arduinoPrivateLibPathPathEditor );
132
142
133
- this .arduinoPrivateHardwarePath = new PathEditor (KEY_PRIVATE_HARDWARE_PATHS , Messages .ui_private_hardware_path ,
143
+ this .arduinoPrivateHardwarePathPathEditor = new PathEditor (KEY_PRIVATE_HARDWARE_PATHS , Messages .ui_private_hardware_path ,
134
144
Messages .ui_private_hardware_path_help , parent );
135
- addField (this .arduinoPrivateHardwarePath );
145
+ addField (this .arduinoPrivateHardwarePathPathEditor );
136
146
137
147
Dialog .applyDialogFont (parent );
138
148
createLine (parent , 4 );
139
149
String [][] YesNoAskOptions = new String [][] { { Messages .ui_ask_every_upload , "ASK" }, //$NON-NLS-1$
140
150
{ "Yes" , TRUE }, { "No" , FALSE } }; //$NON-NLS-1$ //$NON-NLS-2$
141
- this .buildBeforeUploadOption = new ComboFieldEditor (MyPreferences .KEY_BUILD_BEFORE_UPLOAD_OPTION ,
151
+ this .buildBeforeUploadOptionEditor = new ComboFieldEditor (MyPreferences .KEY_BUILD_BEFORE_UPLOAD_OPTION ,
142
152
Messages .ui_build_before_upload , YesNoAskOptions , parent );
143
- addField (this .buildBeforeUploadOption );
153
+ addField (this .buildBeforeUploadOptionEditor );
144
154
createLine (parent , 4 );
145
155
146
- this .openSerialMonitorOpensSerialsOption = new BooleanFieldEditor (MyPreferences .KEY_OPEN_SERIAL_WITH_MONITOR ,
156
+ this .useArduinoToolchainSelectionEditor = new BooleanFieldEditor (KEY_TOOLCHAIN_SELECTION ,
157
+ Messages .ui_use_arduino_toolchain_selection , BooleanFieldEditor .DEFAULT , parent );
158
+ addField (this .useArduinoToolchainSelectionEditor );
159
+
160
+ createLine (parent , 4 );
161
+ this .openSerialMonitorOpensSerialsOptionEditor = new BooleanFieldEditor (MyPreferences .KEY_OPEN_SERIAL_WITH_MONITOR ,
147
162
Messages .ui_open_serial_with_monitor , BooleanFieldEditor .DEFAULT , parent );
148
- addField (this .openSerialMonitorOpensSerialsOption );
163
+ addField (this .openSerialMonitorOpensSerialsOptionEditor );
149
164
createLine (parent , 4 );
150
165
151
- this .automaticallyImportLibrariesOption = new BooleanFieldEditor (KEY_AUTO_IMPORT_LIBRARIES ,
166
+
167
+ this .automaticallyImportLibrariesOptionEditor = new BooleanFieldEditor (KEY_AUTO_IMPORT_LIBRARIES ,
152
168
Messages .ui_auto_import_libraries , BooleanFieldEditor .DEFAULT , parent );
153
- addField (this .automaticallyImportLibrariesOption );
169
+ addField (this .automaticallyImportLibrariesOptionEditor );
154
170
155
- this .PragmaOnceHeaderOption = new BooleanFieldEditor (KEY_PRAGMA_ONCE_HEADERS , Messages .ui_pragma_once_headers ,
171
+ this .pragmaOnceHeaderOptionEditor = new BooleanFieldEditor (KEY_PRAGMA_ONCE_HEADERS , Messages .ui_pragma_once_headers ,
156
172
BooleanFieldEditor .DEFAULT , parent );
157
- addField (this .PragmaOnceHeaderOption );
173
+ addField (this .pragmaOnceHeaderOptionEditor );
158
174
159
- this .cleanSerialMonitorAfterUpload = new BooleanFieldEditor (MyPreferences .getCleanSerialMonitorAfterUploadKey (),
175
+ this .cleanSerialMonitorAfterUploadEditor = new BooleanFieldEditor (MyPreferences .getCleanSerialMonitorAfterUploadKey (),
160
176
Messages .ui_Clean_Serial_Monitor_After_Upload , BooleanFieldEditor .DEFAULT , parent );
161
- addField (this .cleanSerialMonitorAfterUpload );
177
+ addField (this .cleanSerialMonitorAfterUploadEditor );
162
178
163
179
createLine (parent , 4 );
164
180
Label label = new Label (parent , SWT .LEFT );
0 commit comments