Fixed: [Issue 7] Add support for services in grammar https://code.google.com/p/protobuf-dt/issues/detail?id=7 Added support for services in the grammar. Added icon for "service" for Outline View and content-assist.
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/labeling/Images.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/labeling/Images.java index c53092b..cabd71b 100644 --- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/labeling/Images.java +++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/labeling/Images.java
@@ -47,6 +47,7 @@ IMAGES_BY_TYPE.put(Option.class, "option.gif"); IMAGES_BY_TYPE.put(Package.class, "package.gif"); IMAGES_BY_TYPE.put(Protobuf.class, "protobuf.gif"); + IMAGES_BY_TYPE.put(Service.class, "service.gif"); } private static final List<String> STANDALONE_IMAGES = asList("extensions.gif");
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/outline/ProtobufOutlineTreeProvider.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/outline/ProtobufOutlineTreeProvider.java index 0b6faa7..02334ba 100644 --- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/outline/ProtobufOutlineTreeProvider.java +++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/outline/ProtobufOutlineTreeProvider.java
@@ -19,11 +19,15 @@ */ public class ProtobufOutlineTreeProvider extends DefaultOutlineTreeProvider { + boolean _isLeaf(Option o) { + return true; + } + boolean _isLeaf(Property p) { return true; } - boolean _isLeaf(Option o) { + boolean _isLeaf(Service s) { return true; } }
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 944e1b2..30c0022 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
@@ -33,7 +33,7 @@ 'option' name=ID '=' value=ValueRef ';'; ProtobufElement: - Type | ExtendMessage; + Type | ExtendMessage | Service; Type: Message | Enum; @@ -121,6 +121,18 @@ elements+=MessageElement* '}'; +Service: + 'service' name=ID '{' + rpc=Rpc + '}'; + +Rpc: + 'rpc' name=ID '(' argType=MessageReference ')' 'returns' '(' returnType=MessageReference ')' ';' +; + +MessageReference: + type=[Message | QualifiedName]; + terminal INT returns ecore::EInt: ('0'..'9')+; terminal FLOAT returns ecore::EFloat: ('0'..'9')* ('.' ('0'..'9')+)?; \ No newline at end of file