Skip to content

Commit 86dd3c6

Browse files
author
jantje
committed
#585 remove default as option for programmers
1 parent 68d0ccb commit 86dd3c6

File tree

4 files changed

+41
-63
lines changed

4 files changed

+41
-63
lines changed

io.sloeber.core/src/io/sloeber/core/api/BoardDescription.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public class BoardDescription {
7272
* This is the basic info contained in the descriptor
7373
*/
7474
private String myUploadPort = EMPTY;
75-
private String myProgrammer = Defaults.getDefaultUploadProtocol();
75+
private String myProgrammer = EMPTY;
7676
private String myBoardID = EMPTY;
7777
private Map<String, String> myOptions = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
7878

@@ -346,7 +346,7 @@ public BoardDescription() {
346346
myBoardTxtFile = new BoardTxtFile(this.myreferencingBoardsFile);
347347
myBoardID = myStorageNode.get(KEY_LAST_USED_BOARD, EMPTY);
348348
myUploadPort = myStorageNode.get(KEY_LAST_USED_UPLOAD_PORT, EMPTY);
349-
myProgrammer = myStorageNode.get(KEY_LAST_USED_UPLOAD_PROTOCOL, Defaults.getDefaultUploadProtocol());
349+
myProgrammer = myStorageNode.get(KEY_LAST_USED_UPLOAD_PROTOCOL, EMPTY);
350350
myOptions = KeyValue.makeMap(myStorageNode.get(KEY_LAST_USED_BOARD_MENU_OPTIONS, EMPTY));
351351
}
352352

@@ -664,11 +664,6 @@ public String getUploadPatternKey() {
664664
}
665665

666666

667-
public boolean usesProgrammer() {
668-
updateWhenDirty();
669-
return !myProgrammer.equals(Defaults.getDefaultUploadProtocol());
670-
}
671-
672667
public IPath getreferencedHardwarePath() {
673668
updateWhenDirty();
674669
IPath platformPath = getReferencedCorePlatformPath();

io.sloeber.core/src/io/sloeber/core/api/Defaults.java

Lines changed: 38 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -8,51 +8,43 @@
88

99
@SuppressWarnings("nls")
1010
public class Defaults {
11-
public static final String EXAMPLE_PACKAGE = "examples_Arduino_1_8_10.zip";
12-
public static final String EXAMPLES_URL = "https://github.com/Sloeber/arduino-eclipse-plugin/releases/download/V4_3_2/" + EXAMPLE_PACKAGE;
13-
14-
public static final String DEFAULT_INSTALL_PLATFORM_NAME = "Arduino AVR Boards";
15-
public static final String DEFAULT_INSTALL_ARCHITECTURE= "AVR";
16-
public static final String DEFAULT_INSTALL_MAINTAINER= "Arduino";
17-
public static final String[] DEFAULT_INSTALLED_LIBRARIES = new String[] { "Ethernet", "Firmata", "GSM", "Keyboard",
18-
"LiquidCrystal", "Mouse", "SD", "Servo", "Stepper", "TFT", "WiFi", "CapacitiveSensor" };
19-
public static final String DEFAULT = "Default";
20-
21-
public static final boolean updateJsonFiles = true;
22-
public static final boolean useBonjour=true;
23-
public static final boolean autoInstallLibraries = true;
24-
public static final boolean useArduinoToolSelection= true;
25-
26-
27-
28-
/**
29-
* Arduino has the default libraries in the user home directory in subfolder
30-
* Arduino/libraries. As the home directory is platform dependent getting
31-
* the value is resolved by this method
32-
*
33-
* @return the folder where Arduino puts the libraries by default.
34-
*/
35-
public static String getPrivateLibraryPath() {
36-
IPath homPath = new Path(System.getProperty("user.home"));
37-
if(SystemUtils.IS_OS_MAC || SystemUtils.IS_OS_WINDOWS ) {
38-
homPath=homPath.append("Documents");
39-
}
40-
return homPath.append("Arduino").append(LIBRARY_PATH_SUFFIX).toString();
41-
}
42-
43-
public static String getPrivateHardwarePath() {
44-
IPath homPath = new Path(System.getProperty("user.home"));
45-
if(SystemUtils.IS_OS_MAC || SystemUtils.IS_OS_WINDOWS ) {
46-
homPath=homPath.append("Documents");
47-
}
11+
public static final String EXAMPLE_PACKAGE = "examples_Arduino_1_8_10.zip";
12+
public static final String EXAMPLES_URL = "https://github.com/Sloeber/arduino-eclipse-plugin/releases/download/V4_3_2/"
13+
+ EXAMPLE_PACKAGE;
14+
15+
public static final String DEFAULT_INSTALL_PLATFORM_NAME = "Arduino AVR Boards";
16+
public static final String DEFAULT_INSTALL_ARCHITECTURE = "AVR";
17+
public static final String DEFAULT_INSTALL_MAINTAINER = "Arduino";
18+
public static final String[] DEFAULT_INSTALLED_LIBRARIES = new String[] { "Ethernet", "Firmata", "GSM", "Keyboard",
19+
"LiquidCrystal", "Mouse", "SD", "Servo", "Stepper", "TFT", "WiFi", "CapacitiveSensor" };
20+
public static final String DEFAULT = "Default";
21+
22+
public static final boolean updateJsonFiles = true;
23+
public static final boolean useBonjour = true;
24+
public static final boolean autoInstallLibraries = true;
25+
public static final boolean useArduinoToolSelection = true;
26+
27+
/**
28+
* Arduino has the default libraries in the user home directory in subfolder
29+
* Arduino/libraries. As the home directory is platform dependent getting the
30+
* value is resolved by this method
31+
*
32+
* @return the folder where Arduino puts the libraries by default.
33+
*/
34+
public static String getPrivateLibraryPath() {
35+
IPath homPath = new Path(System.getProperty("user.home"));
36+
if (SystemUtils.IS_OS_MAC || SystemUtils.IS_OS_WINDOWS) {
37+
homPath = homPath.append("Documents");
38+
}
39+
return homPath.append("Arduino").append(LIBRARY_PATH_SUFFIX).toString();
40+
}
41+
42+
public static String getPrivateHardwarePath() {
43+
IPath homPath = new Path(System.getProperty("user.home"));
44+
if (SystemUtils.IS_OS_MAC || SystemUtils.IS_OS_WINDOWS) {
45+
homPath = homPath.append("Documents");
46+
}
4847
return homPath.append("Arduino").append(ARDUINO_HARDWARE_FOLDER_NAME).toString();
49-
}
48+
}
5049

51-
public static String getDefaultUploadProtocol() {
52-
return DEFAULT;
53-
}
54-
55-
56-
57-
58-
}
50+
}

io.sloeber.core/src/io/sloeber/core/txt/Programmers.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import org.eclipse.core.runtime.IPath;
99

1010
import io.sloeber.core.api.BoardDescription;
11-
import io.sloeber.core.api.Defaults;
1211

1312
public class Programmers extends BoardTxtFile {
1413
private static final String programmersFileName1 = "programmers.txt";//$NON-NLS-1$
@@ -59,8 +58,7 @@ private static Programmers[] fromBoards(IPath referencingPlatformPath, IPath ref
5958
}
6059

6160
public static String[] getUploadProtocols(BoardDescription boardsDescriptor) {
62-
String[] ret = new String[1];
63-
ret[0] = Defaults.getDefaultUploadProtocol();
61+
String[] ret = new String[0];
6462
Programmers allProgrammers[] = fromBoards(boardsDescriptor);
6563
for (Programmers curprogrammer : allProgrammers) {
6664
ret = curprogrammer.getAllSectionNames(ret);

io.sloeber.ui/src/io/sloeber/ui/project/properties/BoardSelectionPage.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import org.eclipse.swt.widgets.Listener;
2626

2727
import io.sloeber.core.api.BoardDescription;
28-
import io.sloeber.core.api.Defaults;
2928
import io.sloeber.core.api.PackageManager;
3029
import io.sloeber.core.api.PasswordManager;
3130
import io.sloeber.core.api.SerialManager;
@@ -82,9 +81,6 @@ public void handleEvent(Event e) {
8281
myControlUploadProtocol.setItems(boardDesc.getUploadProtocols());
8382
myControlUploadProtocol.setText(boardDesc.getProgrammer());
8483

85-
if (myControlUploadProtocol.getText().isEmpty()) {
86-
myControlUploadProtocol.setText(Defaults.getDefaultUploadProtocol());
87-
}
8884

8985
setTheLabelCombos(getBoardFromScreen());
9086
genericListenerEnd();
@@ -284,9 +280,6 @@ protected void updateScreen() {
284280
myControlUploadProtocol.setText(CurrentUploadProtocol);
285281
if (myControlUploadProtocol.getText().trim().isEmpty()) {
286282
myControlUploadProtocol.setText(boardDesc.getProgrammer());
287-
if (myControlUploadProtocol.getText().isEmpty()) {
288-
myControlUploadProtocol.setText(Defaults.getDefaultUploadProtocol());
289-
}
290283
}
291284

292285
myControlUploadPort.setText(boardDesc.getUploadPort());

0 commit comments

Comments
 (0)