51
51
52
52
import it .baeyens .arduino .common .Common ;
53
53
import it .baeyens .arduino .common .ConfigurationPreferences ;
54
+ import it .baeyens .arduino .common .Defaults ;
54
55
import it .baeyens .arduino .ui .Activator ;
55
56
56
57
public class Manager {
57
58
58
- private static final String ARDUINO_AVR_BOARDS = "Arduino AVR Boards" ; //$NON-NLS-1$
59
-
60
- public static final String LIBRARIES_URL = "http://downloads.arduino.cc/libraries/library_index.json" ; //$NON-NLS-1$
61
- public static final String EXAMPLE_PACKAGE = "examples_Arduino_1_6_7.zip" ; //$NON-NLS-1$
62
- public static final String EXAMPLES_URL = "http://eclipse.baeyens.it/download/" + EXAMPLE_PACKAGE ; //$NON-NLS-1$
63
59
static private List <PackageIndex > packageIndices ;
64
60
static private LibraryIndex libraryIndex ;
65
61
@@ -90,17 +86,16 @@ public static void startup_Pluging(IProgressMonitor monitor) {
90
86
// InformUserOfInstallationStart(monitor);
91
87
// so first do the libraries
92
88
93
- InstallLibraries (monitor );
89
+ InstallDefaultLibraries (monitor );
94
90
95
91
// Downmload sample programs
96
- downloadAndInstall (EXAMPLES_URL , EXAMPLE_PACKAGE ,
92
+ downloadAndInstall (Defaults . EXAMPLES_URL , Defaults . EXAMPLE_PACKAGE ,
97
93
Paths .get (ConfigurationPreferences .getInstallationPathExamples ().toString ()), false , monitor );
98
94
99
95
// now add the boards
100
- String platformName = ARDUINO_AVR_BOARDS ;
101
96
Package pkg = packageIndices .get (0 ).getPackages ().get (0 );
102
97
if (pkg != null ) {
103
- ArduinoPlatform platform = pkg .getLatestPlatform (platformName );
98
+ ArduinoPlatform platform = pkg .getLatestPlatform (Defaults . PLATFORM_NAME );
104
99
if (platform == null ) {
105
100
ArduinoPlatform [] platformList = new ArduinoPlatform [pkg .getLatestPlatforms ().size ()];
106
101
pkg .getLatestPlatforms ().toArray (platformList );
@@ -117,11 +112,10 @@ public static void startup_Pluging(IProgressMonitor monitor) {
117
112
118
113
}
119
114
120
- private static void InstallLibraries (IProgressMonitor monitor ) {
115
+ private static void InstallDefaultLibraries (IProgressMonitor monitor ) {
121
116
LibraryIndex libindex = getLibraryIndex ();
122
- String [] libraries = new String [] { "Ethernet" , "Firmata" , "GSM" , "Keyboard" , "LiquidCrystal" , "Mouse" , "SD" , //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
123
- "Servo" , "Stepper" , "TFT" , "WiFi" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
124
- for (String library : libraries ) {
117
+
118
+ for (String library : Defaults .INSTALLED_LIBRARIES ) {
125
119
Library toInstalLib = libindex .getLatestLibrary (library );
126
120
if (toInstalLib != null ) {
127
121
toInstalLib .install (monitor );
@@ -262,7 +256,7 @@ static public List<PackageIndex> getPackageIndices() {
262
256
263
257
private static void loadLibraryIndex (boolean download ) {
264
258
try {
265
- URL librariesUrl = new URL (LIBRARIES_URL );
259
+ URL librariesUrl = new URL (Defaults . LIBRARIES_URL );
266
260
String localFileName = Paths .get (librariesUrl .getPath ()).getFileName ().toString ();
267
261
Path librariesPath = Paths
268
262
.get (ConfigurationPreferences .getInstallationPath ().append (localFileName ).toString ());
0 commit comments