| 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 |
| 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.index.Index; | 17 import com.google.dart.engine.index.Index; |
| 18 import com.google.dart.engine.search.SearchEngine; | 18 import com.google.dart.engine.search.SearchEngine; |
| 19 import com.google.dart.engine.source.Source; | 19 import com.google.dart.engine.source.Source; |
| 20 import com.google.dart.tools.core.internal.analysis.model.WorkspaceDeltaProcesso
r; | 20 import com.google.dart.tools.core.internal.analysis.model.WorkspaceDeltaProcesso
r; |
| 21 import com.google.dart.tools.core.internal.model.DartIgnoreManager; | 21 import com.google.dart.tools.core.internal.model.DartIgnoreManager; |
| 22 | 22 |
| 23 import org.eclipse.core.resources.IFile; | 23 import org.eclipse.core.resources.IFile; |
| 24 import org.eclipse.core.resources.IProject; | 24 import org.eclipse.core.resources.IProject; |
| 25 import org.eclipse.core.resources.IResource; | 25 import org.eclipse.core.resources.IResource; |
| 26 import org.eclipse.core.resources.IWorkspaceRoot; | 26 import org.eclipse.core.resources.IWorkspaceRoot; |
| 27 | 27 |
| 28 /** | 28 /** |
| 29 * Instances of {@code ProjectManager} manage Eclipse projects that have the Dar
t nature. | 29 * Instances of {@code ProjectManager} manage Eclipse projects that have the Dar
t nature. |
| 30 * | 30 * |
| 31 * @coverage dart.tools.core.model | 31 * @coverage dart.tools.core.model |
| 32 */ | 32 */ |
| 33 public interface ProjectManager extends ContextManager { | 33 public interface ProjectManager extends ContextManager { |
| 34 | 34 |
| 35 /** | 35 /** |
| 36 * Notify the specified object when a project has been analyzed. | 36 * Notify the specified object when a project has been analyzed. |
| 37 * | 37 * |
| 38 * @param listener the object to be notified (not {@code null}) | 38 * @param listener the object to be notified (not {@code null}) |
| 39 */ | 39 */ |
| 40 void addProjectListener(ProjectListener listener); | 40 void addProjectListener(ProjectListener listener); |
| 41 | 41 |
| 42 /** | 42 /** |
| 43 * Answer with the html file which has a reference to the library represented
by the given source | 43 * Answer with the html file which has a reference to the library represented
by the given source |
| 44 * | 44 * |
| 45 * @param source the source for a library | 45 * @param source the source for a library |
| 46 * @return IResource that is the html file with a reference to the given libra
ry, or {@code null} | 46 * @return IResource that is the html file with a reference to the given libra
ry, or {@code null} |
| 47 */ | 47 */ |
| 48 IResource getHtmlFileForLibrary(Source source); | 48 IResource getHtmlFileForLibrary(Source source); |
| 49 | 49 |
| 50 /** | 50 /** |
| 51 * Answer the global ignore manager used for all Dart source | 51 * Answer the global ignore manager used for all Dart source |
| 52 * | 52 * |
| 53 * @return the ignore manager (not {@code null}) | 53 * @return the ignore manager (not {@code null}) |
| 54 */ | 54 */ |
| 55 DartIgnoreManager getIgnoreManager(); | 55 DartIgnoreManager getIgnoreManager(); |
| 56 | 56 |
| 57 /** | 57 /** |
| 58 * Answer the global index used for all Dart source | 58 * Answer the global index used for all Dart source |
| 59 * | 59 * |
| 60 * @return the index (not {@code null}) | 60 * @return the index (not {@code null}) |
| 61 */ | 61 */ |
| 62 Index getIndex(); | 62 Index getIndex(); |
| 63 | 63 |
| 64 /** | 64 /** |
| 65 * Answer with all the library sources that the given file is part of or is th
e library file | 65 * Answer with all the library sources that the given file is part of or is th
e library file |
| 66 * | 66 * |
| 67 * @return the {@link Source}[] for all the libraries that the given file is p
art of or is the | 67 * @return the {@link Source}[] for all the libraries that the given file is p
art of or is the |
| 68 * library file | 68 * library file |
| 69 */ | 69 */ |
| 70 Source[] getLibrarySources(IFile file); | 70 Source[] getLibrarySources(IFile file); |
| 71 | 71 |
| 72 /** | 72 /** |
| 73 * Answer with all the library sources that are in the given project. These in
clude all the sdk | 73 * Answer with all the library sources that are in the given project. These in
clude all the sdk |
| 74 * and external libraries referenced by code in the project | 74 * and external libraries referenced by code in the project |
| 75 * | 75 * |
| 76 * @return the {@link Source}[] for all the libraries that are in the given pr
oject. | 76 * @return the {@link Source}[] for all the libraries that are in the given pr
oject. |
| 77 */ | 77 */ |
| 78 Source[] getLibrarySources(IProject project); | 78 Source[] getLibrarySources(IProject project); |
| 79 | 79 |
| 80 /** | 80 /** |
| 81 * Answer the project for the specified Eclipse resource | 81 * Answer the project for the specified Eclipse resource |
| 82 * | 82 * |
| 83 * @param resource the Eclipse resource | 83 * @param resource the Eclipse resource |
| 84 * @return the project, may be {@code null} if resource doesn't exist | 84 * @return the project, may be {@code null} if resource doesn't exist |
| 85 */ | 85 */ |
| 86 Project getProject(IProject resource); | 86 Project getProject(IProject resource); |
| 87 | 87 |
| 88 /** | 88 /** |
| 89 * Answer the Eclipse project associated with this analysis context. | 89 * Answer the Eclipse project associated with this analysis context. |
| 90 * | 90 * |
| 91 * @param context the analysis context | 91 * @param context the analysis context |
| 92 * @return the associated project, may be {@code null} if project doesn't exis
t | 92 * @return the associated project, may be {@code null} if project doesn't exis
t |
| 93 */ | 93 */ |
| 94 IProject getProjectForContext(AnalysisContext context); | 94 IProject getProjectForContext(AnalysisContext context); |
| 95 | 95 |
| 96 /** | 96 /** |
| 97 * Answer an array containing all of the projects currently defined in the wor
kspace | 97 * Answer an array containing all of the projects currently defined in the wor
kspace |
| 98 * | 98 * |
| 99 * @return array of projects (not {@code null}, contains no {@code null}) | 99 * @return array of projects (not {@code null}, contains no {@code null}) |
| 100 */ | 100 */ |
| 101 Project[] getProjects(); | 101 Project[] getProjects(); |
| 102 | 102 |
| 103 /** | 103 /** |
| 104 * Answer the underlying Eclipse workspace associated with this object | 104 * Answer the underlying Eclipse workspace associated with this object |
| 105 * | 105 * |
| 106 * @return the Eclipse workspace (not {@code null}) | 106 * @return the Eclipse workspace (not {@code null}) |
| 107 */ | 107 */ |
| 108 @Override | 108 @Override |
| 109 IWorkspaceRoot getResource(); | 109 IWorkspaceRoot getResource(); |
| 110 | 110 |
| 111 /** | 111 /** |
| 112 * Answer if the given source is known to be the defining compilation unit of
a library that can | 112 * Answer if the given source is known to be the defining compilation unit of
a library that can |
| 113 * be run on a client | 113 * be run on a client |
| 114 * | 114 * |
| 115 * @param librarySource the source | 115 * @param librarySource the source |
| 116 * @return {@code true} if the given source is known to be a library that can
be run on a client | 116 * @return {@code true} if the given source is known to be a library that can
be run on a client |
| 117 */ | 117 */ |
| 118 boolean isClientLibrary(Source librarySource); | 118 boolean isClientLibrary(Source librarySource); |
| 119 | 119 |
| 120 /** | 120 /** |
| 121 * Answer if the given source is known to be the defining compilation unit of
a library that can | 121 * Answer if the given source is known to be the defining compilation unit of
a library that can |
| 122 * be run on the server | 122 * be run on the server |
| 123 * | 123 * |
| 124 * @param librarySource the source | 124 * @param librarySource the source |
| 125 * @return {@code true} if the given source is known to be a library that can
be run on the server | 125 * @return {@code true} if the given source is known to be a library that can
be run on the server |
| 126 */ | 126 */ |
| 127 boolean isServerLibrary(Source librarySource); | 127 boolean isServerLibrary(Source librarySource); |
| 128 | 128 |
| 129 /** | 129 /** |
| 130 * Create and answer a new search engine backed by the global index | 130 * Create and answer a new search engine backed by the global index |
| 131 * | 131 * |
| 132 * @return a search engine (not {@code null}) | 132 * @return a search engine (not {@code null}) |
| 133 */ | 133 */ |
| 134 SearchEngine newSearchEngine(); | 134 SearchEngine newSearchEngine(); |
| 135 | 135 |
| 136 /** | 136 /** |
| 137 * Called by the builder when a project has been analyzed. | 137 * Called by the builder when a project has been analyzed. |
| 138 * | 138 * |
| 139 * @param project the project that was analyzed (not {@code null}) | 139 * @param project the project that was analyzed (not {@code null}) |
| 140 */ | 140 */ |
| 141 void projectAnalyzed(Project project); | 141 void projectAnalyzed(Project project); |
| 142 | 142 |
| 143 /** | 143 /** |
| 144 * Called by the {@link WorkspaceDeltaProcessor} when a project has been remov
ed. | 144 * Called by the {@link WorkspaceDeltaProcessor} when a project has been remov
ed. |
| 145 * | 145 * |
| 146 * @param projectResource the project that was removed | 146 * @param projectResource the project that was removed |
| 147 */ | 147 */ |
| 148 void projectRemoved(IProject projectResource); | 148 void projectRemoved(IProject projectResource); |
| 149 | 149 |
| 150 /** | 150 /** |
| 151 * Stop notifying the specified object when a project has been analyzed. | 151 * Stop notifying the specified object when a project has been analyzed. |
| 152 * | 152 * |
| 153 * @param listener the object that should not be notified (not {@code null}) | 153 * @param listener the object that should not be notified (not {@code null}) |
| 154 */ | 154 */ |
| 155 void removeProjectListener(ProjectListener listener); | 155 void removeProjectListener(ProjectListener listener); |
| 156 | 156 |
| 157 /** | 157 /** |
| 158 * Use the getResourceMap() method to locate a workspace resource for the give
n package uri. | 158 * Use the getResourceMap() method to locate a workspace resource for the give
n package uri. |
| 159 * | 159 * |
| 160 * @param relativeTo the resource to use to locate an analysis context | 160 * @param relativeTo the resource to use to locate an analysis context |
| 161 * @param uri a package: uri | 161 * @param uri a package: uri |
| 162 * @return | 162 * @return a workspace resource or {@code null} |
| 163 */ | 163 */ |
| 164 IFile resolvePackageUri(IResource relativeTo, String uri); | 164 IFile resolvePackageUri(IResource relativeTo, String uri); |
| 165 | 165 |
| 166 /** | 166 /** |
| 167 * Resolve the given file path to a package uri path, if any |
| 168 * |
| 169 * @param resource the given resource |
| 170 * @param path the file path for the resource wrt to package structure |
| 171 * @return the package name or {@code null} if resource is not in a package |
| 172 */ |
| 173 String resolvePathToPackage(IResource resource, String path); |
| 174 |
| 175 /** |
| 167 * Start background analysis such as updating the index. | 176 * Start background analysis such as updating the index. |
| 168 */ | 177 */ |
| 169 void start(); | 178 void start(); |
| 170 | 179 |
| 171 /** | 180 /** |
| 172 * Stop background analysis. | 181 * Stop background analysis. |
| 173 */ | 182 */ |
| 174 void stop(); | 183 void stop(); |
| 175 } | 184 } |
| OLD | NEW |