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

Side by Side Diff: pkg/analysis_services/lib/src/refactoring/rename_library.dart

Issue 484733003: Import analysis_services.dart into analysis_server.dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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
(Empty)
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 library services.src.refactoring.rename_library;
6
7 import 'dart:async';
8
9 import 'package:analysis_services/correction/change.dart';
10 import 'package:analysis_services/correction/status.dart';
11 import 'package:analysis_services/refactoring/refactoring.dart';
12 import 'package:analysis_services/search/search_engine.dart';
13 import 'package:analysis_services/src/refactoring/naming_conventions.dart';
14 import 'package:analysis_services/src/refactoring/rename.dart';
15 import 'package:analyzer/src/generated/element.dart';
16
17
18 /**
19 * A [Refactoring] for renaming [LibraryElement]s.
20 */
21 class RenameLibraryRefactoringImpl extends RenameRefactoringImpl {
22 RenameLibraryRefactoringImpl(SearchEngine searchEngine,
23 LibraryElement element)
24 : super(searchEngine, element);
25
26 @override
27 LibraryElement get element => super.element as LibraryElement;
28
29 @override
30 String get refactoringName {
31 return "Rename Library";
32 }
33
34 @override
35 Future<RefactoringStatus> checkFinalConditions() {
36 RefactoringStatus result = new RefactoringStatus();
37 return new Future.value(result);
38 }
39
40 @override
41 RefactoringStatus checkNewName() {
42 RefactoringStatus result = super.checkNewName();
43 result.addStatus(validateLibraryName(newName));
44 return result;
45 }
46
47 @override
48 Future<Change> createChange() {
49 Change change = new Change(refactoringName);
50 // update declaration
51 addDeclarationEdit(change, element);
52 // update references
53 return searchEngine.searchReferences(element).then((refMatches) {
54 List<SourceReference> references = getSourceReferences(refMatches);
55 for (SourceReference reference in references) {
56 addReferenceEdit(change, reference);
57 }
58 return change;
59 });
60 }
61 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698