In progress: [Issue 121] Nested message support in custom options.
diff --git a/com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/scoping/ProtobufScopeProvider_scope_NormalFieldNotationNameSource_property_Test.java b/com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/scoping/ProtobufScopeProvider_scope_NormalFieldNotationNameSource_property_Test.java
new file mode 100644
index 0000000..bb7e64b
--- /dev/null
+++ b/com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/scoping/ProtobufScopeProvider_scope_NormalFieldNotationNameSource_property_Test.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2011 Google Inc.
+ *
+ * All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse
+ * Public License v1.0 which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ */
+package com.google.eclipse.protobuf.scoping;
+
+import static com.google.eclipse.protobuf.junit.core.Setups.integrationTestSetup;
+import static com.google.eclipse.protobuf.junit.core.XtextRule.createWith;
+import static com.google.eclipse.protobuf.scoping.ContainAllFieldsInMessage.containAllFieldsIn;
+import static com.google.eclipse.protobuf.scoping.IEObjectDescriptions.descriptionsIn;
+import static org.junit.Assert.assertThat;
+import static org.mockito.Mockito.mock;
+
+import com.google.eclipse.protobuf.junit.core.XtextRule;
+import com.google.eclipse.protobuf.protobuf.*;
+
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.xtext.scoping.IScope;
+import org.junit.*;
+
+/**
+ * Tests for <code>{@link ProtobufScopeProvider#scope_NormalFieldNotationNameSource_property(NormalFieldNotationNameSource, EReference)}</code>
+ *
+ * @author alruiz@google.com (Alex Ruiz)
+ */
+public class ProtobufScopeProvider_scope_NormalFieldNotationNameSource_property_Test {
+
+ private static EReference reference;
+
+ @BeforeClass public static void setUpOnce() {
+ reference = mock(EReference.class);
+ }
+
+ @Rule public XtextRule xtext = createWith(integrationTestSetup());
+
+ private ProtobufScopeProvider provider;
+
+ @Before public void setUp() {
+ provider = xtext.getInstanceOf(ProtobufScopeProvider.class);
+ }
+
+ // syntax = "proto2";
+ //
+ // import "google/protobuf/descriptor.proto";
+ //
+ // message Type {
+ // optional int32 code = 1;
+ // }
+ //
+ // extend google.protobuf.FileOptions {
+ // optional Type type = 15478479;
+ // }
+ //
+ // option (type) = {
+ // code: 68
+ // };
+ @Test public void should_provide_property_if_container_is_CustomOption() {
+ FieldNotation notation = xtext.find("code", ":", FieldNotation.class);
+ NormalFieldNotationNameSource s = (NormalFieldNotationNameSource) notation.getName();
+ IScope scope = provider.scope_NormalFieldNotationNameSource_property(s, reference);
+ Message message = xtext.find("Type", " {", Message.class);
+ assertThat(descriptionsIn(scope), containAllFieldsIn(message));
+ }
+
+ // syntax = "proto2";
+ //
+ // import "google/protobuf/descriptor.proto";
+ //
+ // message Type {
+ // optional int32 code = 1;
+ // optional Names name = 2;
+ // }
+ //
+ // message Names {
+ // optional string value = 1;
+ // }
+ //
+ // extend google.protobuf.FileOptions {
+ // optional Type type = 15478479;
+ // }
+ //
+ // option (type) = {
+ // name { value: 'Address' }
+ // };
+ @Test public void should_provide_property_if_notation_is_nested() {
+ FieldNotation notation = xtext.find("value", ":", FieldNotation.class);
+ NormalFieldNotationNameSource s = (NormalFieldNotationNameSource) notation.getName();
+ IScope scope = provider.scope_NormalFieldNotationNameSource_property(s, reference);
+ Message message = xtext.find("Names", " {", Message.class);
+ assertThat(descriptionsIn(scope), containAllFieldsIn(message));
+ }
+}
diff --git a/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/junit/core/Finder.java b/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/junit/core/Finder.java
index 9fb02e7..0eda06c 100644
--- a/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/junit/core/Finder.java
+++ b/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/junit/core/Finder.java
@@ -27,7 +27,7 @@
*/
class Finder {
- private static final String[] FEATURE_NAMES = { "name", "message", "type", "source", "optionField" };
+ private static final String[] FEATURE_NAMES = { "message", "name", "optionField", "property", "source", "type" };
private final String protoAsText;
private final AbstractNode root;
diff --git a/com.google.eclipse.protobuf.ui/icons/pb-ro.gif b/com.google.eclipse.protobuf.ui/icons/pb-ro.gif
index ececd94..e2c9c5e 100644
--- a/com.google.eclipse.protobuf.ui/icons/pb-ro.gif
+++ b/com.google.eclipse.protobuf.ui/icons/pb-ro.gif
Binary files differ
diff --git a/com.google.eclipse.protobuf.ui/icons/pb.gif b/com.google.eclipse.protobuf.ui/icons/pb.gif
index 4fcebf9..762a318 100644
--- a/com.google.eclipse.protobuf.ui/icons/pb.gif
+++ b/com.google.eclipse.protobuf.ui/icons/pb.gif
Binary files differ