mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-20 23:45: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);
|
// project.refreshLocal(IResource.DEPTH_INFINITE, null);
|
||||||
|
|
||||||
// use the refresh scope manager to refresh
|
// use the refresh scope manager to refresh
|
||||||
IWorkspaceRunnable runnable = RefreshScopeManager.getInstance().getRefreshRunnable(project);
|
RefreshScopeManager refreshManager = RefreshScopeManager.getInstance();
|
||||||
ResourcesPlugin.getWorkspace().run(runnable, null);
|
IWorkspaceRunnable runnable = refreshManager.getRefreshRunnable(project);
|
||||||
|
ResourcesPlugin.getWorkspace().run(runnable, refreshManager.getRefreshSchedulingRule(project), IWorkspace.AVOID_UPDATE, null);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
MakeCorePlugin.log(e);
|
MakeCorePlugin.log(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -202,8 +202,9 @@ public class ExternalBuildRunner extends AbstractBuildRunner {
|
||||||
//project.refreshLocal(IResource.DEPTH_INFINITE, null);
|
//project.refreshLocal(IResource.DEPTH_INFINITE, null);
|
||||||
|
|
||||||
// use the refresh scope manager to refresh
|
// use the refresh scope manager to refresh
|
||||||
IWorkspaceRunnable runnable = RefreshScopeManager.getInstance().getRefreshRunnable(project);
|
RefreshScopeManager refreshManager = RefreshScopeManager.getInstance();
|
||||||
ResourcesPlugin.getWorkspace().run(runnable, null);
|
IWorkspaceRunnable runnable = refreshManager.getRefreshRunnable(project);
|
||||||
|
ResourcesPlugin.getWorkspace().run(runnable, refreshManager.getRefreshSchedulingRule(project), IWorkspace.AVOID_UPDATE, null);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1110,8 +1110,9 @@ public class GeneratedMakefileBuilder extends ACBuilder {
|
||||||
//currentProject.refreshLocal(IResource.DEPTH_INFINITE, null);
|
//currentProject.refreshLocal(IResource.DEPTH_INFINITE, null);
|
||||||
|
|
||||||
// use the refresh scope manager to refresh
|
// use the refresh scope manager to refresh
|
||||||
IWorkspaceRunnable runnable = RefreshScopeManager.getInstance().getRefreshRunnable(currentProject);
|
RefreshScopeManager refreshManager = RefreshScopeManager.getInstance();
|
||||||
ResourcesPlugin.getWorkspace().run(runnable, null);
|
IWorkspaceRunnable runnable = refreshManager.getRefreshRunnable(currentProject);
|
||||||
|
ResourcesPlugin.getWorkspace().run(runnable, refreshManager.getRefreshSchedulingRule(currentProject), IWorkspace.AVOID_UPDATE, null);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
monitor.subTask(ManagedMakeMessages
|
monitor.subTask(ManagedMakeMessages
|
||||||
.getResourceString(REFRESH_ERROR));
|
.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.IFolder;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
|
import org.eclipse.core.resources.IWorkspace;
|
||||||
import org.eclipse.core.resources.IWorkspaceRoot;
|
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||||
import org.eclipse.core.resources.IWorkspaceRunnable;
|
import org.eclipse.core.resources.IWorkspaceRunnable;
|
||||||
import org.eclipse.core.resources.ResourcesPlugin;
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
|
@ -367,7 +368,7 @@ public class RefreshScopeTests extends TestCase {
|
||||||
// now refresh
|
// now refresh
|
||||||
IWorkspaceRunnable runnable = manager.getRefreshRunnable(fProject);
|
IWorkspaceRunnable runnable = manager.getRefreshRunnable(fProject);
|
||||||
try {
|
try {
|
||||||
ResourcesPlugin.getWorkspace().run(runnable, null);
|
ResourcesPlugin.getWorkspace().run(runnable, manager.getRefreshSchedulingRule(fProject), IWorkspace.AVOID_UPDATE, null);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
fail();
|
fail();
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ public class Messages extends NLS {
|
||||||
public static String RefreshScopeManager_1;
|
public static String RefreshScopeManager_1;
|
||||||
public static String RefreshScopeManager_2;
|
public static String RefreshScopeManager_2;
|
||||||
public static String RefreshScopeManager_3;
|
public static String RefreshScopeManager_3;
|
||||||
|
public static String RefreshScopeManager_4;
|
||||||
public static String ResourceExclusion_name;
|
public static String ResourceExclusion_name;
|
||||||
static {
|
static {
|
||||||
// initialize resource bundle
|
// initialize resource bundle
|
||||||
|
|
|
@ -36,6 +36,10 @@ import org.eclipse.core.runtime.IExtension;
|
||||||
import org.eclipse.core.runtime.IExtensionPoint;
|
import org.eclipse.core.runtime.IExtensionPoint;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.Platform;
|
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
|
* The RefreshScopeManager provides access to settings pertaining to refreshes performed during
|
||||||
|
@ -114,8 +118,8 @@ public class RefreshScopeManager {
|
||||||
IProject project = (IProject) delta.getResource();
|
IProject project = (IProject) delta.getResource();
|
||||||
|
|
||||||
if (delta.getKind() == IResourceDelta.ADDED
|
if (delta.getKind() == IResourceDelta.ADDED
|
||||||
|| (delta.getKind() == IResourceDelta.CHANGED && (delta
|
|| (delta.getKind() == IResourceDelta.CHANGED && ((delta.getFlags() & IResourceDelta.OPEN) != 0)
|
||||||
.getFlags() & IResourceDelta.OPEN) != 0)) {
|
&& ((delta.getFlags() & IResourceDelta.REMOVED) != 0))) /* don't load for deleted projects */{
|
||||||
loadSettings(ResourcesPlugin.getWorkspace()
|
loadSettings(ResourcesPlugin.getWorkspace()
|
||||||
.getRoot(), project);
|
.getRoot(), project);
|
||||||
return false;
|
return false;
|
||||||
|
@ -399,6 +403,11 @@ public class RefreshScopeManager {
|
||||||
if (project.hasNature(CProjectNature.C_NATURE_ID)) {
|
if (project.hasNature(CProjectNature.C_NATURE_ID)) {
|
||||||
ICProjectDescription projectDescription = CProjectDescriptionManager.getInstance()
|
ICProjectDescription projectDescription = CProjectDescriptionManager.getInstance()
|
||||||
.getProjectDescription(project, false);
|
.getProjectDescription(project, false);
|
||||||
|
|
||||||
|
if(projectDescription == null) {
|
||||||
|
throw new CoreException(CCorePlugin.createStatus(MessageFormat.format(Messages.RefreshScopeManager_4, project.getName())));
|
||||||
|
}
|
||||||
|
|
||||||
ICStorageElement storageElement = projectDescription.getStorage(
|
ICStorageElement storageElement = projectDescription.getStorage(
|
||||||
REFRESH_SCOPE_STORAGE_NAME, true);
|
REFRESH_SCOPE_STORAGE_NAME, true);
|
||||||
|
|
||||||
|
@ -499,8 +508,11 @@ public class RefreshScopeManager {
|
||||||
return factory.createNewExclusionInstance();
|
return factory.createNewExclusionInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IWorkspaceRunnable getRefreshRunnable(final IProject project) {
|
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() {
|
IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
|
||||||
|
|
||||||
|
|
|
@ -13,5 +13,6 @@ RefreshScopeManager_0=Error instantiating XML document builder.
|
||||||
RefreshScopeManager_1=Error instantiating XML transformer.
|
RefreshScopeManager_1=Error instantiating XML transformer.
|
||||||
RefreshScopeManager_2=Error transforming XML.
|
RefreshScopeManager_2=Error transforming XML.
|
||||||
RefreshScopeManager_3=Error parsing refresh settings from project {0}
|
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
|
ResourceExclusion_name=Resource Exclusions
|
||||||
|
|
Loading…
Add table
Reference in a new issue