OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Dart project authors. | 2 * Copyright 2013 Dart project authors. |
3 * | 3 * |
4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except | 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except |
5 * in compliance with the License. You may obtain a copy of the License at | 5 * in compliance with the License. You may obtain a copy of the License at |
6 * | 6 * |
7 * http://www.eclipse.org/legal/epl-v10.html | 7 * http://www.eclipse.org/legal/epl-v10.html |
8 * | 8 * |
9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License | 9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License |
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express | 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 public void addProjectListener(ProjectListener listener) { | 133 public void addProjectListener(ProjectListener listener) { |
134 synchronized (listeners) { | 134 synchronized (listeners) { |
135 if (listener != null && !listeners.contains(listener)) { | 135 if (listener != null && !listeners.contains(listener)) { |
136 listeners.add(listener); | 136 listeners.add(listener); |
137 } | 137 } |
138 } | 138 } |
139 } | 139 } |
140 | 140 |
141 @Override | 141 @Override |
142 public AnalysisContext getContext(IResource resource) { | 142 public AnalysisContext getContext(IResource resource) { |
| 143 if (resource == null) { |
| 144 return null; |
| 145 } |
143 return getProject(resource.getProject()).getContext(resource); | 146 return getProject(resource.getProject()).getContext(resource); |
144 } | 147 } |
145 | 148 |
146 @Override | 149 @Override |
147 public IResource getHtmlFileForLibrary(Source source) { | 150 public IResource getHtmlFileForLibrary(Source source) { |
148 AnalysisContext context = getContext(getResource(source)); | 151 AnalysisContext context = getContext(getResource(source)); |
149 Source[] htmlSource = context.getHtmlFilesReferencing(source); | 152 if (context != null) { |
150 if (htmlSource.length > 0) { | 153 Source[] htmlSource = context.getHtmlFilesReferencing(source); |
151 return getResource(htmlSource[0]); | 154 if (htmlSource.length > 0) { |
| 155 return getResource(htmlSource[0]); |
| 156 } |
152 } | 157 } |
153 return null; | 158 return null; |
154 } | 159 } |
155 | 160 |
156 @Override | 161 @Override |
157 public DartIgnoreManager getIgnoreManager() { | 162 public DartIgnoreManager getIgnoreManager() { |
158 return ignoreManager; | 163 return ignoreManager; |
159 } | 164 } |
160 | 165 |
161 @Override | 166 @Override |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 private void removeProject(IProject projectResource) { | 445 private void removeProject(IProject projectResource) { |
441 Project result; | 446 Project result; |
442 synchronized (projects) { | 447 synchronized (projects) { |
443 result = projects.remove(projectResource); | 448 result = projects.remove(projectResource); |
444 } | 449 } |
445 if (result != null) { | 450 if (result != null) { |
446 result.discardContextsIn(projectResource); | 451 result.discardContextsIn(projectResource); |
447 } | 452 } |
448 } | 453 } |
449 } | 454 } |
OLD | NEW |