| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012, the Dart project authors. | 2 * Copyright (c) 2012, 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 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 import com.google.dart.tools.core.internal.util.MementoTokenizer; | 30 import com.google.dart.tools.core.internal.util.MementoTokenizer; |
| 31 import com.google.dart.tools.core.internal.util.ResourceUtil; | 31 import com.google.dart.tools.core.internal.util.ResourceUtil; |
| 32 import com.google.dart.tools.core.model.DartElement; | 32 import com.google.dart.tools.core.model.DartElement; |
| 33 import com.google.dart.tools.core.model.DartLibrary; | 33 import com.google.dart.tools.core.model.DartLibrary; |
| 34 import com.google.dart.tools.core.model.DartModelException; | 34 import com.google.dart.tools.core.model.DartModelException; |
| 35 import com.google.dart.tools.core.model.DartProject; | 35 import com.google.dart.tools.core.model.DartProject; |
| 36 import com.google.dart.tools.core.model.Type; | 36 import com.google.dart.tools.core.model.Type; |
| 37 import com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities; | 37 import com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities; |
| 38 import com.google.dart.tools.core.utilities.io.FileUtilities; | 38 import com.google.dart.tools.core.utilities.io.FileUtilities; |
| 39 import com.google.dart.tools.core.utilities.resource.IFileUtilities; | 39 import com.google.dart.tools.core.utilities.resource.IFileUtilities; |
| 40 import com.google.dart.tools.core.utilities.resource.IResourceUtilities; |
| 40 import com.google.dart.tools.core.workingcopy.WorkingCopyOwner; | 41 import com.google.dart.tools.core.workingcopy.WorkingCopyOwner; |
| 41 | 42 |
| 42 import org.eclipse.core.resources.IFile; | 43 import org.eclipse.core.resources.IFile; |
| 43 import org.eclipse.core.resources.IFolder; | 44 import org.eclipse.core.resources.IFolder; |
| 44 import org.eclipse.core.resources.IProject; | 45 import org.eclipse.core.resources.IProject; |
| 45 import org.eclipse.core.resources.IResource; | 46 import org.eclipse.core.resources.IResource; |
| 46 import org.eclipse.core.resources.IResourceProxy; | 47 import org.eclipse.core.resources.IResourceProxy; |
| 47 import org.eclipse.core.resources.IResourceProxyVisitor; | 48 import org.eclipse.core.resources.IResourceProxyVisitor; |
| 48 import org.eclipse.core.resources.ProjectScope; | 49 import org.eclipse.core.resources.ProjectScope; |
| 49 import org.eclipse.core.runtime.CoreException; | 50 import org.eclipse.core.runtime.CoreException; |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 | 411 |
| 411 @Override | 412 @Override |
| 412 public int getElementType() { | 413 public int getElementType() { |
| 413 return DartElement.DART_PROJECT; | 414 return DartElement.DART_PROJECT; |
| 414 } | 415 } |
| 415 | 416 |
| 416 /** | 417 /** |
| 417 * Return the mapping for the html files contained in this project. If the map
ping has not been | 418 * Return the mapping for the html files contained in this project. If the map
ping has not been |
| 418 * created, it will do so and return the result. | 419 * created, it will do so and return the result. |
| 419 * | 420 * |
| 420 * @return the table with the html file to library mapping | 421 * @return the table with the html file to library mapping html file location
string, list of |
| 422 * library resource location string |
| 421 * @throws CoreException | 423 * @throws CoreException |
| 422 */ | 424 */ |
| 423 @Override | 425 @Override |
| 424 public HashMap<String, List<String>> getHtmlMapping() throws CoreException { | 426 public HashMap<String, List<String>> getHtmlMapping() throws CoreException { |
| 425 | 427 |
| 426 HashMap<String, List<String>> htmlMapping = ((DartProjectInfo) getElementInf
o()).getHtmlMapping(); | 428 HashMap<String, List<String>> htmlMapping = ((DartProjectInfo) getElementInf
o()).getHtmlMapping(); |
| 427 | 429 |
| 428 if (htmlMapping != null) { | 430 if (htmlMapping != null) { |
| 429 return htmlMapping; | 431 return htmlMapping; |
| 430 } | 432 } |
| 431 | 433 |
| 432 final HashMap<String, List<String>> mapping = new HashMap<String, List<Strin
g>>(); | 434 final HashMap<String, List<String>> mapping = new HashMap<String, List<Strin
g>>(); |
| 433 | 435 |
| 434 getProject().accept(new IResourceProxyVisitor() { | 436 getProject().accept(new IResourceProxyVisitor() { |
| 435 @Override | 437 @Override |
| 436 public boolean visit(IResourceProxy proxy) throws CoreException { | 438 public boolean visit(IResourceProxy proxy) throws CoreException { |
| 437 if (proxy.getType() != IResource.FILE || !DartCore.isHTMLLikeFileName(pr
oxy.getName())) { | 439 if (proxy.getType() != IResource.FILE || !DartCore.isHTMLLikeFileName(pr
oxy.getName())) { |
| 438 return true; | 440 return true; |
| 439 } | 441 } |
| 440 IResource resource = proxy.requestResource(); | 442 IResource resource = proxy.requestResource(); |
| 441 if (resource.isAccessible()) { | 443 if (resource.isAccessible()) { |
| 442 try { | 444 try { |
| 443 List<String> libraryNames = LibraryReferenceFinder.findInHTML(IFileU
tilities.getContents((IFile) resource)); | 445 List<String> libraryNames = LibraryReferenceFinder.findInHTML(IFileU
tilities.getContents((IFile) resource)); |
| 444 if (!libraryNames.isEmpty()) { | 446 if (!libraryNames.isEmpty()) { |
| 445 mapping.put(resource.getLocation().toPortableString(), libraryName
s); | 447 List<String> libraryPaths = IResourceUtilities.getResolvedFilePath
s( |
| 448 resource, |
| 449 libraryNames); |
| 450 mapping.put(resource.getLocation().toPortableString(), libraryPath
s); |
| 446 } | 451 } |
| 447 } catch (IOException exception) { | 452 } catch (IOException exception) { |
| 448 DartCore.logInformation( | 453 DartCore.logInformation( |
| 449 "Could not get contents of " + resource.getLocation(), | 454 "Could not get contents of " + resource.getLocation(), |
| 450 exception); | 455 exception); |
| 451 } | 456 } |
| 452 } | 457 } |
| 453 | 458 |
| 454 return true; | 459 return true; |
| 455 } | 460 } |
| (...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1053 // if (resource.equals(element.getCorrespondingResource())) { | 1058 // if (resource.equals(element.getCorrespondingResource())) { |
| 1054 // return element; | 1059 // return element; |
| 1055 // } | 1060 // } |
| 1056 // } catch (DartModelException exception) { | 1061 // } catch (DartModelException exception) { |
| 1057 // // Ignored | 1062 // // Ignored |
| 1058 // } | 1063 // } |
| 1059 // } | 1064 // } |
| 1060 // return null; | 1065 // return null; |
| 1061 // } | 1066 // } |
| 1062 } | 1067 } |
| OLD | NEW |