Permalink
Browse files

queue synchronize requests from editor

  • Loading branch information...
1 parent 02fdf16 commit 8dcd104ff2d26dccb21096b91b8079d842f61c2d @JPMoresmau committed Jun 8, 2012
@@ -86,6 +86,12 @@
* where ever we come from, we only launch one build operation at a time, and lose the intermediate operations
*/
private SingleJobQueue buildJobQueue=new SingleJobQueue();
+
+ /**
+ * where ever we come from, we only launch one synchronize operation per file at a time, and lose the intermediate operations
+ */
+ private Map<IFile,SingleJobQueue> syncEditorJobQueue=new HashMap<IFile, SingleJobQueue>();
+
/**
* query for thing at point for a given file, so that we never have more than two jobs at one time
*/
@@ -123,6 +129,15 @@ public synchronized SingleJobQueue getThingAtPointJobQueue(IFile f){
return sjq;
}
+ public synchronized SingleJobQueue getEditorSynchronizeQueue(IFile f){
+ SingleJobQueue sjq=syncEditorJobQueue.get(f);
+ if (sjq==null){
+ sjq=new SingleJobQueue();
+ syncEditorJobQueue.put(f,sjq);
+ }
+ return sjq;
+ }
+
private void deleteCabalProblems(){
String relCabal=getCabalFile().substring(getProject().getLocation().toOSString().length());
IFile f=getProject().getFile(relCabal);
@@ -6,6 +6,8 @@
package net.sf.eclipsefp.haskell.buildwrapper;
import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
import net.sf.eclipsefp.haskell.buildwrapper.types.BuildOptions;
import net.sf.eclipsefp.haskell.buildwrapper.types.Location;
@@ -17,6 +19,7 @@
import net.sf.eclipsefp.haskell.buildwrapper.types.ThingAtPointHandler;
import net.sf.eclipsefp.haskell.buildwrapper.usage.UsageThread;
import net.sf.eclipsefp.haskell.buildwrapper.util.BWText;
+import net.sf.eclipsefp.haskell.util.SingleJobQueue;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
@@ -39,7 +42,6 @@
*/
public class JobFacade {
private BWFacade realFacade;
-
public JobFacade(BWFacade realF){
@@ -235,7 +237,9 @@ protected IStatus run(IProgressMonitor monitor) {
IResource r=file.getProject().findMember(BWFacade.DIST_FOLDER+"/"+path);
buildJob.setRule( r );
buildJob.setPriority(Job.SHORT);
- buildJob.schedule();
+ SingleJobQueue sjq=realFacade.getEditorSynchronizeQueue(file);
+ sjq.addJob(buildJob);
+ //buildJob.schedule();
}
public void getOccurrences(final IFile file,final String token,final OccurrencesHandler handler){

0 comments on commit 8dcd104

Please sign in to comment.