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

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

Issue 10692002: pass library files not directories to analysis server (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 5 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 /* 1 /*
2 * Copyright 2012 Dart project authors. 2 * Copyright 2012 Dart project authors.
3 * 3 *
4 * Licensed under the Eclipse License v1.0 (the "License"); you may not use this file except in 4 * Licensed under the Eclipse License v1.0 (the "License"); you may not use this file except in
5 * compliance with the License. You may obtain a copy of the License at 5 * 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 /** 95 /**
96 * Parse the specified file, without adding the library to the list of librari es to be tracked. 96 * Parse the specified file, without adding the library to the list of librari es to be tracked.
97 * 97 *
98 * @param libraryFile the library containing the dart file to be parsed (not < code>null</code>) 98 * @param libraryFile the library containing the dart file to be parsed (not < code>null</code>)
99 * @param dartFile the dart file to be parsed (not <code>null</code>). This ma y be the same as the 99 * @param dartFile the dart file to be parsed (not <code>null</code>). This ma y be the same as the
100 * libraryFile 100 * libraryFile
101 * @param callback a listener that will be notified when the library file has been parsed or 101 * @param callback a listener that will be notified when the library file has been parsed or
102 * <code>null</code> if none 102 * <code>null</code> if none
103 */ 103 */
104 public void parse(File libraryFile, File dartFile, ParseCallback callback) { 104 public void parse(File libraryFile, File dartFile, ParseCallback callback) {
105 if (!libraryFile.isAbsolute()) {
106 throw new IllegalArgumentException("File path must be absolute: " + librar yFile);
107 }
108 if (libraryFile.isDirectory()) {
109 throw new IllegalArgumentException("Cannot parse a directory: " + libraryF ile);
110 }
105 String relPath = libraryFile.toURI().relativize(dartFile.toURI()).getPath(); 111 String relPath = libraryFile.toURI().relativize(dartFile.toURI()).getPath();
106 server.queueNewTask(new ParseFileTask(server, this, libraryFile, relPath, da rtFile, callback)); 112 server.queueNewTask(new ParseFileTask(server, this, libraryFile, relPath, da rtFile, callback));
107 } 113 }
108 114
109 /** 115 /**
110 * Resolve the specified library. Similar to {@link #analyze(File)}, but does not add the library 116 * Resolve the specified library. Similar to {@link #analyze(File)}, but does not add the library
111 * to the list of libraries to be tracked. 117 * to the list of libraries to be tracked.
112 * 118 *
113 * @param libraryFile the library file (not <code>null</code>). 119 * @param libraryFile the library file (not <code>null</code>).
114 * @param milliseconds the number of milliseconds to wait for the library to b e resolved. 120 * @param milliseconds the number of milliseconds to wait for the library to b e resolved.
(...skipping 15 matching lines...) Expand all
130 * to the list of libraries to be tracked. 136 * to the list of libraries to be tracked.
131 * 137 *
132 * @param libraryFile the library file (not <code>null</code>) 138 * @param libraryFile the library file (not <code>null</code>)
133 * @param callback a listener that will be notified when the library has been resolved or 139 * @param callback a listener that will be notified when the library has been resolved or
134 * <code>null</code> if none 140 * <code>null</code> if none
135 */ 141 */
136 public void resolve(File libraryFile, ResolveCallback callback) { 142 public void resolve(File libraryFile, ResolveCallback callback) {
137 if (!libraryFile.isAbsolute()) { 143 if (!libraryFile.isAbsolute()) {
138 throw new IllegalArgumentException("File path must be absolute: " + librar yFile); 144 throw new IllegalArgumentException("File path must be absolute: " + librar yFile);
139 } 145 }
146 if (libraryFile.isDirectory()) {
147 throw new IllegalArgumentException("Cannot resolve a directory: " + librar yFile);
148 }
140 server.queueNewTask(new AnalyzeLibraryTask(server, this, libraryFile, callba ck)); 149 server.queueNewTask(new AnalyzeLibraryTask(server, this, libraryFile, callba ck));
141 } 150 }
142 151
143 void cacheLibrary(Library library) { 152 void cacheLibrary(Library library) {
144 libraryCache.put(library.getFile(), library); 153 libraryCache.put(library.getFile(), library);
145 } 154 }
146 155
147 void cacheUnresolvedUnit(File file, DartUnit unit) { 156 void cacheUnresolvedUnit(File file, DartUnit unit) {
148 unresolvedUnits.put(file.toURI(), unit); 157 unresolvedUnits.put(file.toURI(), unit);
149 } 158 }
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 if (oldArray.length == 0) { 304 if (oldArray.length == 0) {
296 return new Library[] {library}; 305 return new Library[] {library};
297 } 306 }
298 int oldLen = oldArray.length; 307 int oldLen = oldArray.length;
299 Library[] newArray = new Library[oldLen + 1]; 308 Library[] newArray = new Library[oldLen + 1];
300 System.arraycopy(oldArray, 0, newArray, 0, oldLen); 309 System.arraycopy(oldArray, 0, newArray, 0, oldLen);
301 newArray[oldLen] = library; 310 newArray[oldLen] = library;
302 return newArray; 311 return newArray;
303 } 312 }
304 } 313 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698