Skip to content

Commit a81772a

Browse files
committed
Boards Manager: update UI after an install/remove
1 parent 1361bce commit a81772a

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

app/src/cc/arduino/contributions/packages/ui/ContributionIndexTableModel.java

+9
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,17 @@ public class ContributionIndexTableModel
4747
private final List<ContributedPlatformReleases> contributions = new ArrayList<>();
4848
private final String[] columnNames = { "Description" };
4949
private final Class<?>[] columnTypes = { ContributedPlatform.class };
50+
private Predicate<ContributedPlatform> filter;
51+
private String[] filters;
5052

5153
public void updateIndexFilter(String[] filters,
5254
Predicate<ContributedPlatform> filter) {
55+
this.filter = filter;
56+
this.filters = filters;
57+
updateContributions();
58+
}
59+
60+
private void updateContributions() {
5361
contributions.clear();
5462
for (ContributedPackage pack : BaseNoGui.indexer.getPackages()) {
5563
for (ContributedPlatform platform : pack.getPlatforms()) {
@@ -146,6 +154,7 @@ public ContributedPlatform getSelectedRelease(int row) {
146154
}
147155

148156
public void update() {
157+
updateContributions();
149158
fireTableDataChanged();
150159
}
151160

app/src/cc/arduino/contributions/packages/ui/ContributionManagerUI.java

+12
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,10 @@ public void onUpdatePressed() {
144144
.updateIndex(this::setProgress);
145145
installer.deleteUnknownFiles(downloadedPackageIndexFiles);
146146
onIndexesUpdated();
147+
if (contribTable.getCellEditor() != null) {
148+
contribTable.getCellEditor().stopCellEditing();
149+
}
150+
getContribModel().update();
147151
} catch (Exception e) {
148152
throw new RuntimeException(e);
149153
} finally {
@@ -169,6 +173,10 @@ public void onInstallPressed(final ContributedPlatform platformToInstall,
169173
}
170174
errors.addAll(installer.install(platformToInstall, this::setProgress));
171175
onIndexesUpdated();
176+
if (contribTable.getCellEditor() != null) {
177+
contribTable.getCellEditor().stopCellEditing();
178+
}
179+
getContribModel().update();
172180
} catch (Exception e) {
173181
throw new RuntimeException(e);
174182
} finally {
@@ -207,6 +215,10 @@ public void onRemovePressed(final ContributedPlatform platform,
207215
setProgressVisible(true, tr("Removing..."));
208216
installer.remove(platform);
209217
onIndexesUpdated();
218+
if (contribTable.getCellEditor() != null) {
219+
contribTable.getCellEditor().stopCellEditing();
220+
}
221+
getContribModel().update();
210222
} catch (Exception e) {
211223
throw new RuntimeException(e);
212224
} finally {

0 commit comments

Comments
 (0)