mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-30 16:24:09 +03:00
Implemented "Update List" button of Boards Installer.
This commit is contained in:
committed by
Federico Fissore
parent
5d1e4e3f70
commit
fe2d087ebd
@ -91,7 +91,7 @@ public class ContributionManagerUI extends JDialog {
|
||||
private String category;
|
||||
private String[] filters;
|
||||
|
||||
public ContributionManagerUI(Frame parent, ContributionsIndexer indexer) {
|
||||
public ContributionManagerUI(Frame parent) {
|
||||
super(parent, "Boards Manager", Dialog.ModalityType.APPLICATION_MODAL);
|
||||
|
||||
setResizable(true);
|
||||
@ -238,7 +238,9 @@ public class ContributionManagerUI extends JDialog {
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setIndexer(ContributionsIndexer indexer) {
|
||||
contribModel.setIndex(indexer.getIndex());
|
||||
setCategories(indexer.getIndex().getCategories());
|
||||
|
||||
@ -305,11 +307,6 @@ public class ContributionManagerUI extends JDialog {
|
||||
progressBar.setString(text);
|
||||
}
|
||||
|
||||
public void onUpdatePressed() {
|
||||
// TODO Auto-generated method stub
|
||||
System.out.println("Update pressed");
|
||||
}
|
||||
|
||||
/*
|
||||
* Installer methods follows
|
||||
*/
|
||||
@ -322,6 +319,25 @@ public class ContributionManagerUI extends JDialog {
|
||||
installerThread.interrupt();
|
||||
}
|
||||
|
||||
public void onUpdatePressed() {
|
||||
installerThread = new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
setProgressVisible(true);
|
||||
installer.updateIndex();
|
||||
onIndexesUpdated();
|
||||
} catch (Exception e) {
|
||||
// TODO Show ERROR
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
setProgressVisible(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
installerThread.start();
|
||||
}
|
||||
|
||||
public void onInstallPressed(final ContributedPlatform platform) {
|
||||
installerThread = new Thread(new Runnable() {
|
||||
@Override
|
||||
@ -358,4 +374,8 @@ public class ContributionManagerUI extends JDialog {
|
||||
installerThread.start();
|
||||
}
|
||||
|
||||
protected void onIndexesUpdated() throws Exception {
|
||||
// Empty
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1110,7 +1110,15 @@ public class Base {
|
||||
|
||||
private void openInstallBoardDialog() {
|
||||
// Create dialog for contribution manager
|
||||
ContributionManagerUI managerUI = new ContributionManagerUI(activeEditor, BaseNoGui.indexer);
|
||||
@SuppressWarnings("serial")
|
||||
ContributionManagerUI managerUI = new ContributionManagerUI(activeEditor) {
|
||||
@Override
|
||||
protected void onIndexesUpdated() throws Exception {
|
||||
BaseNoGui.reloadAllHardware();
|
||||
setIndexer(BaseNoGui.indexer);
|
||||
}
|
||||
};
|
||||
managerUI.setIndexer(BaseNoGui.indexer);
|
||||
managerUI.setVisible(true);
|
||||
}
|
||||
|
||||
|
@ -2769,12 +2769,14 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
|
||||
protected void onBoardOrPortChange() {
|
||||
Map<String, String> boardPreferences = Base.getBoardPreferences();
|
||||
lineStatus.setBoardName(boardPreferences.get("name"));
|
||||
if (boardPreferences != null)
|
||||
lineStatus.setBoardName(boardPreferences.get("name"));
|
||||
else
|
||||
lineStatus.setBoardName("-");
|
||||
lineStatus.setSerialPort(Preferences.get("serial.port"));
|
||||
lineStatus.repaint();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the edit popup menu.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user