You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Updating individual libraries is a bit of a pain, but it is made worse when after selecting Type=Updatable, and clicking update on one library, the UI changes back to Type=All after that one update. Then you have to set it back to "Updateable"
Hi - I'm a new contributor and thought I could try and implement a fix for this. I think I've found where this functionality is: Arduino/app/src/cc/arduino/contributions/libraries/ui/DropdownUpdatableLibrariesItem.java
Drop down updated list:
public class DropdownUpdatableLibrariesItem implements DropdownItem<ContributedLibraryReleases> {
@Override
public Predicate<ContributedLibraryReleases> getFilterPredicate() {
return new Predicate<ContributedLibraryReleases>() {
@Override
public boolean test(ContributedLibraryReleases lib) {
Optional<ContributedLibrary> mayInstalled = lib.getInstalled();
if (!mayInstalled.isPresent()) {
return false;
}
return !lib.getLatest().equals(mayInstalled.get());
}
};
}
@Override
public String toString() {
return tr("Updatable");
}
}
And under: Arduino/app/src/cc/arduino/contributions/libraries/ui/DropdownAllLibraries.java
Dropdown all list:
public class DropdownAllLibraries implements DropdownItem<ContributedLibraryReleases> {
public String toString() {
return tr("All");
}
@Override
public Predicate<ContributedLibraryReleases> getFilterPredicate() {
return x -> true;
}
}
Now these are the implementations, but after an update I assume a default will be selected again to "All".
I think this is done in: Arduino/app/src/cc/arduino/contributions/libraries/ui/LibraryManagerUI.java
public void updateUI() {
// Check if categories or types have changed
Collection<String> categories = BaseNoGui.librariesIndexer.getIndex().getCategories();
List<String> types = new LinkedList<>(BaseNoGui.librariesIndexer.getIndex().getTypes());
Collections.sort(types, new LibraryTypeComparator());
if (categories.equals(oldCategories) && types.equals(oldTypes)) {
return;
}
oldCategories = categories;
oldTypes = types;
// Load categories
categoryFilter = x -> true;
categoryChooser.removeActionListener(categoryChooserActionListener);
categoryChooser.removeAllItems();
categoryChooser.addItem(new DropdownAllLibraries());
for (String category : categories) {
categoryChooser.addItem(new DropdownLibraryOfCategoryItem(category));
}
categoryChooser.setEnabled(categoryChooser.getItemCount() > 1);
categoryChooser.addActionListener(categoryChooserActionListener);
categoryChooser.setSelectedIndex(0);
// Load types
extraFilter = x -> true;
typeChooser.removeActionListener(typeChooserActionListener);
typeChooser.removeAllItems();
typeChooser.addItem(new DropdownAllLibraries());
typeChooser.addItem(new DropdownUpdatableLibrariesItem());
typeChooser.addItem(new DropdownInstalledLibraryItem());
for (String type : types) {
typeChooser.addItem(new DropdownLibraryOfTypeItem(type));
}
typeChooser.setEnabled(typeChooser.getItemCount() > 1);
typeChooser.addActionListener(typeChooserActionListener);
typeChooser.setSelectedIndex(0);
filterField.setEnabled(contribModel.getRowCount() > 0);
}
I think the under the //Load categories section the default is to reload DropdownAllLibraries() ->we could save the currently selected dropdown type prior to the UI update, and update the UI with the same option instead of always updating to all libraries. Does this seem like a good fix?
Activity
lhalf commentedon Apr 8, 2021
Hi - I'm a new contributor and thought I could try and implement a fix for this. I think I've found where this functionality is: Arduino/app/src/cc/arduino/contributions/libraries/ui/DropdownUpdatableLibrariesItem.java
Drop down updated list:
And under: Arduino/app/src/cc/arduino/contributions/libraries/ui/DropdownAllLibraries.java
Dropdown all list:
Now these are the implementations, but after an update I assume a default will be selected again to "All".
I think this is done in: Arduino/app/src/cc/arduino/contributions/libraries/ui/LibraryManagerUI.java
I think the under the //Load categories section the default is to reload DropdownAllLibraries() ->we could save the currently selected dropdown type prior to the UI update, and update the UI with the same option instead of always updating to all libraries. Does this seem like a good fix?
cmaglie commentedon Apr 26, 2021
The fix for this issue is already on
master
and will be released with the IDE 1.8.14.