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

Unified Diff: editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/text/Selection.java

Issue 9651004: Make SourceInfo a class, rename its menthods. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Tweak for formatting, lazily create LainesInfo Created 8 years, 9 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/text/Selection.java
diff --git a/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/text/Selection.java b/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/text/Selection.java
index a25798cebd7a59a9d71aaf6a58bd9916646be586..e85b9049f94edd74c59ce53e71b7dce3a9de7c2c 100644
--- a/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/text/Selection.java
+++ b/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/text/Selection.java
@@ -80,8 +80,9 @@ public class Selection {
}
public boolean coveredBy(DartNode node) {
- int nodeStart = node.getSourceStart();
- return nodeStart <= fStart && fExclusiveEnd <= nodeStart + node.getSourceLength();
+ int nodeStart = node.getSourceInfo().getOffset();
+ return nodeStart <= fStart
+ && fExclusiveEnd <= nodeStart + node.getSourceInfo().getLength();
}
public boolean coveredBy(IRegion region) {
@@ -90,8 +91,9 @@ public class Selection {
}
public boolean covers(DartNode node) {
- int nodeStart = node.getSourceStart();
- return fStart <= nodeStart && nodeStart + node.getSourceLength() <= fExclusiveEnd;
+ int nodeStart = node.getSourceInfo().getOffset();
+ return fStart <= nodeStart
+ && nodeStart + node.getSourceInfo().getLength() <= fExclusiveEnd;
}
public boolean covers(int position) {
@@ -99,13 +101,14 @@ public class Selection {
}
public boolean endsIn(DartNode node) {
- int nodeStart = node.getSourceStart();
- return nodeStart < fExclusiveEnd && fExclusiveEnd < nodeStart + node.getSourceLength();
+ int nodeStart = node.getSourceInfo().getOffset();
+ return nodeStart < fExclusiveEnd
+ && fExclusiveEnd < nodeStart + node.getSourceInfo().getLength();
}
public int getEndVisitSelectionMode(DartNode node) {
- int nodeStart = node.getSourceStart();
- int nodeEnd = nodeStart + node.getSourceLength();
+ int nodeStart = node.getSourceInfo().getOffset();
+ int nodeEnd = nodeStart + node.getSourceInfo().getLength();
if (nodeEnd <= fStart) {
return BEFORE;
} else if (covers(node)) {
@@ -146,8 +149,8 @@ public class Selection {
* @see #AFTER
*/
public int getVisitSelectionMode(DartNode node) {
- int nodeStart = node.getSourceStart();
- int nodeEnd = nodeStart + node.getSourceLength();
+ int nodeStart = node.getSourceInfo().getOffset();
+ int nodeEnd = nodeStart + node.getSourceInfo().getLength();
if (nodeEnd <= fStart) {
return BEFORE;
} else if (covers(node)) {
@@ -159,8 +162,8 @@ public class Selection {
}
public boolean liesOutside(DartNode node) {
- int nodeStart = node.getSourceStart();
- int nodeEnd = nodeStart + node.getSourceLength();
+ int nodeStart = node.getSourceInfo().getOffset();
+ int nodeEnd = nodeStart + node.getSourceInfo().getLength();
boolean nodeBeforeSelection = nodeEnd < fStart;
boolean selectionBeforeNode = fExclusiveEnd < nodeStart;
return nodeBeforeSelection || selectionBeforeNode;

Powered by Google App Engine
This is Rietveld 408576698