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

Unified Diff: pkg/analysis_services/lib/src/refactoring/refactoring.dart

Issue 458063002: Initial work on refactorings. (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 side-by-side diff with in-line comments
Download patch
Index: pkg/analysis_services/lib/src/refactoring/refactoring.dart
diff --git a/pkg/analysis_services/lib/src/refactoring/refactoring.dart b/pkg/analysis_services/lib/src/refactoring/refactoring.dart
new file mode 100644
index 0000000000000000000000000000000000000000..c8dc4f7743e87bd6f36affd1397dddc7c91635c2
--- /dev/null
+++ b/pkg/analysis_services/lib/src/refactoring/refactoring.dart
@@ -0,0 +1,46 @@
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// This code was auto-generated, is not intended to be edited, and is subject to
+// significant change. Please see the README file for more information.
+
+library services.src.refactoring;
+
+import 'package:analysis_services/correction/status.dart';
+import 'package:analysis_services/refactoring/progress_monitor.dart';
+import 'package:analysis_services/refactoring/refactoring.dart';
+import 'package:analysis_services/src/refactoring/progress_monitor.dart';
+
+
+/**
+ * Returns [pm] if not `null` or a new [NullProgressMonitor] instance.
+ */
+ProgressMonitor checkProgressMonitor(ProgressMonitor pm) {
+ if (pm != null) {
+ return pm;
+ }
+ return new NullProgressMonitor();
+}
+
+
+/**
+ * Abstract implementation of {@link Refactoring}.
+ */
+abstract class RefactoringImpl implements Refactoring {
+ @override
+ RefactoringStatus checkAllConditions(ProgressMonitor pm) {
+ pm = checkProgressMonitor(pm);
+ pm.beginTask("", 2);
+ RefactoringStatus result = new RefactoringStatus();
+ result.merge(checkInitialConditions(new SubProgressMonitor(pm, 1)));
+ if (!result.hasFatalError) {
+ if (pm.isCanceled) {
+ throw new OperationCanceledException();
+ }
+ result.merge(checkFinalConditions(new SubProgressMonitor(pm, 1)));
+ }
+ pm.done();
+ return result;
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698