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

Unified Diff: editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/DartUI.java

Issue 766323002: Compressed/optimized navigation notification. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years 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/DartUI.java
diff --git a/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/DartUI.java b/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/DartUI.java
index fa0e66ad2b948e91e2881ee8266e0bd0d772dc37..a3403469af4ea399d8d5b9f336e02bd9c3558cfc 100644
--- a/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/DartUI.java
+++ b/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/DartUI.java
@@ -18,6 +18,7 @@ import com.google.dart.engine.context.AnalysisContext;
import com.google.dart.engine.element.Element;
import com.google.dart.engine.source.Source;
import com.google.dart.server.generated.types.Location;
+import com.google.dart.server.generated.types.NavigationTarget;
import com.google.dart.tools.core.DartCore;
import com.google.dart.tools.core.analysis.model.IFileInfo;
import com.google.dart.tools.core.analysis.model.ProjectManager;
@@ -580,6 +581,28 @@ public final class DartUI {
}
/**
+ * Opens an editor with {@link NavigationTarget}.
+ *
+ * @param target the {@link NavigationTarget} to open in reveal
+ * @return the opened editor or {@code null} if by some reason editor was not opened
+ */
+ public static IEditorPart openInEditor(
+ com.google.dart.server.generated.types.NavigationTarget target, boolean activate)
+ throws Exception {
+ if (target == null) {
+ return null;
+ }
+ String path = target.getFile();
+ IEditorPart editor = openFilePath(path, activate);
+ if (editor != null) {
+ int offset = target.getOffset();
+ int length = target.getLength();
+ EditorUtility.revealInEditor(editor, offset, length);
+ }
+ return editor;
+ }
+
+ /**
* Opens an editor with {@link Element} in context of the given {@link DartEditor}.
*
* @param contextEditor the {@link DartEditor} to use as context, may be {@code null}.

Powered by Google App Engine
This is Rietveld 408576698