Skip to content

Commit

Permalink
Boards Manager: update UI after an install/remove
Browse files Browse the repository at this point in the history
  • Loading branch information
cmaglie committed Jul 23, 2020
1 parent 1361bce commit a81772a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,17 @@ public class ContributionIndexTableModel
private final List<ContributedPlatformReleases> contributions = new ArrayList<>();
private final String[] columnNames = { "Description" };
private final Class<?>[] columnTypes = { ContributedPlatform.class };
private Predicate<ContributedPlatform> filter;
private String[] filters;

public void updateIndexFilter(String[] filters,
Predicate<ContributedPlatform> filter) {
this.filter = filter;
this.filters = filters;
updateContributions();
}

private void updateContributions() {
contributions.clear();
for (ContributedPackage pack : BaseNoGui.indexer.getPackages()) {
for (ContributedPlatform platform : pack.getPlatforms()) {
Expand Down Expand Up @@ -146,6 +154,7 @@ public ContributedPlatform getSelectedRelease(int row) {
}

public void update() {
updateContributions();
fireTableDataChanged();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ public void onUpdatePressed() {
.updateIndex(this::setProgress);
installer.deleteUnknownFiles(downloadedPackageIndexFiles);
onIndexesUpdated();
if (contribTable.getCellEditor() != null) {
contribTable.getCellEditor().stopCellEditing();
}
getContribModel().update();
} catch (Exception e) {
throw new RuntimeException(e);
} finally {
Expand All @@ -169,6 +173,10 @@ public void onInstallPressed(final ContributedPlatform platformToInstall,
}
errors.addAll(installer.install(platformToInstall, this::setProgress));
onIndexesUpdated();
if (contribTable.getCellEditor() != null) {
contribTable.getCellEditor().stopCellEditing();
}
getContribModel().update();
} catch (Exception e) {
throw new RuntimeException(e);
} finally {
Expand Down Expand Up @@ -207,6 +215,10 @@ public void onRemovePressed(final ContributedPlatform platform,
setProgressVisible(true, tr("Removing..."));
installer.remove(platform);
onIndexesUpdated();
if (contribTable.getCellEditor() != null) {
contribTable.getCellEditor().stopCellEditing();
}
getContribModel().update();
} catch (Exception e) {
throw new RuntimeException(e);
} finally {
Expand Down

0 comments on commit a81772a

Please sign in to comment.