OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013, the Dart project authors. | 2 * Copyright (c) 2013, the 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 |
11 * or implied. See the License for the specific language governing permissions a
nd limitations under | 11 * or implied. See the License for the specific language governing permissions a
nd limitations under |
12 * the License. | 12 * the License. |
13 */ | 13 */ |
14 package com.google.dart.tools.core.analysis.model; | 14 package com.google.dart.tools.core.analysis.model; |
15 | 15 |
16 import com.google.dart.engine.context.AnalysisContext; | 16 import com.google.dart.engine.context.AnalysisContext; |
17 import com.google.dart.engine.element.LibraryElement; | 17 import com.google.dart.engine.element.LibraryElement; |
18 import com.google.dart.engine.sdk.DartSdk; | 18 import com.google.dart.engine.sdk.DartSdk; |
19 import com.google.dart.engine.source.Source; | 19 import com.google.dart.engine.source.Source; |
20 import com.google.dart.engine.source.SourceKind; | 20 import com.google.dart.engine.source.SourceKind; |
21 import com.google.dart.tools.core.internal.builder.AnalysisWorker; | 21 import com.google.dart.tools.core.internal.builder.AnalysisWorker; |
22 | 22 |
23 import org.eclipse.core.resources.IContainer; | 23 import org.eclipse.core.resources.IContainer; |
24 import org.eclipse.core.resources.IFile; | 24 import org.eclipse.core.resources.IFile; |
25 import org.eclipse.core.resources.IResource; | 25 import org.eclipse.core.resources.IResource; |
26 | 26 |
27 /** | 27 /** |
28 * Instances of {@code ContextManager} manage and provide access to multiple ins
tances of | 28 * Instances of {@code ContextManager} manage and provide access to multiple ins
tances of |
29 * {@link AnalysisContext}. | 29 * {@link AnalysisContext}. |
30 * | 30 * |
31 * @coverage dart.tools.core.model | 31 * @coverage dart.tools.core.model |
32 */ | 32 */ |
33 public interface ContextManager { | 33 public interface ContextManager { |
34 | 34 |
35 /** | 35 /** |
36 * Add the given {@link AnalysisWorker} to the context's list of active worker
s. | 36 * Add the given {@link AnalysisWorker} to the context's list of active worker
s. |
37 * | 37 * |
38 * @param worker the analysis worker | 38 * @param worker the analysis worker |
39 */ | 39 */ |
40 void addWorker(AnalysisWorker worker); | 40 void addWorker(AnalysisWorker worker); |
41 | 41 |
42 /** | 42 /** |
43 * Answer the {@link AnalysisContext} used to analyze the specified resource. | 43 * Answer the {@link AnalysisContext} used to analyze the specified resource. |
44 * | 44 * |
45 * @param resource a resource (not {@code null}) | 45 * @param resource a resource (not {@code null}) |
46 * @return the context used for analysis or {@code null} if the context was no
t cached and could | 46 * @return the context used for analysis or {@code null} if the context was no
t cached and could |
47 * not be created because the container's location could not be determ
ined | 47 * not be created because the container's location could not be determ
ined |
48 */ | 48 */ |
49 AnalysisContext getContext(IResource resource); | 49 AnalysisContext getContext(IResource resource); |
50 | 50 |
51 /** | 51 /** |
52 * Answer with all the library sources that can be launched on the browser | 52 * Answer with all the library sources that can be launched on the browser |
53 * | 53 * |
54 * @return library sources that can be launched on the browser | 54 * @return library sources that can be launched on the browser |
55 */ | 55 */ |
56 Source[] getLaunchableClientLibrarySources(); | 56 Source[] getLaunchableClientLibrarySources(); |
57 | 57 |
58 /** | 58 /** |
59 * Answer with all the library sources that can be launched on the VM | 59 * Answer with all the library sources that can be launched on the VM |
60 * | 60 * |
61 * @return library sources that can be launched on the VM | 61 * @return library sources that can be launched on the VM |
62 */ | 62 */ |
63 Source[] getLaunchableServerLibrarySources(); | 63 Source[] getLaunchableServerLibrarySources(); |
64 | 64 |
65 /** | 65 /** |
66 * Answer the LibraryElement associated with the specified file | 66 * Answer the LibraryElement associated with the specified file |
67 * | 67 * |
68 * @param file the file (not {@code null}) | 68 * @param file the file (not {@code null}) |
69 * @return the {@link LibraryElement} associated with the file or {@code null}
if it could not be | 69 * @return the {@link LibraryElement} associated with the file or {@code null}
if it could not be |
70 * determined because the location is {@code null} | 70 * determined because the location is {@code null} |
71 */ | 71 */ |
72 LibraryElement getLibraryElement(IFile file); | 72 LibraryElement getLibraryElement(IFile file); |
73 | 73 |
74 /** | 74 /** |
75 * Answer the LibraryElement associated with the specified file | 75 * Answer the LibraryElement associated with the specified file |
76 * | 76 * |
77 * @return the {@link LibraryElement} or {@code null} if file has not been res
olved yet or the | 77 * @return the {@link LibraryElement} or {@code null} if file has not been res
olved yet or the |
78 * location is {@code null} | 78 * location is {@code null} |
79 */ | 79 */ |
80 LibraryElement getLibraryElementOrNull(IFile file); | 80 LibraryElement getLibraryElementOrNull(IFile file); |
81 | 81 |
82 /** | 82 /** |
83 * Answer the {@link PubFolder} containing the specified resource. | 83 * Answer the {@link PubFolder} containing the specified resource. |
84 * | 84 * |
85 * @param resource the resource (not {@code null}) | 85 * @param resource the resource (not {@code null}) |
86 * @return the pub folder or {@code null} if no pub folder contains this resou
rce | 86 * @return the pub folder or {@code null} if no pub folder contains this resou
rce |
87 */ | 87 */ |
88 PubFolder getPubFolder(IResource resource); | 88 PubFolder getPubFolder(IResource resource); |
89 | 89 |
90 /** | 90 /** |
91 * Answer the underlying Eclipse resource associated with this object | 91 * Answer the underlying Eclipse resource associated with this object |
92 * | 92 * |
93 * @return the resource (not {@code null}) | 93 * @return the resource (not {@code null}) |
94 */ | 94 */ |
95 IContainer getResource(); | 95 IContainer getResource(); |
96 | 96 |
97 /** | 97 /** |
98 * Answer the resource associated with the specified source. | 98 * Answer the resource associated with the specified source. |
99 * | 99 * |
100 * @param source the source | 100 * @param source the source |
101 * @return the resource or {@code null} if it could not be determined | 101 * @return the resource or {@code null} if it could not be determined |
102 */ | 102 */ |
103 IResource getResource(Source source); | 103 IResource getResource(Source source); |
104 | 104 |
105 /** | 105 /** |
106 * Answer the bi-directional map for translating between sources and resources
for the specified | 106 * Answer the bi-directional map for translating between sources and resources
for the specified |
107 * analysis context. | 107 * analysis context. |
108 * | 108 * |
109 * @param context the analysis context (not {@code null}) | 109 * @param context the analysis context (not {@code null}) |
110 * @return the resource map (not {@code null}) | 110 * @return the resource map (not {@code null}) |
111 */ | 111 */ |
112 ResourceMap getResourceMap(AnalysisContext context); | 112 ResourceMap getResourceMap(AnalysisContext context); |
113 | 113 |
114 /** | 114 /** |
115 * Answer the bi-directional map for translating between sources and resources
for the specified | 115 * Answer the bi-directional map for translating between sources and resources
for the specified |
116 * resource. | 116 * resource. |
117 * | 117 * |
118 * @param resource the resource (not {@code null}) | 118 * @param resource the resource (not {@code null}) |
119 * @return the resource map, may be {@code null} if enclosing project doesn't
exist | 119 * @return the resource map, may be {@code null} if enclosing project doesn't
exist |
120 */ | 120 */ |
121 ResourceMap getResourceMap(IResource resource); | 121 ResourceMap getResourceMap(IResource resource); |
122 | 122 |
123 /** | 123 /** |
124 * Answer the {@link DartSdk} associated with this manager. | 124 * Answer the {@link DartSdk} associated with this manager. |
125 * | 125 * |
126 * @return the sdk (not {@code null}) | 126 * @return the sdk (not {@code null}) |
127 */ | 127 */ |
128 DartSdk getSdk(); | 128 DartSdk getSdk(); |
129 | 129 |
130 /** | 130 /** |
131 * Answer the context containing analysis of sources in the SDK. | 131 * Answer the context containing analysis of sources in the SDK. |
132 * | 132 * |
133 * @return the context (not {@code null}) | 133 * @return the context (not {@code null}) |
134 */ | 134 */ |
135 AnalysisContext getSdkContext(); | 135 AnalysisContext getSdkContext(); |
136 | 136 |
137 /** | 137 /** |
138 * Answer the source for the specified file | 138 * Answer the source for the specified file |
139 * | 139 * |
140 * @param file the file (not {@code null}) | 140 * @param file the file (not {@code null}) |
141 * @return the source or {@code null} if the source could not be determined be
cause the location | 141 * @return the source or {@code null} if the source could not be determined be
cause the location |
142 * is {@code null} | 142 * is {@code null} |
143 */ | 143 */ |
144 Source getSource(IFile file); | 144 Source getSource(IFile file); |
145 | 145 |
146 /** | 146 /** |
147 * Answer the source kind for the given file. | 147 * Answer the source kind for the given file. |
148 * | 148 * |
149 * @return the {@link SourceKind} of the given file, may be {@link SourceKind#
UNKNOWN} if not | 149 * @return the {@link SourceKind} of the given file, may be {@link SourceKind#
UNKNOWN} if not |
150 * analyzed yet. | 150 * analyzed yet. |
151 */ | 151 */ |
152 SourceKind getSourceKind(IFile file); | 152 SourceKind getSourceKind(IFile file); |
153 | 153 |
154 /** | 154 /** |
155 * Answer the context's list of active workers. | 155 * Answer the context's list of active workers. |
156 * | 156 * |
157 * @return the list (not {@code null}, contains no {@code null}s) | 157 * @return the list (not {@code null}, contains no {@code null}s) |
158 */ | 158 */ |
159 AnalysisWorker[] getWorkers(); | 159 AnalysisWorker[] getWorkers(); |
160 | 160 |
161 /** | 161 /** |
162 * Remove the {@link AnalysisWorker} from the project's active workers list. | 162 * Remove the {@link AnalysisWorker} from the project's active workers list. |
163 * | 163 * |
164 * @param analysisWorker | 164 * @param analysisWorker |
165 */ | 165 */ |
166 void removeWorker(AnalysisWorker analysisWorker); | 166 void removeWorker(AnalysisWorker analysisWorker); |
167 | 167 |
168 /** | 168 /** |
169 * Locate a {@link IFileInfo} for the given package uri relative to the given
resource | 169 * Locate a {@link IFileInfo} for the given package uri relative to the given
resource |
170 * | 170 * |
171 * @param relativeTo the resource to use to locate an analysis context | 171 * @param relativeTo the resource to use to locate an analysis context |
172 * @param uri a package: uri | 172 * @param uri a package: uri |
173 * @return the file information or null if the resource is null or does not ex
ist | 173 * @return the file information or null if the resource is null or does not ex
ist |
174 */ | 174 */ |
175 IFileInfo resolveUriToFileInfo(IResource relativeTo, String uri); | 175 IFileInfo resolveUriToFileInfo(IResource relativeTo, String uri); |
176 | 176 |
177 /** | 177 /** |
178 * Set the hint option for all the analysis context, based on changes to the h
int preference | 178 * Set the hint option for all the analysis context, based on changes to the h
int preference |
179 * DartCore.ENABLE_HINTS_DART2JS_PREFERENCE | 179 * DartCore.ENABLE_HINTS_DART2JS_PREFERENCE |
180 * | 180 * |
181 * @param enableDart2JSHints | 181 * @param enableDart2JSHints |
182 */ | 182 */ |
183 void setDart2JSHintOption(boolean enableDart2JSHints); | 183 void setDart2JSHintOption(boolean enableDart2JSHints); |
184 | 184 |
185 /** | 185 /** |
186 * Set the hint option for all the analysis context, based on changes to the h
int preference | 186 * Set the hint option for all the analysis context, based on changes to the h
int preference |
187 * DartCore.ENABLE_HINT_PREFERENCE | 187 * DartCore.ENABLE_HINT_PREFERENCE |
188 * | 188 * |
189 * @param enableHint | 189 * @param enableHint |
190 */ | 190 */ |
191 void setHintOption(boolean enableHint); | 191 void setHintOption(boolean enableHint); |
192 | 192 |
193 /** | 193 /** |
194 * Stop workers for the specified context. | 194 * Stop workers for the specified context. |
195 * | 195 * |
196 * @param context the context | 196 * @param context the context |
197 */ | 197 */ |
198 void stopWorkers(AnalysisContext context); | 198 void stopWorkers(AnalysisContext context); |
199 | 199 |
200 } | 200 } |
OLD | NEW |