Last active
January 14, 2022 14:52
-
-
Save NicoKiaru/ec7022acf1967e89e14880a7b8b7d911 to your computer and use it in GitHub Desktop.
How to investigate the list of Update Sites enabled #BIOP #Fiji #UpdateSites
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Simple script demoing how to check if an update site is enabled | |
* and how to list all enabled update sites | |
* | |
* @author Nicolas Chiaruttini | |
* BIOP, EPFL, 2022 | |
**/ | |
#@UpdateService updateService | |
// To check if an update site is enabled: | |
if (!updateService.getUpdateSite("Fiji-Legacy").isActive()) { | |
println("Fiji-legacy is NOT enabled") | |
} else { | |
println("Fiji-Legacy is enabled") | |
} | |
if (!updateService.getUpdateSite("PTBIOP").isActive()) { | |
println("PTBIOP is NOT enabled") | |
} else { | |
println("PTBIOP is enabled") | |
} | |
// Get the list of all update sites: | |
def Map<String, UpdateSite> sites = AvailableSites.getAvailableSites(); | |
StringBuilder enable_sites_string = new StringBuilder(); | |
sites.values().stream() | |
.filter(site -> updateService.getUpdateSite(site.getName()).isActive()) | |
.forEach(site -> { | |
enable_sites_string.append("\t"+site.getName()+"\t"+site.getURL()+"\n"); | |
}); | |
println("Update sites enabled:") | |
println(enable_sites_string) | |
import net.imagej.updater.UpdateService | |
import net.imagej.updater.UpdateSite | |
import net.imagej.updater.util.AvailableSites |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment