Skip to content

Commit

Permalink
Merge pull request #6435 from chrisrueger/improve-mvn-refetch-after-c…
Browse files Browse the repository at this point in the history
…acheclear

Add Refresh Cache (with re-download) context menue to RepoBrowser / BundleRevsion
  • Loading branch information
chrisrueger authored Jan 22, 2025
2 parents d792d3e + 2adf05d commit ce3563b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

class RepoActions {

private MavenBndRepository repo;
private MavenBndRepository repo;
private MbrUpdater mbr;

RepoActions(MavenBndRepository mavenBndRepository) {
Expand Down Expand Up @@ -84,6 +84,23 @@ Map<String, Runnable> getProgramActions(final String bsn) throws Exception {

Map<String, Runnable> getRevisionActions(final Archive archive, final Clipboard clipboard) throws Exception {
Map<String, Runnable> map = new LinkedHashMap<>();

map.put("Refresh Cache (re-download)", () -> {

File dir = repo.storage.toLocalFile(archive)
.getParentFile();
IO.delete(dir);

try {
// try re-download
Promise<File> promise = repo.storage.get(archive, true);
promise.getValue();

} catch (Exception e) {
throw Exceptions.duck(e);
}

});
map.put("Clear from Cache", () -> {
File dir = repo.storage.toLocalFile(archive)
.getParentFile();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public Map<String, Runnable> actions(Object... target) throws Exception {
map = ((Actionable) bundle.getRepo()).actions(bundle.getBsn(), version);
}
} catch (Exception e) {
e.printStackTrace();
// just default
}
return map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ private void createContent(Composite parent, FormToolkit toolkit) {
toolkit.createLabel(encodingPanel, "Size");
size = new Text(encodingPanel, SWT.READ_ONLY);

toolkit.createLabel(encodingPanel, "Last Modfied");
toolkit.createLabel(encodingPanel, "Last Modified");
lastModified = new Text(encodingPanel, SWT.READ_ONLY);

toolkit.createLabel(encodingPanel, "Show As:");
Expand Down

0 comments on commit ce3563b

Please sign in to comment.