Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Leherbauer2007-02-22 15:53:57 +0000
committerAnton Leherbauer2007-02-22 15:53:57 +0000
commit8233d713c906e5f7726e0f977f20b48cf3f85d0c (patch)
treec3250fe8770c6f71717df5776cd05ea270534f17
parentdb942775bb6b5cb21b5dbb1ac70fd8eaef127513 (diff)
downloadorg.eclipse.cdt-8233d713c906e5f7726e0f977f20b48cf3f85d0c.tar.gz
org.eclipse.cdt-8233d713c906e5f7726e0f977f20b48cf3f85d0c.tar.xz
org.eclipse.cdt-8233d713c906e5f7726e0f977f20b48cf3f85d0c.zip
Delay workingset check during bootstrap
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/CElementWorkingSetUpdater.java32
1 files changed, 28 insertions, 4 deletions
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/CElementWorkingSetUpdater.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/CElementWorkingSetUpdater.java
index ce61d5f311a..1c81401a36b 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/CElementWorkingSetUpdater.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/CElementWorkingSetUpdater.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -21,6 +21,10 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.ui.IWorkingSet;
import org.eclipse.ui.IWorkingSetUpdater;
@@ -34,6 +38,22 @@ import org.eclipse.cdt.core.model.IElementChangedListener;
public class CElementWorkingSetUpdater implements IWorkingSetUpdater, IElementChangedListener {
+ private static class WorkingSetCheck extends Job {
+ private final IWorkingSet fWorkingSet;
+ WorkingSetCheck(final IWorkingSet workingSet) {
+ super("Check WorkingSet"); //$NON-NLS-1$
+ fWorkingSet= workingSet;
+ }
+ /*
+ * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ protected IStatus run(IProgressMonitor monitor) {
+ checkElementExistence(fWorkingSet);
+ return Status.OK_STATUS;
+ }
+
+ }
+
public static final String ID= "org.eclipse.cdt.ui.CElementWorkingSetPage"; //$NON-NLS-1$
private List fWorkingSets;
@@ -73,11 +93,15 @@ public class CElementWorkingSetUpdater implements IWorkingSetUpdater, IElementCh
/**
* {@inheritDoc}
*/
- public void add(IWorkingSet workingSet) {
- checkElementExistence(workingSet);
+ public void add(final IWorkingSet workingSet) {
synchronized (fWorkingSets) {
fWorkingSets.add(workingSet);
}
+ // delay the check - this may be called very early in the bootstrap
+ Job check= new WorkingSetCheck(workingSet);
+ check.setUser(false);
+ check.setPriority(Job.SHORT);
+ check.schedule(1000);
}
/**
@@ -209,7 +233,7 @@ public class CElementWorkingSetUpdater implements IWorkingSetUpdater, IElementCh
&& (flags & IResourceDelta.OPEN) != 0;
}
- private void checkElementExistence(IWorkingSet workingSet) {
+ private static void checkElementExistence(IWorkingSet workingSet) {
List elements= new ArrayList(Arrays.asList(workingSet.getElements()));
boolean changed= false;
for (Iterator iter= elements.iterator(); iter.hasNext();) {

Back to the top