mirror of
https://github.com/arduino/Arduino.git
synced 2025-03-13 10:29:35 +01:00
Library and Boards Managers were using old copies of library/boards indeces. thus making the UI show old data. Fixes #4139 #3904 #3795
This commit is contained in:
parent
0fb04b3180
commit
1328f3a9e2
@ -36,6 +36,7 @@ import cc.arduino.contributions.libraries.LibraryInstaller;
|
||||
import cc.arduino.contributions.libraries.LibraryTypeComparator;
|
||||
import cc.arduino.contributions.ui.*;
|
||||
import cc.arduino.utils.Progress;
|
||||
import processing.app.BaseNoGui;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@ -52,7 +53,6 @@ import static processing.app.I18n.tr;
|
||||
public class LibraryManagerUI extends InstallerJDialog<ContributedLibrary> {
|
||||
|
||||
private final JComboBox typeChooser;
|
||||
private final LibrariesIndexer indexer;
|
||||
private final LibraryInstaller installer;
|
||||
private Predicate<ContributedLibrary> typeFilter;
|
||||
|
||||
@ -89,9 +89,8 @@ public class LibraryManagerUI extends InstallerJDialog<ContributedLibrary> {
|
||||
};
|
||||
}
|
||||
|
||||
public LibraryManagerUI(Frame parent, LibrariesIndexer indexer, LibraryInstaller installer) {
|
||||
public LibraryManagerUI(Frame parent, LibraryInstaller installer) {
|
||||
super(parent, tr("Library Manager"), Dialog.ModalityType.APPLICATION_MODAL, tr("Unable to reach Arduino.cc due to possible network issues."));
|
||||
this.indexer = indexer;
|
||||
this.installer = installer;
|
||||
|
||||
filtersContainer.add(new JLabel(tr("Topic")), 1);
|
||||
@ -139,6 +138,7 @@ public class LibraryManagerUI extends InstallerJDialog<ContributedLibrary> {
|
||||
|
||||
// TODO: Remove setIndexer and make getContribModel
|
||||
// return a FilteredAbstractTableModel
|
||||
LibrariesIndexer indexer = BaseNoGui.librariesIndexer;
|
||||
getContribModel().setIndexer(indexer);
|
||||
|
||||
categoryFilter = null;
|
||||
@ -236,7 +236,7 @@ public class LibraryManagerUI extends InstallerJDialog<ContributedLibrary> {
|
||||
}
|
||||
|
||||
public void onRemovePressed(final ContributedLibrary lib) {
|
||||
boolean managedByIndex = indexer.getIndex().getLibraries().contains(lib);
|
||||
boolean managedByIndex = BaseNoGui.librariesIndexer.getIndex().getLibraries().contains(lib);
|
||||
|
||||
if (!managedByIndex) {
|
||||
int chosenOption = JOptionPane.showConfirmDialog(this, tr("This library is not listed on Library Manager. You won't be able to reinstall it from here.\nAre you sure you want to delete it?"), tr("Please confirm library deletion"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
|
||||
|
@ -35,6 +35,7 @@ import cc.arduino.contributions.packages.ContributionInstaller;
|
||||
import cc.arduino.contributions.packages.ContributionsIndexer;
|
||||
import cc.arduino.contributions.ui.*;
|
||||
import cc.arduino.utils.Progress;
|
||||
import processing.app.BaseNoGui;
|
||||
import processing.app.I18n;
|
||||
|
||||
import javax.swing.*;
|
||||
@ -48,7 +49,6 @@ import static processing.app.I18n.tr;
|
||||
@SuppressWarnings("serial")
|
||||
public class ContributionManagerUI extends InstallerJDialog {
|
||||
|
||||
private final ContributionsIndexer indexer;
|
||||
private final ContributionInstaller installer;
|
||||
|
||||
@Override
|
||||
@ -84,9 +84,8 @@ public class ContributionManagerUI extends InstallerJDialog {
|
||||
};
|
||||
}
|
||||
|
||||
public ContributionManagerUI(Frame parent, ContributionsIndexer indexer, ContributionInstaller installer) {
|
||||
public ContributionManagerUI(Frame parent, ContributionInstaller installer) {
|
||||
super(parent, tr("Boards Manager"), Dialog.ModalityType.APPLICATION_MODAL, tr("Unable to reach Arduino.cc due to possible network issues."));
|
||||
this.indexer = indexer;
|
||||
this.installer = installer;
|
||||
}
|
||||
|
||||
@ -95,6 +94,7 @@ public class ContributionManagerUI extends InstallerJDialog {
|
||||
|
||||
categoryChooser.removeActionListener(categoryChooserActionListener);
|
||||
|
||||
ContributionsIndexer indexer = BaseNoGui.indexer;
|
||||
getContribModel().setIndexer(indexer);
|
||||
|
||||
categoryFilter = null;
|
||||
|
@ -1280,7 +1280,7 @@ public class Base {
|
||||
contributionsSelfCheck.cancel();
|
||||
}
|
||||
@SuppressWarnings("serial")
|
||||
LibraryManagerUI managerUI = new LibraryManagerUI(activeEditor, BaseNoGui.librariesIndexer, libraryInstaller) {
|
||||
LibraryManagerUI managerUI = new LibraryManagerUI(activeEditor, libraryInstaller) {
|
||||
@Override
|
||||
protected void onIndexesUpdated() throws Exception {
|
||||
BaseNoGui.initPackages();
|
||||
@ -1309,7 +1309,7 @@ public class Base {
|
||||
contributionsSelfCheck.cancel();
|
||||
}
|
||||
@SuppressWarnings("serial")
|
||||
ContributionManagerUI managerUI = new ContributionManagerUI(activeEditor, BaseNoGui.indexer, contributionInstaller) {
|
||||
ContributionManagerUI managerUI = new ContributionManagerUI(activeEditor, contributionInstaller) {
|
||||
@Override
|
||||
protected void onIndexesUpdated() throws Exception {
|
||||
BaseNoGui.initPackages();
|
||||
|
@ -84,7 +84,7 @@ public class BaseNoGui {
|
||||
static final String portableSketchbookFolder = "sketchbook";
|
||||
|
||||
public static ContributionsIndexer indexer;
|
||||
static LibrariesIndexer librariesIndexer;
|
||||
public static LibrariesIndexer librariesIndexer;
|
||||
|
||||
// Returns a File object for the given pathname. If the pathname
|
||||
// is not absolute, it is interpreted relative to the current
|
||||
|
Loading…
x
Reference in New Issue
Block a user