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

Unified Diff: editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/actions/OpenAction_NEW.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/actions/OpenAction_NEW.java
diff --git a/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/actions/OpenAction_NEW.java b/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/actions/OpenAction_NEW.java
index 9fb593c90ae3540ede2e48c02e45210742bb9df2..eb25f84cb63f9217510641081e85b0a82e0ee33b 100644
--- a/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/actions/OpenAction_NEW.java
+++ b/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/actions/OpenAction_NEW.java
@@ -15,6 +15,7 @@ package com.google.dart.tools.ui.actions;
import com.google.dart.server.generated.types.Element;
import com.google.dart.server.generated.types.NavigationRegion;
+import com.google.dart.server.generated.types.NavigationTarget;
import com.google.dart.tools.core.DartCore;
import com.google.dart.tools.core.analysis.model.AnalysisServerNavigationListener;
import com.google.dart.tools.ui.DartUI;
@@ -43,6 +44,17 @@ public class OpenAction_NEW extends AbstractDartSelectionAction_NEW implements
}
}
+ private static void open(NavigationTarget target) {
+ if (target == null) {
+ return;
+ }
+ try {
+ DartUI.openInEditor(target, true);
+ } catch (Throwable e) {
+ ExceptionHandler.handle(e, "Open", "Exception during open.");
+ }
+ }
+
public OpenAction_NEW(DartEditor editor) {
super(editor);
DartCore.getAnalysisServerData().addNavigationListener(file, this);
@@ -61,10 +73,10 @@ public class OpenAction_NEW extends AbstractDartSelectionAction_NEW implements
@Override
public void run() {
- Element[] elements = NewSelectionConverter.getNavigationTargets(file, selectionOffset);
- if (elements.length != 0) {
- Element element = elements[0];
- open(element);
+ NavigationTarget[] targets = NewSelectionConverter.getNavigationTargets(file, selectionOffset);
+ if (targets.length != 0) {
+ NavigationTarget target = targets[0];
+ open(target);
}
}
@@ -94,7 +106,7 @@ public class OpenAction_NEW extends AbstractDartSelectionAction_NEW implements
}
private void updateSelectedElement() {
- Element[] elements = NewSelectionConverter.getNavigationTargets(file, selectionOffset);
- setEnabled(elements.length != 0);
+ NavigationTarget[] targets = NewSelectionConverter.getNavigationTargets(file, selectionOffset);
+ setEnabled(targets.length != 0);
}
}

Powered by Google App Engine
This is Rietveld 408576698