| 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}.
|
|
|