| 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 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 */ | 554 */ |
| 555 public void removeReference(SimpleIdentifier identifier) { | 555 public void removeReference(SimpleIdentifier identifier) { |
| 556 IBinding binding = getNodeBinding(identifier); | 556 IBinding binding = getNodeBinding(identifier); |
| 557 List<SimpleIdentifier> identifiers = bindingToIdentifiers.get(binding); | 557 List<SimpleIdentifier> identifiers = bindingToIdentifiers.get(binding); |
| 558 if (identifiers != null) { | 558 if (identifiers != null) { |
| 559 identifiers.remove(identifier); | 559 identifiers.remove(identifier); |
| 560 } | 560 } |
| 561 } | 561 } |
| 562 | 562 |
| 563 /** | 563 /** |
| 564 * Specifies that the given {@link File} should not be translated. |
| 565 */ |
| 566 public void removeSourceFile(File file) { |
| 567 Assert.isLegal(file.exists(), "File '" + file + "' does not exist."); |
| 568 file = file.getAbsoluteFile(); |
| 569 sourceFiles.remove(file); |
| 570 } |
| 571 |
| 572 /** |
| 564 * Specifies that all files in given folder should not be translated. | 573 * Specifies that all files in given folder should not be translated. |
| 565 */ | 574 */ |
| 566 public void removeSourceFiles(File folder) { | 575 public void removeSourceFiles(File folder) { |
| 567 Assert.isLegal(folder.exists(), "Folder '" + folder + "' does not exist."); | 576 Assert.isLegal(folder.exists(), "Folder '" + folder + "' does not exist."); |
| 568 Assert.isLegal(folder.isDirectory(), "Folder '" + folder + "' is not a folde
r."); | 577 Assert.isLegal(folder.isDirectory(), "Folder '" + folder + "' is not a folde
r."); |
| 569 folder = folder.getAbsoluteFile(); | 578 folder = folder.getAbsoluteFile(); |
| 570 Collection<File> folderFiles = FileUtils.listFiles(folder, JAVA_EXTENSION, t
rue); | 579 Collection<File> folderFiles = FileUtils.listFiles(folder, JAVA_EXTENSION, t
rue); |
| 571 sourceFiles.removeAll(folderFiles); | 580 sourceFiles.removeAll(folderFiles); |
| 572 } | 581 } |
| 573 | 582 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 } | 618 } |
| 610 } | 619 } |
| 611 | 620 |
| 612 /** | 621 /** |
| 613 * Sets the {@link SimpleIdentifier} name and updates all references. | 622 * Sets the {@link SimpleIdentifier} name and updates all references. |
| 614 */ | 623 */ |
| 615 public void renameIdentifier(SimpleIdentifier declarationIdentifier, String ne
wName) { | 624 public void renameIdentifier(SimpleIdentifier declarationIdentifier, String ne
wName) { |
| 616 // move identifiers to the new signature | 625 // move identifiers to the new signature |
| 617 Object binding = nodeToBinding.get(declarationIdentifier); | 626 Object binding = nodeToBinding.get(declarationIdentifier); |
| 618 List<SimpleIdentifier> identifiers = bindingToIdentifiers.get(binding); | 627 List<SimpleIdentifier> identifiers = bindingToIdentifiers.get(binding); |
| 628 if (identifiers == null) { |
| 629 return; |
| 630 } |
| 619 // update identifiers to the new name | 631 // update identifiers to the new name |
| 620 for (SimpleIdentifier identifier : identifiers) { | 632 for (SimpleIdentifier identifier : identifiers) { |
| 621 identifier.setToken(token(TokenType.IDENTIFIER, newName)); | 633 identifier.setToken(token(TokenType.IDENTIFIER, newName)); |
| 622 } | 634 } |
| 623 } | 635 } |
| 624 | 636 |
| 625 public CompilationUnit translate() throws Exception { | 637 public CompilationUnit translate() throws Exception { |
| 626 // sort source files | 638 // sort source files |
| 627 Collections.sort(sourceFiles); | 639 Collections.sort(sourceFiles); |
| 628 // perform syntax translation | 640 // perform syntax translation |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1069 } | 1081 } |
| 1070 } | 1082 } |
| 1071 } | 1083 } |
| 1072 } | 1084 } |
| 1073 } | 1085 } |
| 1074 } | 1086 } |
| 1075 } | 1087 } |
| 1076 }); | 1088 }); |
| 1077 } | 1089 } |
| 1078 } | 1090 } |
| OLD | NEW |