| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library context.directory.manager; | 5 library context.directory.manager; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 | 9 |
| 10 import 'package:analysis_server/src/resource.dart'; | 10 import 'package:analysis_server/src/resource.dart'; |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 ChangeSet changeSet = new ChangeSet(); | 130 ChangeSet changeSet = new ChangeSet(); |
| 131 changeSet.removedSource(source); | 131 changeSet.removedSource(source); |
| 132 applyChangesToContext(folder, changeSet); | 132 applyChangesToContext(folder, changeSet); |
| 133 info.sources.remove(event.path); | 133 info.sources.remove(event.path); |
| 134 } | 134 } |
| 135 break; | 135 break; |
| 136 case ChangeType.MODIFY: | 136 case ChangeType.MODIFY: |
| 137 Source source = info.sources[event.path]; | 137 Source source = info.sources[event.path]; |
| 138 if (source != null) { | 138 if (source != null) { |
| 139 ChangeSet changeSet = new ChangeSet(); | 139 ChangeSet changeSet = new ChangeSet(); |
| 140 // TODO(paulberry): technically we should skip calling changedSource() | |
| 141 // for files that currently have their contents overridden. However, | |
| 142 // it's hard to figure out which files have their contents overridden | |
| 143 // (this info isn't exposed through the AnalysisContext interface), | |
| 144 // and besides, if we go ahead and call changedSource() we get the | |
| 145 // behavior we want (the context continues consulting the overridden | |
| 146 // file contents). | |
| 147 changeSet.changedSource(source); | 140 changeSet.changedSource(source); |
| 148 applyChangesToContext(folder, changeSet); | 141 applyChangesToContext(folder, changeSet); |
| 149 } | 142 } |
| 150 break; | 143 break; |
| 151 } | 144 } |
| 152 } | 145 } |
| 153 | 146 |
| 154 /** | 147 /** |
| 155 * Determine if the path from [folder] to [path] contains a 'packages' | 148 * Determine if the path from [folder] to [path] contains a 'packages' |
| 156 * directory. | 149 * directory. |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 * some of those files have been modified). [changeSet] is the set of | 199 * some of those files have been modified). [changeSet] is the set of |
| 207 * changes that need to be applied to the context. | 200 * changes that need to be applied to the context. |
| 208 */ | 201 */ |
| 209 void applyChangesToContext(Folder contextFolder, ChangeSet changeSet); | 202 void applyChangesToContext(Folder contextFolder, ChangeSet changeSet); |
| 210 | 203 |
| 211 /** | 204 /** |
| 212 * Remove the context associated with the given [folder]. | 205 * Remove the context associated with the given [folder]. |
| 213 */ | 206 */ |
| 214 void removeContext(Folder folder); | 207 void removeContext(Folder folder); |
| 215 } | 208 } |
| OLD | NEW |