use of org.eclipse.core.resources.IResourceDelta in project bndtools by bndtools.
the class BundleCalculatedImportsPart method resourceChanged.
@Override
public void resourceChanged(IResourceChangeEvent event) {
IFile file = getEditorFile();
if (file != null) {
IResourceDelta delta = event.getDelta();
delta = delta.findMember(file.getFullPath());
if (delta != null) {
IFormPage page = (IFormPage) getManagedForm().getContainer();
if (page.isActive())
refresh();
else
markStale();
}
}
}
use of org.eclipse.core.resources.IResourceDelta in project bndtools by bndtools.
the class PackageInfoEditor method resourceChanged.
public void resourceChanged(IResourceChangeEvent event) {
IResource resource = ResourceUtil.getResource(getEditorInput());
IResourceDelta delta = event.getDelta();
if (delta == null)
return;
IPath path = resource.getFullPath();
delta = delta.findMember(path);
if (delta == null)
return;
if ((delta.getFlags() & IResourceDelta.MARKERS) != 0)
SWTConcurrencyUtil.execForControl(getEditorSite().getShell(), true, new Runnable() {
public void run() {
updateTitleIcon();
}
});
}
use of org.eclipse.core.resources.IResourceDelta in project bndtools by bndtools.
the class CnfWatcher method processEvent.
private void processEvent(IResourceChangeEvent event) {
try {
final Workspace workspace = Central.getWorkspaceIfPresent();
if (workspace == null) {
// this can happen during first project creation in an empty workspace
logger.logInfo("Unable to get workspace", null);
return;
}
final IProject cnfProject = WorkspaceUtils.findCnfProject(ResourcesPlugin.getWorkspace().getRoot(), workspace);
if (cnfProject == null)
return;
IResourceDelta delta = event.getDelta();
if (delta.findMember(cnfProject.getFullPath()) == null)
return;
Collection<Project> allProjects = workspace.getAllProjects();
if (allProjects.isEmpty())
return;
Project p = allProjects.iterator().next();
DeltaWrapper dw = new DeltaWrapper(p, delta, new BuildLogger(0));
if (dw.hasCnfChanged()) {
workspace.clear();
workspace.forceRefresh();
workspace.getPlugins();
BndtoolsBuilder.dirty.addAll(allProjects);
WorkspaceJob j = new WorkspaceJob("Update errors on workspace") {
@Override
public IStatus runInWorkspace(IProgressMonitor arg0) throws CoreException {
try {
MarkerSupport ms = new MarkerSupport(cnfProject);
ms.deleteMarkers("*");
ms.setMarkers(workspace, BndtoolsConstants.MARKER_BND_WORKSPACE_PROBLEM);
return Status.OK_STATUS;
} catch (Exception e) {
return new Status(IStatus.ERROR, BndtoolsBuilder.PLUGIN_ID, "updating errors for workspace", e);
}
}
};
j.schedule();
}
} catch (Exception e) {
logger.logError("Detecting changes in cnf failed, ignoring", e);
}
}
Aggregations