use of org.bndtools.api.ModelListener in project bndtools by bndtools.
the class Central method refreshPlugins.
public static void refreshPlugins() throws Exception {
List<File> refreshedFiles = new ArrayList<File>();
List<Refreshable> rps = getWorkspace().getPlugins(Refreshable.class);
boolean changed = false;
boolean repoChanged = false;
for (Refreshable rp : rps) {
if (rp.refresh()) {
changed = true;
File root = rp.getRoot();
if (root != null)
refreshedFiles.add(root);
if (rp instanceof RepositoryPlugin) {
repoChanged = true;
}
}
}
if (changed) {
try {
for (File file : refreshedFiles) {
refreshFile(file);
}
for (Project p : Central.getWorkspace().getAllProjects()) {
p.setChanged();
for (ModelListener l : getInstance().listeners) l.modelChanged(p);
}
if (repoChanged) {
repositoriesViewRefresher.repositoriesRefreshed();
}
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}
}
Aggregations