Renamed ScalarTypeRef to ScalarTypeLink.
Renamed AbstractTypeRef to TypeLink.
diff --git a/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/junit/matchers/PropertyHasType.java b/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/junit/matchers/PropertyHasType.java
index a14b23e..cdb38c1 100644
--- a/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/junit/matchers/PropertyHasType.java
+++ b/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/junit/matchers/PropertyHasType.java
@@ -42,13 +42,13 @@
}
private String typeNameOf(Property property) {
- AbstractTypeRef r = property.getType();
- if (r instanceof ScalarTypeRef) return ((ScalarTypeRef) r).getScalar().getName();
- if (r instanceof ComplexTypeLink) {
- ComplexType type = ((ComplexTypeLink) r).getTarget();
+ TypeLink link = property.getType();
+ if (link instanceof ScalarTypeLink) return ((ScalarTypeLink) link).getTarget().getName();
+ if (link instanceof ComplexTypeLink) {
+ ComplexType type = ((ComplexTypeLink) link).getTarget();
return type == null ? null : type.getName();
}
- return r.toString();
+ return link.toString();
}
@Override public void describeTo(Description description) {
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/syntaxcoloring/ProtobufSemanticHighlightingCalculator.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/syntaxcoloring/ProtobufSemanticHighlightingCalculator.java
index 2c7bc4a..068b21b 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/syntaxcoloring/ProtobufSemanticHighlightingCalculator.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/syntaxcoloring/ProtobufSemanticHighlightingCalculator.java
@@ -11,6 +11,7 @@
import static com.google.eclipse.protobuf.protobuf.ProtobufPackage.Literals.*;
import static com.google.eclipse.protobuf.ui.editor.syntaxcoloring.HighlightingConfiguration.*;
+import static org.eclipse.xtext.ui.editor.syntaxcoloring.DefaultHighlightingConfiguration.*;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.*;
@@ -150,9 +151,9 @@
}
private void highlightPropertyType(Property property, IHighlightedPositionAcceptor acceptor) {
- AbstractTypeRef ref = property.getType();
- if (!(ref instanceof ComplexTypeLink)) return;
- ComplexType type = ((ComplexTypeLink) ref).getTarget();
+ TypeLink link = property.getType();
+ if (!(link instanceof ComplexTypeLink)) return;
+ ComplexType type = ((ComplexTypeLink) link).getTarget();
if (type instanceof Message) {
highlightFirstFeature(property, PROPERTY__TYPE, acceptor, MESSAGE_ID);
return;
diff --git a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/Protobuf.xtext b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/Protobuf.xtext
index 21120e3..75974a3 100644
--- a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/Protobuf.xtext
+++ b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/Protobuf.xtext
@@ -68,7 +68,7 @@
Option | Property | Group | Enum | MessageExtension;
Property:
- modifier=Modifier type=AbstractTypeRef name=Name '=' index=(LONG | HEX)
+ modifier=Modifier type=TypeLink name=Name '=' index=(LONG | HEX)
('[' fieldOptions+=FieldOption (',' fieldOptions+=FieldOption)* ']')? (';')+;
enum Modifier:
@@ -76,11 +76,11 @@
| optional
| repeated;
-AbstractTypeRef:
- ScalarTypeRef | ComplexTypeLink;
+TypeLink:
+ ScalarTypeLink | ComplexTypeLink;
-ScalarTypeRef:
- scalar=ScalarType;
+ScalarTypeLink:
+ target=ScalarType;
enum ScalarType:
double | float | int32 | int64 | uint32 | uint64 | sint32 | sint64 | fixed32 | fixed64 | sfixed32 | sfixed64 | bool |
diff --git a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/model/util/ModelFinder.java b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/model/util/ModelFinder.java
index 7bf76e2..72f3048 100644
--- a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/model/util/ModelFinder.java
+++ b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/model/util/ModelFinder.java
@@ -86,9 +86,9 @@
* @return the type of the given property.
*/
public ComplexType typeOf(Property p) {
- AbstractTypeRef r = p.getType();
- if (!(r instanceof ComplexTypeLink)) return null;
- return ((ComplexTypeLink) r).getTarget();
+ TypeLink link = p.getType();
+ if (!(link instanceof ComplexTypeLink)) return null;
+ return ((ComplexTypeLink) link).getTarget();
}
/**
@@ -97,9 +97,9 @@
* @return the scalar type of the given property or {@code null} if the type of the given property is not a scalar.
*/
public ScalarType scalarTypeOf(Property p) {
- AbstractTypeRef aTypeRef = (p).getType();
- if (aTypeRef instanceof ScalarTypeRef)
- return ((ScalarTypeRef) aTypeRef).getScalar();
+ TypeLink link = (p).getType();
+ if (link instanceof ScalarTypeLink)
+ return ((ScalarTypeLink) link).getTarget();
return null;
}
diff --git a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/model/util/Properties.java b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/model/util/Properties.java
index 8df03b0..8b80af2 100644
--- a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/model/util/Properties.java
+++ b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/model/util/Properties.java
@@ -40,9 +40,9 @@
* @return {@code true} if the type of the given property is primitive, {@code false} otherwise.
*/
public boolean isPrimitive(Property p) {
- AbstractTypeRef r = p.getType();
- if (!(r instanceof ScalarTypeRef)) return false;
- String typeName = ((ScalarTypeRef) r).getScalar().getName();
+ TypeLink link = p.getType();
+ if (!(link instanceof ScalarTypeLink)) return false;
+ String typeName = ((ScalarTypeLink) link).getTarget().getName();
return !STRING.hasValue(typeName) && !BYTES.hasValue(typeName);
}
@@ -84,12 +84,12 @@
* @return the name of the type of the given {@code Property}.
*/
public String typeNameOf(Property p) {
- AbstractTypeRef r = p.getType();
- if (r instanceof ScalarTypeRef) return ((ScalarTypeRef) r).getScalar().getName();
- if (r instanceof ComplexTypeLink) {
- ComplexType type = ((ComplexTypeLink) r).getTarget();
+ TypeLink link = p.getType();
+ if (link instanceof ScalarTypeLink) return ((ScalarTypeLink) link).getTarget().getName();
+ if (link instanceof ComplexTypeLink) {
+ ComplexType type = ((ComplexTypeLink) link).getTarget();
return type == null ? null : type.getName();
}
- return r.toString();
+ return link.toString();
}
}