mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-21 10:52:14 +01:00
Merge pull request #11096 from facchinm/loose_filter_on_boards
Board Manager: searching returns also near matches
This commit is contained in:
commit
9b509c06f6
@ -60,8 +60,17 @@ public class ContributionIndexTableModel
|
||||
|
||||
private void updateContributions() {
|
||||
contributions.clear();
|
||||
|
||||
// Generate ContributedPlatformReleases from all platform releases
|
||||
for (ContributedPackage pack : BaseNoGui.indexer.getPackages()) {
|
||||
for (ContributedPlatform platform : pack.getPlatforms()) {
|
||||
addContribution(platform);
|
||||
}
|
||||
}
|
||||
|
||||
// Filter ContributedPlatformReleases based on search terms
|
||||
contributions.removeIf(releases -> {
|
||||
for (ContributedPlatform platform : releases.releases) {
|
||||
String compoundTargetSearchText = platform.getName() + "\n"
|
||||
+ platform.getBoards().stream()
|
||||
.map(ContributedBoard::getName)
|
||||
@ -71,9 +80,12 @@ public class ContributionIndexTableModel
|
||||
}
|
||||
if (!stringContainsAll(compoundTargetSearchText, filters))
|
||||
continue;
|
||||
addContribution(platform);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
// Sort ContributedPlatformReleases and put deprecated platforms to the bottom
|
||||
Collections.sort(contributions, (x,y)-> {
|
||||
if (x.isDeprecated() != y.isDeprecated()) {
|
||||
return x.isDeprecated() ? 1 : -1;
|
||||
@ -86,6 +98,7 @@ public class ContributionIndexTableModel
|
||||
}
|
||||
return x1.getName().compareToIgnoreCase(y1.getName());
|
||||
});
|
||||
|
||||
fireTableDataChanged();
|
||||
}
|
||||
|
||||
@ -110,12 +123,12 @@ public class ContributionIndexTableModel
|
||||
|
||||
private void addContribution(ContributedPlatform platform) {
|
||||
for (ContributedPlatformReleases contribution : contributions) {
|
||||
if (!contribution.shouldContain(platform))
|
||||
if (!contribution.shouldContain(platform)) {
|
||||
continue;
|
||||
}
|
||||
contribution.add(platform);
|
||||
return;
|
||||
}
|
||||
|
||||
contributions.add(new ContributedPlatformReleases(platform));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user