Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorMikhail Sennikovsky2005-07-14 09:23:10 +0000
committerMikhail Sennikovsky2005-07-14 09:23:10 +0000
commitbc2e0cf0d66114ef96f87fcb3f2cdaf0829f4923 (patch)
treec3b72da3166de4ef990d2c7d03de37371e36212f /build
parent6b4de43eebdf229c44a6cc9e09b186a2594cd95b (diff)
downloadorg.eclipse.cdt-bc2e0cf0d66114ef96f87fcb3f2cdaf0829f4923.tar.gz
org.eclipse.cdt-bc2e0cf0d66114ef96f87fcb3f2cdaf0829f4923.tar.xz
org.eclipse.cdt-bc2e0cf0d66114ef96f87fcb3f2cdaf0829f4923.zip
Fix for the bug# 103372 for the 3.0
Diffstat (limited to 'build')
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuilderCorePlugin.java66
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties3
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ResourceChangeHandler.java2
3 files changed, 65 insertions, 6 deletions
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuilderCorePlugin.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuilderCorePlugin.java
index 4ae7b625384..2945efda446 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuilderCorePlugin.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuilderCorePlugin.java
@@ -10,15 +10,24 @@
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.core;
+import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.managedbuilder.internal.core.GeneratedMakefileBuilder;
+import org.eclipse.cdt.managedbuilder.internal.core.ManagedMakeMessages;
import org.eclipse.cdt.managedbuilder.internal.core.ResourceChangeHandler;
import org.eclipse.cdt.managedbuilder.internal.scannerconfig.ManagedBuildCPathEntryContainer;
import org.eclipse.cdt.managedbuilder.internal.scannerconfig.ManagedBuildPathEntryContainerInitializer;
import org.eclipse.core.resources.IResourceChangeEvent;
import org.eclipse.core.resources.ISavedState;
+import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.IJobManager;
+import org.eclipse.core.runtime.jobs.Job;
import org.osgi.framework.BundleContext;
// NOTE: The code below is for tracking resource renaming and deleting. This is needed to keep
// ResourceConfiguration elements up to date. It may also be needed by AdditionalInput
@@ -78,16 +87,61 @@ public class ManagedBuilderCorePlugin extends Plugin {
// ResourceConfiguration elements up to date. It may also be needed by AdditionalInput
// elements
+ IJobManager jobManager = Platform.getJobManager();
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ try {
+ jobManager.beginRule(root, null);
+
+ startResourceChangeHandling();
+ } catch (Exception e) {
+ //either an IllegalArgumentException is thrown by the jobManager.beginRule
+ //or core exception is thrown by the startResourceChangeHandling()
+ //in any case, schedule a job with the root rule
+ //that will perform the resource change handling initialization
+
+ Job rcJob = new Job(ManagedMakeMessages.getResourceString("ManagedBuilderCorePlugin.resourceChangeHandlingInitializationJob")){ //$NON-NLS-1$
+ protected IStatus run(IProgressMonitor monitor) {
+ try{
+ startResourceChangeHandling();
+ } catch (CoreException e){
+ CCorePlugin.log(e);
+ return e.getStatus();
+ }
+ return new Status(
+ IStatus.OK,
+ ManagedBuilderCorePlugin.getUniqueIdentifier(),
+ IStatus.OK,
+ new String(),
+ null);
+ }
+ };
+
+ rcJob.setRule(root);
+ rcJob.setPriority(Job.INTERACTIVE);
+ rcJob.schedule();
+
+ } finally {
+ jobManager.endRule(root);
+ }
+ }
+
+ /*
+ * This method adds a save participant and resource change listener
+ * Throws CoreException if the methods fails to add a save participant.
+ * The resource change listener in not added in this case either.
+ */
+ private void startResourceChangeHandling() throws CoreException{
// Set up a listener for resource change events
listener = new ResourceChangeHandler();
+ ISavedState lastState =
+ ResourcesPlugin.getWorkspace().addSaveParticipant(ManagedBuilderCorePlugin.this, listener);
+
ResourcesPlugin.getWorkspace().addResourceChangeListener(
- listener, IResourceChangeEvent.POST_CHANGE | IResourceChangeEvent.PRE_DELETE /*| IResourceChangeEvent.POST_BUILD*/);
- ISavedState lastState =
- ResourcesPlugin.getWorkspace().addSaveParticipant(this, listener);
- if (lastState != null) {
- lastState.processResourceChangeEvents(listener);
- }
+ listener, IResourceChangeEvent.POST_CHANGE | IResourceChangeEvent.PRE_DELETE /*| IResourceChangeEvent.POST_BUILD*/);
+ if (lastState != null) {
+ lastState.processResourceChangeEvents(listener);
+ }
}
/* (non-Javadoc)
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties
index 6c8ffdae2fb..7f239dbe270 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties
@@ -103,3 +103,6 @@ BuildMacroStatus.value.undefined=
#ResourceChangeHandler messages
ResourceChangeHandler.buildInfoSerializationJob=Build Info Serialization
+
+#ManagedBuilderCorePlugin messages
+ManagedBuilderCorePlugin.resourceChangeHandlingInitializationJob=Initializing Resource Change Handling \ No newline at end of file
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ResourceChangeHandler.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ResourceChangeHandler.java
index 1cb791f8126..84ca6edd0fa 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ResourceChangeHandler.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ResourceChangeHandler.java
@@ -388,6 +388,7 @@ public class ResourceChangeHandler implements IResourceChangeListener, ISavePart
config.removeResourceConfiguration(rcCfg);
rcCfg.setResourcePath(newPath.toString());
((Configuration)config).addResourceConfiguration((ResourceConfiguration)rcCfg);
+ config.setRebuildState(true);
return true;
}
return false;
@@ -397,6 +398,7 @@ public class ResourceChangeHandler implements IResourceChangeListener, ISavePart
IResourceConfiguration rcCfg = config.getResourceConfiguration(path.toString());
if(rcCfg != null){
config.removeResourceConfiguration(rcCfg);
+ config.setRebuildState(true);
return true;
}
return false;

Back to the top