mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-19 06:55:23 +02:00
Bug 133881 - Make refreshing after building optional
- changed scheduling rules for refreshes to be the set of resources to be refreshed for a given project
This commit is contained in:
parent
04e7974825
commit
af28c6569c
7 changed files with 28 additions and 10 deletions
|
@ -299,8 +299,9 @@ public class MakeBuilder extends ACBuilder {
|
|||
// project.refreshLocal(IResource.DEPTH_INFINITE, null);
|
||||
|
||||
// use the refresh scope manager to refresh
|
||||
IWorkspaceRunnable runnable = RefreshScopeManager.getInstance().getRefreshRunnable(project);
|
||||
ResourcesPlugin.getWorkspace().run(runnable, null);
|
||||
RefreshScopeManager refreshManager = RefreshScopeManager.getInstance();
|
||||
IWorkspaceRunnable runnable = refreshManager.getRefreshRunnable(project);
|
||||
ResourcesPlugin.getWorkspace().run(runnable, refreshManager.getRefreshSchedulingRule(project), IWorkspace.AVOID_UPDATE, null);
|
||||
} catch (CoreException e) {
|
||||
MakeCorePlugin.log(e);
|
||||
}
|
||||
|
|
|
@ -202,8 +202,9 @@ public class ExternalBuildRunner extends AbstractBuildRunner {
|
|||
//project.refreshLocal(IResource.DEPTH_INFINITE, null);
|
||||
|
||||
// use the refresh scope manager to refresh
|
||||
IWorkspaceRunnable runnable = RefreshScopeManager.getInstance().getRefreshRunnable(project);
|
||||
ResourcesPlugin.getWorkspace().run(runnable, null);
|
||||
RefreshScopeManager refreshManager = RefreshScopeManager.getInstance();
|
||||
IWorkspaceRunnable runnable = refreshManager.getRefreshRunnable(project);
|
||||
ResourcesPlugin.getWorkspace().run(runnable, refreshManager.getRefreshSchedulingRule(project), IWorkspace.AVOID_UPDATE, null);
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -1110,8 +1110,9 @@ public class GeneratedMakefileBuilder extends ACBuilder {
|
|||
//currentProject.refreshLocal(IResource.DEPTH_INFINITE, null);
|
||||
|
||||
// use the refresh scope manager to refresh
|
||||
IWorkspaceRunnable runnable = RefreshScopeManager.getInstance().getRefreshRunnable(currentProject);
|
||||
ResourcesPlugin.getWorkspace().run(runnable, null);
|
||||
RefreshScopeManager refreshManager = RefreshScopeManager.getInstance();
|
||||
IWorkspaceRunnable runnable = refreshManager.getRefreshRunnable(currentProject);
|
||||
ResourcesPlugin.getWorkspace().run(runnable, refreshManager.getRefreshSchedulingRule(currentProject), IWorkspace.AVOID_UPDATE, null);
|
||||
} catch (CoreException e) {
|
||||
monitor.subTask(ManagedMakeMessages
|
||||
.getResourceString(REFRESH_ERROR));
|
||||
|
|
|
@ -33,6 +33,7 @@ import org.eclipse.cdt.internal.core.resources.ResourceExclusion;
|
|||
import org.eclipse.core.resources.IFolder;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.IWorkspace;
|
||||
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||
import org.eclipse.core.resources.IWorkspaceRunnable;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
|
@ -367,7 +368,7 @@ public class RefreshScopeTests extends TestCase {
|
|||
// now refresh
|
||||
IWorkspaceRunnable runnable = manager.getRefreshRunnable(fProject);
|
||||
try {
|
||||
ResourcesPlugin.getWorkspace().run(runnable, null);
|
||||
ResourcesPlugin.getWorkspace().run(runnable, manager.getRefreshSchedulingRule(fProject), IWorkspace.AVOID_UPDATE, null);
|
||||
} catch (CoreException e) {
|
||||
fail();
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ public class Messages extends NLS {
|
|||
public static String RefreshScopeManager_1;
|
||||
public static String RefreshScopeManager_2;
|
||||
public static String RefreshScopeManager_3;
|
||||
public static String RefreshScopeManager_4;
|
||||
public static String ResourceExclusion_name;
|
||||
static {
|
||||
// initialize resource bundle
|
||||
|
|
|
@ -36,6 +36,10 @@ import org.eclipse.core.runtime.IExtension;
|
|||
import org.eclipse.core.runtime.IExtensionPoint;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.core.runtime.jobs.ISchedulingRule;
|
||||
import org.eclipse.core.runtime.jobs.MultiRule;
|
||||
|
||||
import com.ibm.icu.text.MessageFormat;
|
||||
|
||||
/**
|
||||
* The RefreshScopeManager provides access to settings pertaining to refreshes performed during
|
||||
|
@ -114,8 +118,8 @@ public class RefreshScopeManager {
|
|||
IProject project = (IProject) delta.getResource();
|
||||
|
||||
if (delta.getKind() == IResourceDelta.ADDED
|
||||
|| (delta.getKind() == IResourceDelta.CHANGED && (delta
|
||||
.getFlags() & IResourceDelta.OPEN) != 0)) {
|
||||
|| (delta.getKind() == IResourceDelta.CHANGED && ((delta.getFlags() & IResourceDelta.OPEN) != 0)
|
||||
&& ((delta.getFlags() & IResourceDelta.REMOVED) != 0))) /* don't load for deleted projects */{
|
||||
loadSettings(ResourcesPlugin.getWorkspace()
|
||||
.getRoot(), project);
|
||||
return false;
|
||||
|
@ -399,6 +403,11 @@ public class RefreshScopeManager {
|
|||
if (project.hasNature(CProjectNature.C_NATURE_ID)) {
|
||||
ICProjectDescription projectDescription = CProjectDescriptionManager.getInstance()
|
||||
.getProjectDescription(project, false);
|
||||
|
||||
if(projectDescription == null) {
|
||||
throw new CoreException(CCorePlugin.createStatus(MessageFormat.format(Messages.RefreshScopeManager_4, project.getName())));
|
||||
}
|
||||
|
||||
ICStorageElement storageElement = projectDescription.getStorage(
|
||||
REFRESH_SCOPE_STORAGE_NAME, true);
|
||||
|
||||
|
@ -499,9 +508,12 @@ public class RefreshScopeManager {
|
|||
return factory.createNewExclusionInstance();
|
||||
}
|
||||
|
||||
public synchronized ISchedulingRule getRefreshSchedulingRule(IProject project) {
|
||||
return new MultiRule(getResourcesToRefresh(project).toArray(new ISchedulingRule[0]));
|
||||
}
|
||||
|
||||
public IWorkspaceRunnable getRefreshRunnable(final IProject project) {
|
||||
|
||||
|
||||
IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
|
||||
|
||||
public void run(IProgressMonitor monitor) throws CoreException {
|
||||
|
|
|
@ -13,5 +13,6 @@ RefreshScopeManager_0=Error instantiating XML document builder.
|
|||
RefreshScopeManager_1=Error instantiating XML transformer.
|
||||
RefreshScopeManager_2=Error transforming XML.
|
||||
RefreshScopeManager_3=Error parsing refresh settings from project {0}
|
||||
RefreshScopeManager_4=Error loading refresh settings: no project description for project {0}
|
||||
|
||||
ResourceExclusion_name=Resource Exclusions
|
||||
|
|
Loading…
Add table
Reference in a new issue