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

Unified Diff: editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/refactoring/ServiceUtils_NEW.java

Issue 589723002: Use MOVE_FILE refactoring to implement file rename participant in Editor. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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: editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/refactoring/ServiceUtils_NEW.java
diff --git a/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/refactoring/ServiceUtils_NEW.java b/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/refactoring/ServiceUtils_NEW.java
index 4dd235a5bd05ba55edde064c13d6a02ce77d39a8..67bfb7c3251f88049e2cf0a6c2260ebac3748747 100644
--- a/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/refactoring/ServiceUtils_NEW.java
+++ b/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/refactoring/ServiceUtils_NEW.java
@@ -71,6 +71,27 @@ public class ServiceUtils_NEW {
}
/**
+ * Simplifies the given {@link Change}. If it is a {@link CompositeChange}, and it is zero
+ * children - returns {@code null}; if it has one child - attempts to simplify it; otherwise
+ * returns the current {@link Change}.
+ */
+ public static Change expandSingleChildCompositeChanges(Change change) {
+ while (change instanceof CompositeChange) {
+ CompositeChange compositeChange = (CompositeChange) change;
+ Change[] children = compositeChange.getChildren();
+ if (children.length == 0) {
+ return null;
+ } else if (children.length == 1) {
+ change = children[0];
+ compositeChange.remove(change);
+ } else {
+ break;
+ }
+ }
+ return change;
+ }
+
+ /**
* @return the LTK change for the given Services {@link CompositeChange}.
*/
public static CompositeChange toLTK(SourceChange sourceChange) {
« no previous file with comments | « editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/refactoring/ServerMoveFileRefactoring.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698