mirror of
https://github.com/arduino/Arduino.git
synced 2025-03-14 11:29:26 +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.libraries.LibraryTypeComparator;
|
||||||
import cc.arduino.contributions.ui.*;
|
import cc.arduino.contributions.ui.*;
|
||||||
import cc.arduino.utils.Progress;
|
import cc.arduino.utils.Progress;
|
||||||
|
import processing.app.BaseNoGui;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@ -52,7 +53,6 @@ import static processing.app.I18n.tr;
|
|||||||
public class LibraryManagerUI extends InstallerJDialog<ContributedLibrary> {
|
public class LibraryManagerUI extends InstallerJDialog<ContributedLibrary> {
|
||||||
|
|
||||||
private final JComboBox typeChooser;
|
private final JComboBox typeChooser;
|
||||||
private final LibrariesIndexer indexer;
|
|
||||||
private final LibraryInstaller installer;
|
private final LibraryInstaller installer;
|
||||||
private Predicate<ContributedLibrary> typeFilter;
|
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."));
|
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;
|
this.installer = installer;
|
||||||
|
|
||||||
filtersContainer.add(new JLabel(tr("Topic")), 1);
|
filtersContainer.add(new JLabel(tr("Topic")), 1);
|
||||||
@ -139,6 +138,7 @@ public class LibraryManagerUI extends InstallerJDialog<ContributedLibrary> {
|
|||||||
|
|
||||||
// TODO: Remove setIndexer and make getContribModel
|
// TODO: Remove setIndexer and make getContribModel
|
||||||
// return a FilteredAbstractTableModel
|
// return a FilteredAbstractTableModel
|
||||||
|
LibrariesIndexer indexer = BaseNoGui.librariesIndexer;
|
||||||
getContribModel().setIndexer(indexer);
|
getContribModel().setIndexer(indexer);
|
||||||
|
|
||||||
categoryFilter = null;
|
categoryFilter = null;
|
||||||
@ -236,7 +236,7 @@ public class LibraryManagerUI extends InstallerJDialog<ContributedLibrary> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onRemovePressed(final ContributedLibrary lib) {
|
public void onRemovePressed(final ContributedLibrary lib) {
|
||||||
boolean managedByIndex = indexer.getIndex().getLibraries().contains(lib);
|
boolean managedByIndex = BaseNoGui.librariesIndexer.getIndex().getLibraries().contains(lib);
|
||||||
|
|
||||||
if (!managedByIndex) {
|
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);
|
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.packages.ContributionsIndexer;
|
||||||
import cc.arduino.contributions.ui.*;
|
import cc.arduino.contributions.ui.*;
|
||||||
import cc.arduino.utils.Progress;
|
import cc.arduino.utils.Progress;
|
||||||
|
import processing.app.BaseNoGui;
|
||||||
import processing.app.I18n;
|
import processing.app.I18n;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
@ -48,7 +49,6 @@ import static processing.app.I18n.tr;
|
|||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class ContributionManagerUI extends InstallerJDialog {
|
public class ContributionManagerUI extends InstallerJDialog {
|
||||||
|
|
||||||
private final ContributionsIndexer indexer;
|
|
||||||
private final ContributionInstaller installer;
|
private final ContributionInstaller installer;
|
||||||
|
|
||||||
@Override
|
@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."));
|
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;
|
this.installer = installer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,6 +94,7 @@ public class ContributionManagerUI extends InstallerJDialog {
|
|||||||
|
|
||||||
categoryChooser.removeActionListener(categoryChooserActionListener);
|
categoryChooser.removeActionListener(categoryChooserActionListener);
|
||||||
|
|
||||||
|
ContributionsIndexer indexer = BaseNoGui.indexer;
|
||||||
getContribModel().setIndexer(indexer);
|
getContribModel().setIndexer(indexer);
|
||||||
|
|
||||||
categoryFilter = null;
|
categoryFilter = null;
|
||||||
|
@ -1280,7 +1280,7 @@ public class Base {
|
|||||||
contributionsSelfCheck.cancel();
|
contributionsSelfCheck.cancel();
|
||||||
}
|
}
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
LibraryManagerUI managerUI = new LibraryManagerUI(activeEditor, BaseNoGui.librariesIndexer, libraryInstaller) {
|
LibraryManagerUI managerUI = new LibraryManagerUI(activeEditor, libraryInstaller) {
|
||||||
@Override
|
@Override
|
||||||
protected void onIndexesUpdated() throws Exception {
|
protected void onIndexesUpdated() throws Exception {
|
||||||
BaseNoGui.initPackages();
|
BaseNoGui.initPackages();
|
||||||
@ -1309,7 +1309,7 @@ public class Base {
|
|||||||
contributionsSelfCheck.cancel();
|
contributionsSelfCheck.cancel();
|
||||||
}
|
}
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
ContributionManagerUI managerUI = new ContributionManagerUI(activeEditor, BaseNoGui.indexer, contributionInstaller) {
|
ContributionManagerUI managerUI = new ContributionManagerUI(activeEditor, contributionInstaller) {
|
||||||
@Override
|
@Override
|
||||||
protected void onIndexesUpdated() throws Exception {
|
protected void onIndexesUpdated() throws Exception {
|
||||||
BaseNoGui.initPackages();
|
BaseNoGui.initPackages();
|
||||||
|
@ -84,7 +84,7 @@ public class BaseNoGui {
|
|||||||
static final String portableSketchbookFolder = "sketchbook";
|
static final String portableSketchbookFolder = "sketchbook";
|
||||||
|
|
||||||
public static ContributionsIndexer indexer;
|
public static ContributionsIndexer indexer;
|
||||||
static LibrariesIndexer librariesIndexer;
|
public static LibrariesIndexer librariesIndexer;
|
||||||
|
|
||||||
// Returns a File object for the given pathname. If the pathname
|
// Returns a File object for the given pathname. If the pathname
|
||||||
// is not absolute, it is interpreted relative to the current
|
// is not absolute, it is interpreted relative to the current
|
||||||
|
Loading…
x
Reference in New Issue
Block a user