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

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

Issue 11364134: Merge libv1. (Closed) Base URL: https://dart.googlecode.com/svn/experimental/lib_v2/dart
Patch Set: Reupload due to error Created 8 years, 1 month 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 1e9a77a04ee1b8844c4ad1ed7a064cb227dd8d01..32ee0b1cfa6355a29bc4c2135e7915b9819c85cf 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,9 +18,12 @@ import com.google.dart.tools.core.model.DartModelException;
import com.google.dart.tools.core.model.SourceReference;
import com.google.dart.tools.core.search.SearchScope;
import com.google.dart.tools.core.search.SearchScopeFactory;
+import com.google.dart.tools.internal.corext.refactoring.util.ExecutionUtils;
+import com.google.dart.tools.internal.corext.refactoring.util.RunnableObjectEx;
import com.google.dart.tools.ui.dialogs.TypeSelectionExtension;
import com.google.dart.tools.ui.internal.SharedImages;
import com.google.dart.tools.ui.internal.dialogs.FilteredTypesSelectionDialog;
+import com.google.dart.tools.ui.internal.text.editor.DartEditor;
import com.google.dart.tools.ui.internal.text.editor.EditorUtility;
import com.google.dart.tools.ui.internal.text.editor.ExternalCompilationUnitEditorInput;
import com.google.dart.tools.ui.text.IColorManager;
@@ -29,8 +32,11 @@ import org.eclipse.core.resources.IProject;
import org.eclipse.jface.operation.IRunnableContext;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferenceConverter;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
@@ -469,6 +475,20 @@ public final class DartUI {
}
/**
+ * @return the selection range in given {@link DartEditor}, works even if called from non-UI
+ * thread.
+ * @see ITextViewer#getSelectedRange()
+ */
+ public static Point getSelectionRange(final ISourceViewer viewer) {
+ return ExecutionUtils.runObjectUI(new RunnableObjectEx<Point>() {
+ @Override
+ public Point runObject() throws Exception {
+ return viewer.getSelectedRange();
+ }
+ });
+ }
+
+ /**
* Returns the shared images for the Dart UI.
*
* @return the shared images manager

Powered by Google App Engine
This is Rietveld 408576698