Skip to content

Commit 860243c

Browse files
committed
Sorting of items is "better" the new sketch starts with the examples and the library list is now sorted case insensetive.
1 parent 35defd5 commit 860243c

File tree

2 files changed

+14
-16
lines changed

2 files changed

+14
-16
lines changed

it.baeyens.arduino.core/src/it/baeyens/arduino/ui/ArduinoSampleSelector.java

+8-10
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ public ArduinoSampleSelector(Composite parent, int style, String label) {
4747
myLabel.setLayoutData(theGriddata);
4848

4949
myTreeSelector = new Tree(composite, SWT.CHECK | SWT.BORDER);
50-
5150
myTreeSelector.setLayoutData(theGriddata);
5251
// Get the data in the tree
5352
myTreeSelector.setRedraw(false);
@@ -90,14 +89,6 @@ public void handleEvent(Event event) {
9089
public void AddAllExamples(IPath arduinoExample, IPath arduinoLibPath, IPath privateLibrary, IPath hardwareLibrary) {
9190
removeExamples();
9291

93-
if (arduinoLibPath.toFile().exists()) {
94-
addLibExamples(arduinoLibPath, ArduinoConst.WORKSPACE_PATH_VARIABLE_NAME_ARDUINO_LIB);
95-
}
96-
97-
if (hardwareLibrary.toFile().exists()) {
98-
addLibExamples(hardwareLibrary, ArduinoConst.WORKSPACE_PATH_VARIABLE_NAME_HARDWARE_LIB);
99-
}
100-
10192
if (arduinoExample.toFile().exists()) {
10293
// Create Arduino Item
10394
// TreeItem myArduinoExampleItem = new TreeItem(myTreeSelector, SWT.NONE);
@@ -108,10 +99,17 @@ public void AddAllExamples(IPath arduinoExample, IPath arduinoLibPath, IPath pri
10899
addExamplesFolder(arduinoExample);
109100
}
110101

102+
if (arduinoLibPath.toFile().exists()) {
103+
addLibExamples(arduinoLibPath, ArduinoConst.WORKSPACE_PATH_VARIABLE_NAME_ARDUINO_LIB);
104+
}
105+
106+
if (hardwareLibrary.toFile().exists()) {
107+
addLibExamples(hardwareLibrary, ArduinoConst.WORKSPACE_PATH_VARIABLE_NAME_HARDWARE_LIB);
108+
}
109+
111110
if (privateLibrary.toFile().exists()) {
112111
addLibExamples(privateLibrary, ArduinoConst.WORKSPACE_PATH_VARIABLE_NAME_PRIVATE_LIB);
113112
}
114-
115113
}
116114

117115
/**

it.baeyens.arduino.core/src/it/baeyens/arduino/ui/Import_Arduino_Libraries_Page.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ protected void createSourceGroup(Composite parent) {
7575
myLibrarySelector.setLayoutData(theGriddata);
7676

7777
// find the items to add to the list
78-
Set<String> allLibraries = ArduinoLibraries.findAllHarwareLibraries(myProject);
78+
Set<String> allLibraries = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
79+
allLibraries.addAll(ArduinoLibraries.findAllHarwareLibraries(myProject));
7980
allLibraries.addAll(ArduinoLibraries.findAllUserLibraries(myProject));
8081
allLibraries.addAll(ArduinoLibraries.findAllArduinoLibraries(myProject));
8182

@@ -87,10 +88,9 @@ protected void createSourceGroup(Composite parent) {
8788
TreeItem child = new TreeItem(myLibrarySelector, SWT.NONE);
8889
String nextLibrary = iterator.next();
8990
child.setText(nextLibrary);
90-
if(allLibrariesAlreadyUsed.contains(nextLibrary))
91-
child.setChecked(true);
91+
if (allLibrariesAlreadyUsed.contains(nextLibrary))
92+
child.setChecked(true);
9293
}
93-
9494

9595
myLibrarySelector.setRedraw(true);
9696

@@ -112,9 +112,9 @@ public boolean PerformFinish() {
112112
Set<String> unselectedLibraries = new TreeSet<String>();
113113
for (TreeItem CurItem : selectedTreeItems) {
114114
if (CurItem.getChecked())
115-
selectedLibraries.add(CurItem.getText());
115+
selectedLibraries.add(CurItem.getText());
116116
else
117-
unselectedLibraries.add(CurItem.getText());
117+
unselectedLibraries.add(CurItem.getText());
118118
}
119119
ArduinoLibraries.removeLibrariesFromProject(myProject, unselectedLibraries);
120120
ArduinoLibraries.addLibrariesToProject(myProject, selectedLibraries);

0 commit comments

Comments
 (0)