forked from j62/ctbrec
1
0
Fork 0

Add manual refresh to context menu of thumb overviews

This commit is contained in:
0xboobface 2019-12-31 15:14:55 +01:00
parent 46797a8467
commit 127ed0ab91
1 changed files with 12 additions and 1 deletions

View File

@ -444,6 +444,9 @@ public class ThumbOverviewTab extends Tab implements TabSelectionListener {
MenuItem ignore = new MenuItem("Ignore");
ignore.setOnAction(e -> ignore(getSelectedThumbCells(cell)));
MenuItem refresh = new MenuItem("Refresh");
refresh.setOnAction(e -> refresh());
MenuItem copyUrl = createCopyUrlMenuItem(cell);
MenuItem sendTip = createTipMenuItem(cell);
@ -465,7 +468,7 @@ public class ThumbOverviewTab extends Tab implements TabSelectionListener {
if(site.supportsTips()) {
contextMenu.getItems().add(sendTip);
}
contextMenu.getItems().addAll(copyUrl, ignore);
contextMenu.getItems().addAll(copyUrl, refresh);
if(cell.getModel() instanceof MyFreeCamsModel && Objects.equals(System.getenv("CTBREC_DEV"), "1")) {
MenuItem debug = new MenuItem("debug");
debug.setOnAction(e -> MyFreeCamsClient.getInstance().getSessionState(cell.getModel()));
@ -474,6 +477,14 @@ public class ThumbOverviewTab extends Tab implements TabSelectionListener {
return contextMenu;
}
private void refresh() {
if (updateService.isRunning()) {
updateService.cancel();
updateService.reset();
updateService.restart();
}
}
/* check, if other cells are selected, too. in that case, we have to disable menu items, which make sense only for
* single selections. but only do that, if the popup has been triggered on a selected cell. otherwise remove the
* selection and show the normal menu