Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(564)

Side by Side Diff: editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/analysis/model/WorkspaceDeltaProcessor.java

Issue 252703004: Rollback CL 240003005, causes deleting contexts after marker operations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 package com.google.dart.tools.core.internal.analysis.model; 1 package com.google.dart.tools.core.internal.analysis.model;
2 2
3 import com.google.dart.engine.context.AnalysisContext; 3 import com.google.dart.engine.context.AnalysisContext;
4 import com.google.dart.tools.core.DartCore; 4 import com.google.dart.tools.core.DartCore;
5 import com.google.dart.tools.core.analysis.model.Project; 5 import com.google.dart.tools.core.analysis.model.Project;
6 import com.google.dart.tools.core.analysis.model.ProjectManager; 6 import com.google.dart.tools.core.analysis.model.ProjectManager;
7 import com.google.dart.tools.core.internal.builder.AnalysisWorker; 7 import com.google.dart.tools.core.internal.builder.AnalysisWorker;
8 import com.google.dart.tools.core.internal.builder.DeltaProcessor;
9 import com.google.dart.tools.core.internal.builder.IgnoreResourceFilter;
10 import com.google.dart.tools.core.internal.builder.IndexUpdater;
11 import com.google.dart.tools.core.internal.builder.ProjectUpdater;
8 12
9 import org.eclipse.core.resources.IProject; 13 import org.eclipse.core.resources.IProject;
10 import org.eclipse.core.resources.IResource; 14 import org.eclipse.core.resources.IResource;
11 import org.eclipse.core.resources.IResourceChangeEvent; 15 import org.eclipse.core.resources.IResourceChangeEvent;
12 import org.eclipse.core.resources.IResourceChangeListener; 16 import org.eclipse.core.resources.IResourceChangeListener;
13 import org.eclipse.core.resources.IResourceDelta; 17 import org.eclipse.core.resources.IResourceDelta;
14 import org.eclipse.core.resources.IResourceDeltaVisitor; 18 import org.eclipse.core.resources.IResourceDeltaVisitor;
15 import org.eclipse.core.runtime.CoreException; 19 import org.eclipse.core.runtime.CoreException;
16 20
17 /** 21 /**
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 return true; 53 return true;
50 54
51 } else if (res.getType() == IResource.PROJECT) { 55 } else if (res.getType() == IResource.PROJECT) {
52 if (delta.getKind() == IResourceDelta.REMOVED) { 56 if (delta.getKind() == IResourceDelta.REMOVED) {
53 manager.projectRemoved((IProject) res); 57 manager.projectRemoved((IProject) res);
54 return false; 58 return false;
55 } 59 }
56 return true; 60 return true;
57 61
58 } else if (res.getType() == IResource.FOLDER) { 62 } else if (res.getType() == IResource.FOLDER) {
59 if (res.getName().equals(DartCore.PACKAGES_DIRECTORY_NAME) 63 if (res.getName().equals(DartCore.PACKAGES_DIRECTORY_NAME)) {
60 && (res.getParent().findMember(DartCore.PUBSPEC_FILE_NAME) != null)) {
61 64
62 // The builder is not notified about changes in symlinked folder s (e.g. packages) 65 // The builder is not notified about changes in symlinked folder s (e.g. packages)
63 // The context needs the delta of changes, what has to be remove d and also added. 66 // thus we traverse those changes here using the same mechanism as the builder
64 // Since at this point there is no knowledge of previous package details, do a
65 // reanalyze for the context
66 Project project = manager.getProject(res.getProject()); 67 Project project = manager.getProject(res.getProject());
67 project.discardContextsIn(res.getParent()); 68 ProjectUpdater updater = new ProjectUpdater();
69 IndexUpdater indexUpdater = new IndexUpdater(manager.getIndex()) ;
70 DeltaProcessor processor = new DeltaProcessor(project);
71 IgnoreResourceFilter filter = new IgnoreResourceFilter();
72 filter.addDeltaListener(updater);
73 filter.addDeltaListener(indexUpdater);
74 processor.addDeltaListener(filter);
75 processor.traverse(delta);
76 updater.applyChanges();
77 AnalysisContext context = manager.getContext(res);
78 startBackgroundAnalysis(project, context);
68 return false; 79 return false;
69 } 80 }
70 return true; 81 return true;
71 82
72 } else { 83 } else {
73 return false; 84 return false;
74 } 85 }
75 } 86 }
76 }); 87 });
77 } catch (CoreException e) { 88 } catch (CoreException e) {
78 DartCore.logError(e); 89 DartCore.logError(e);
79 } 90 }
80 } 91 }
81 } 92 }
82 93
83 /** 94 /**
84 * Kick off a background analysis worker for the given context. 95 * Kick off a background analysis worker for the given context.
85 * 96 *
86 * @param project the project (not {@code null}) containing the context 97 * @param project the project (not {@code null}) containing the context
87 * @param context the context to be analyzed (not {@code null}) 98 * @param context the context to be analyzed (not {@code null})
88 */ 99 */
89 protected void startBackgroundAnalysis(Project project, AnalysisContext contex t) { 100 protected void startBackgroundAnalysis(Project project, AnalysisContext contex t) {
90 new AnalysisWorker(project, context).performAnalysisInBackground(); 101 new AnalysisWorker(project, context).performAnalysisInBackground();
91 } 102 }
92 } 103 }
OLDNEW
« no previous file with comments | « no previous file | editor/tools/plugins/com.google.dart.tools.core_test/src/com/google/dart/tools/core/internal/analysis/model/WorkspaceDeltaProcessorTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698