Search in sources :

Example 1 with ModelListener

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);
        }
    }
}
Also used : IJavaProject(org.eclipse.jdt.core.IJavaProject) IProject(org.eclipse.core.resources.IProject) Project(aQute.bnd.build.Project) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) ArrayList(java.util.ArrayList) ModelListener(org.bndtools.api.ModelListener) RepositoryPlugin(aQute.bnd.service.RepositoryPlugin) Refreshable(aQute.bnd.service.Refreshable) IFile(org.eclipse.core.resources.IFile) File(java.io.File) TimeoutException(java.util.concurrent.TimeoutException) CoreException(org.eclipse.core.runtime.CoreException)

Aggregations

Project (aQute.bnd.build.Project)1 Refreshable (aQute.bnd.service.Refreshable)1 RepositoryPlugin (aQute.bnd.service.RepositoryPlugin)1 File (java.io.File)1 ArrayList (java.util.ArrayList)1 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)1 TimeoutException (java.util.concurrent.TimeoutException)1 ModelListener (org.bndtools.api.ModelListener)1 IFile (org.eclipse.core.resources.IFile)1 IProject (org.eclipse.core.resources.IProject)1 CoreException (org.eclipse.core.runtime.CoreException)1 IJavaProject (org.eclipse.jdt.core.IJavaProject)1