| OLD | NEW |
| (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 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. |
| 7 |
| 8 library services.src.refactoring; |
| 9 |
| 10 import 'package:analysis_services/correction/status.dart'; |
| 11 import 'package:analysis_services/refactoring/progress_monitor.dart'; |
| 12 import 'package:analysis_services/refactoring/refactoring.dart'; |
| 13 import 'package:analysis_services/src/refactoring/progress_monitor.dart'; |
| 14 |
| 15 |
| 16 /** |
| 17 * Returns [pm] if not `null` or a new [NullProgressMonitor] instance. |
| 18 */ |
| 19 ProgressMonitor checkProgressMonitor(ProgressMonitor pm) { |
| 20 if (pm != null) { |
| 21 return pm; |
| 22 } |
| 23 return new NullProgressMonitor(); |
| 24 } |
| 25 |
| 26 |
| 27 /** |
| 28 * Abstract implementation of {@link Refactoring}. |
| 29 */ |
| 30 abstract class RefactoringImpl implements Refactoring { |
| 31 @override |
| 32 RefactoringStatus checkAllConditions(ProgressMonitor pm) { |
| 33 pm = checkProgressMonitor(pm); |
| 34 pm.beginTask("", 2); |
| 35 RefactoringStatus result = new RefactoringStatus(); |
| 36 result.merge(checkInitialConditions(new SubProgressMonitor(pm, 1))); |
| 37 if (!result.hasFatalError) { |
| 38 if (pm.isCanceled) { |
| 39 throw new OperationCanceledException(); |
| 40 } |
| 41 result.merge(checkFinalConditions(new SubProgressMonitor(pm, 1))); |
| 42 } |
| 43 pm.done(); |
| 44 return result; |
| 45 } |
| 46 } |
| OLD | NEW |