Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,17 @@ public void updateIndexFilter(String[] filters,

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)
Expand All @@ -71,9 +80,12 @@ private void updateContributions() {
}
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;
Expand All @@ -86,6 +98,7 @@ private void updateContributions() {
}
return x1.getName().compareToIgnoreCase(y1.getName());
});

fireTableDataChanged();
}

Expand All @@ -110,12 +123,12 @@ private boolean stringContainsAll(String string, String set[]) {

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));
}

Expand Down