Cleaning up grammar.
diff --git a/com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/model/util/FieldOptions_lastFieldSourceFrom_Test.java b/com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/model/util/FieldOptions_sourceOfLastFieldIn_Test.java
similarity index 88%
rename from com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/model/util/FieldOptions_lastFieldSourceFrom_Test.java
rename to com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/model/util/FieldOptions_sourceOfLastFieldIn_Test.java
index 7f21876..755de75 100644
--- a/com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/model/util/FieldOptions_lastFieldSourceFrom_Test.java
+++ b/com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/model/util/FieldOptions_sourceOfLastFieldIn_Test.java
@@ -19,11 +19,11 @@
import com.google.eclipse.protobuf.protobuf.*;
/**
- * Tests for <code>{@link FieldOptions#lastFieldSourceFrom(CustomFieldOption)}</code>.
+ * Tests for <code>{@link FieldOptions#sourceOfLastFieldIn(CustomFieldOption)}</code>.
*
* alruiz@google.com (Alex Ruiz)
*/
-public class FieldOptions_lastFieldSourceFrom_Test {
+public class FieldOptions_sourceOfLastFieldIn_Test {
@Rule public XtextRule xtext = createWith(integrationTestSetup());
@@ -50,7 +50,7 @@
// }
@Test public void should_return_option_field() {
CustomFieldOption option = xtext.find("custom", ").", CustomFieldOption.class);
- MessageField field = (MessageField) fieldOptions.lastFieldSourceFrom(option);
+ MessageField field = (MessageField) fieldOptions.sourceOfLastFieldIn(option);
assertThat(field.getName(), equalTo("count"));
}
}
diff --git a/com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/scoping/Issue131_AddOptionsForService_Test.java b/com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/scoping/Issue131_AddOptionsForService_Test.java
index 13cb80f..28443ba 100644
--- a/com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/scoping/Issue131_AddOptionsForService_Test.java
+++ b/com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/scoping/Issue131_AddOptionsForService_Test.java
@@ -59,7 +59,7 @@
// }
@Test public void should_support_Service_options() {
Option option = xtext.find("code", ")", Option.class);
- IScope scope = provider.scope_OptionSource_optionField(option.getSource(), reference);
+ IScope scope = provider.scope_OptionSource_target(option.getSource(), reference);
assertThat(descriptionsIn(scope), containAll("code", "proto.code", "google.proto.code", "com.google.proto.code",
".com.google.proto.code",
"info", "proto.info", "google.proto.info", "com.google.proto.info",
diff --git a/com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/scoping/Issue147_AddSupportForGroupOptions_Test.java b/com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/scoping/Issue147_AddSupportForGroupOptions_Test.java
index 7036bad..8428302 100644
--- a/com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/scoping/Issue147_AddSupportForGroupOptions_Test.java
+++ b/com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/scoping/Issue147_AddSupportForGroupOptions_Test.java
@@ -56,7 +56,7 @@
// }
@Test public void should_provide_fields_for_native_option() {
NativeFieldOption option = xtext.find("deprecated", NativeFieldOption.class);
- IScope scope = provider.scope_OptionSource_optionField(option.getSource(), reference);
+ IScope scope = provider.scope_OptionSource_target(option.getSource(), reference);
Collection<MessageField> optionSources = descriptor().optionsOfType(FIELD);
assertThat(descriptionsIn(scope), containAll(optionSources));
}
@@ -83,7 +83,7 @@
// }
@Test public void should_provide_fields_for_custom_option() {
CustomFieldOption option = xtext.find("code", ")", CustomFieldOption.class);
- IScope scope = provider.scope_OptionSource_optionField(option.getSource(), reference);
+ IScope scope = provider.scope_OptionSource_target(option.getSource(), reference);
assertThat(descriptionsIn(scope), containAll("code", "proto.code", "google.proto.code", "com.google.proto.code",
".com.google.proto.code",
"info", "proto.info", "google.proto.info", "com.google.proto.info",
diff --git a/com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/scoping/Issue156_AddSupportForEnumValueOptions_Test.java b/com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/scoping/Issue156_AddSupportForEnumValueOptions_Test.java
index eacee33..3d8022b 100644
--- a/com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/scoping/Issue156_AddSupportForEnumValueOptions_Test.java
+++ b/com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/scoping/Issue156_AddSupportForEnumValueOptions_Test.java
@@ -56,7 +56,7 @@
// }
@Test public void should_provide_fields_for_custom_field_option() {
CustomFieldOption option = xtext.find("active", ")", CustomFieldOption.class);
- IScope scope = provider.scope_OptionSource_optionField(option.getSource(), reference);
+ IScope scope = provider.scope_OptionSource_target(option.getSource(), reference);
assertThat(descriptionsIn(scope), containAll("active", ".active"));
}
}
diff --git a/com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/scoping/ProtobufScopeProvider_scope_ExtensionFieldNotationNameSource_extension_Test.java b/com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/scoping/ProtobufScopeProvider_scope_ExtensionFieldNotationNameSource_extension_Test.java
index e8f9a67..46e8709 100644
--- a/com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/scoping/ProtobufScopeProvider_scope_ExtensionFieldNotationNameSource_extension_Test.java
+++ b/com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/scoping/ProtobufScopeProvider_scope_ExtensionFieldNotationNameSource_extension_Test.java
@@ -65,9 +65,9 @@
// }
// }
// };
- @Test public void should_provide_sources_for_field_notation_in_option() {
- FieldNotation notation = xtext.find("google.proto.test.fileopt", "]", FieldNotation.class);
- ExtensionFieldNotationNameSource s = (ExtensionFieldNotationNameSource) notation.getName();
+ @Test public void should_provide_sources_for_aggregate_field() {
+ AggregateField field = xtext.find("google.proto.test.fileopt", "]", AggregateField.class);
+ ExtensionFieldNotationNameSource s = (ExtensionFieldNotationNameSource) field.getName();
IScope scope = provider.scope_ExtensionFieldNotationNameSource_extension(s, reference);
assertThat(descriptionsIn(scope), containAll("google.proto.test.fileopt", ".google.proto.test.fileopt"));
}
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
index 40c211a..4d10274 100644
--- 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
@@ -58,9 +58,9 @@
// option (type) = {
// code: 68
// };
- @Test public void should_provide_sources_for_field_notation_in_option() {
- FieldNotation notation = xtext.find("code", ":", FieldNotation.class);
- NormalFieldNotationNameSource s = (NormalFieldNotationNameSource) notation.getName();
+ @Test public void should_provide_sources_for_aggregate_field() {
+ AggregateField field = xtext.find("code", ":", AggregateField.class);
+ NormalFieldNotationNameSource s = (NormalFieldNotationNameSource) field.getName();
IScope scope = provider.scope_NormalFieldNotationNameSource_property(s, reference);
Message message = xtext.find("Type", " {", Message.class);
assertThat(descriptionsIn(scope), containAllFieldsIn(message));
@@ -87,8 +87,8 @@
// name { value: 'Address' }
// };
@Test public void should_provide_sources_for_nested_field_notation_in_option() {
- FieldNotation notation = xtext.find("value", ":", FieldNotation.class);
- NormalFieldNotationNameSource s = (NormalFieldNotationNameSource) notation.getName();
+ AggregateField field = xtext.find("value", ":", AggregateField.class);
+ NormalFieldNotationNameSource s = (NormalFieldNotationNameSource) field.getName();
IScope scope = provider.scope_NormalFieldNotationNameSource_property(s, reference);
Message message = xtext.find("Names", " {", Message.class);
assertThat(descriptionsIn(scope), containAllFieldsIn(message));
@@ -110,8 +110,8 @@
// optional int target = 1 [(type) = { code: 68 }];
// }
@Test public void should_provide_sources_for_field_notation_in_field_option() {
- FieldNotation notation = xtext.find("code", ":", FieldNotation.class);
- NormalFieldNotationNameSource s = (NormalFieldNotationNameSource) notation.getName();
+ AggregateField field = xtext.find("code", ":", AggregateField.class);
+ NormalFieldNotationNameSource s = (NormalFieldNotationNameSource) field.getName();
IScope scope = provider.scope_NormalFieldNotationNameSource_property(s, reference);
Message message = xtext.find("Type", " {", Message.class);
assertThat(descriptionsIn(scope), containAllFieldsIn(message));
@@ -138,8 +138,8 @@
// optional int target = 1 [(type) = { name: { value: 'Address' } }];
// }
@Test public void should_provide_sources_for_nested_field_notation_in_field_option() {
- FieldNotation notation = xtext.find("value", ":", FieldNotation.class);
- NormalFieldNotationNameSource s = (NormalFieldNotationNameSource) notation.getName();
+ AggregateField field = xtext.find("value", ":", AggregateField.class);
+ NormalFieldNotationNameSource s = (NormalFieldNotationNameSource) field.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.integration.test/src/com/google/eclipse/protobuf/scoping/ProtobufScopeProvider_scope_OptionExtendMessageFieldSource_optionExtendMessageField_Test.java b/com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/scoping/ProtobufScopeProvider_scope_OptionField_target_with_ExtensionOptionField_Test.java
similarity index 79%
rename from com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/scoping/ProtobufScopeProvider_scope_OptionExtendMessageFieldSource_optionExtendMessageField_Test.java
rename to com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/scoping/ProtobufScopeProvider_scope_OptionField_target_with_ExtensionOptionField_Test.java
index 617f43e..499515e 100644
--- a/com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/scoping/ProtobufScopeProvider_scope_OptionExtendMessageFieldSource_optionExtendMessageField_Test.java
+++ b/com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/scoping/ProtobufScopeProvider_scope_OptionField_target_with_ExtensionOptionField_Test.java
@@ -23,11 +23,11 @@
import com.google.eclipse.protobuf.protobuf.*;
/**
- * Tests for <code>{@link ProtobufScopeProvider#scope_OptionExtendMessageFieldSource_optionExtendMessageField(OptionExtendMessageFieldSource, EReference)}</code>.
+ * Tests for <code>{@link ProtobufScopeProvider#scope_OptionField_target(OptionField, EReference)}</code>.
*
* @author alruiz@google.com (Alex Ruiz)
*/
-public class ProtobufScopeProvider_scope_OptionExtendMessageFieldSource_optionExtendMessageField_Test {
+public class ProtobufScopeProvider_scope_OptionField_target_with_ExtensionOptionField_Test {
private static EReference reference;
@@ -66,8 +66,8 @@
// option (type).(active) = true;
@Test public void should_provide_extend_message_fields_for_first_field_in_custom_option() {
CustomOption option = xtext.find("type", ")", CustomOption.class);
- OptionExtendMessageFieldSource codeOptionField = (OptionExtendMessageFieldSource) option.getOptionFields().get(0);
- IScope scope = provider.scope_OptionExtendMessageFieldSource_optionExtendMessageField(codeOptionField, reference);
+ ExtensionOptionField codeOptionField = (ExtensionOptionField) option.getFields().get(0);
+ IScope scope = provider.scope_OptionField_target(codeOptionField, reference);
assertThat(descriptionsIn(scope), containAll("active", "com.google.proto.active", ".com.google.proto.active"));
}
@@ -96,8 +96,8 @@
// }
@Test public void should_provide_message_fields_for_first_field_in_field_custom_option() {
CustomFieldOption option = xtext.find("type", ")", CustomFieldOption.class);
- OptionExtendMessageFieldSource codeOptionField = (OptionExtendMessageFieldSource) option.getOptionFields().get(0);
- IScope scope = provider.scope_OptionExtendMessageFieldSource_optionExtendMessageField(codeOptionField, reference);
+ ExtensionOptionField codeOptionField = (ExtensionOptionField) option.getFields().get(0);
+ IScope scope = provider.scope_OptionField_target(codeOptionField, reference);
assertThat(descriptionsIn(scope), containAll("active", "com.google.proto.active", ".com.google.proto.active"));
}
}
diff --git a/com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/scoping/ProtobufScopeProvider_scope_OptionMessageFieldSource_optionMessageField_Test.java b/com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/scoping/ProtobufScopeProvider_scope_OptionField_target_with_MessageOptionField_Test.java
similarity index 77%
rename from com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/scoping/ProtobufScopeProvider_scope_OptionMessageFieldSource_optionMessageField_Test.java
rename to com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/scoping/ProtobufScopeProvider_scope_OptionField_target_with_MessageOptionField_Test.java
index 592310f..9cafb44 100644
--- a/com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/scoping/ProtobufScopeProvider_scope_OptionMessageFieldSource_optionMessageField_Test.java
+++ b/com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/scoping/ProtobufScopeProvider_scope_OptionField_target_with_MessageOptionField_Test.java
@@ -24,11 +24,11 @@
import com.google.eclipse.protobuf.protobuf.*;
/**
- * Tests for <code>{@link ProtobufScopeProvider#scope_OptionMessageFieldSource_optionMessageField(OptionMessageFieldSource, EReference)}</code>.
+ * Tests for <code>{@link ProtobufScopeProvider#scope_OptionField_target(OptionField, EReference)}</code>.
*
* @author alruiz@google.com (Alex Ruiz)
*/
-public class ProtobufScopeProvider_scope_OptionMessageFieldSource_optionMessageField_Test {
+public class ProtobufScopeProvider_scope_OptionField_target_with_MessageOptionField_Test {
private static EReference reference;
@@ -60,8 +60,8 @@
// option (type).code = 68;
@Test public void should_provide_message_fields_for_first_field_in_custom_option() {
CustomOption option = xtext.find("type", ")", CustomOption.class);
- OptionMessageFieldSource codeOptionField = (OptionMessageFieldSource) option.getOptionFields().get(0);
- IScope scope = provider.scope_OptionMessageFieldSource_optionMessageField(codeOptionField, reference);
+ MessageOptionField codeOptionField = (MessageOptionField) option.getFields().get(0);
+ IScope scope = provider.scope_OptionField_target(codeOptionField, reference);
Message typeMessage = xtext.find("Type", " {", Message.class);
assertThat(descriptionsIn(scope), containAllFieldsIn(typeMessage));
}
@@ -86,8 +86,8 @@
// option (type).code.number = 68;
@Test public void should_provide_message_fields_for_field_in_custom_option() {
CustomOption option = xtext.find("type", ")", CustomOption.class);
- OptionMessageFieldSource numberOptionField = (OptionMessageFieldSource) option.getOptionFields().get(1);
- IScope scope = provider.scope_OptionMessageFieldSource_optionMessageField(numberOptionField, reference);
+ MessageOptionField numberOptionField = (MessageOptionField) option.getFields().get(1);
+ IScope scope = provider.scope_OptionField_target(numberOptionField, reference);
Message codeMessage = xtext.find("Code", " {", Message.class);
assertThat(descriptionsIn(scope), containAllFieldsIn(codeMessage));
}
@@ -106,8 +106,8 @@
// option (type).code = 68;
@Test public void should_provide_group_fields_for_first_field_in_custom_option() {
CustomOption option = xtext.find("type", ")", CustomOption.class, IGNORE_CASE);
- OptionMessageFieldSource codeOptionField = (OptionMessageFieldSource) option.getOptionFields().get(0);
- IScope scope = provider.scope_OptionMessageFieldSource_optionMessageField(codeOptionField, reference);
+ MessageOptionField codeOptionField = (MessageOptionField) option.getFields().get(0);
+ IScope scope = provider.scope_OptionField_target(codeOptionField, reference);
Group groupMessage = xtext.find("Type", " =", Group.class);
assertThat(descriptionsIn(scope), containAllFieldsIn(groupMessage));
}
@@ -130,8 +130,8 @@
// }
@Test public void should_provide_message_fields_for_first_field_in_field_custom_option() {
CustomFieldOption option = xtext.find("type", ")", CustomFieldOption.class);
- OptionMessageFieldSource codeOptionField = (OptionMessageFieldSource) option.getOptionFields().get(0);
- IScope scope = provider.scope_OptionMessageFieldSource_optionMessageField(codeOptionField, reference);
+ MessageOptionField codeOptionField = (MessageOptionField) option.getFields().get(0);
+ IScope scope = provider.scope_OptionField_target(codeOptionField, reference);
Message typeMessage = xtext.find("Type", " {", Message.class);
assertThat(descriptionsIn(scope), containAllFieldsIn(typeMessage));
}
@@ -158,8 +158,8 @@
// }
@Test public void should_provide_message_fields_for_field_in_field_custom_option() {
CustomFieldOption option = xtext.find("type", ")", CustomFieldOption.class);
- OptionMessageFieldSource numberOptionField = (OptionMessageFieldSource) option.getOptionFields().get(1);
- IScope scope = provider.scope_OptionMessageFieldSource_optionMessageField(numberOptionField, reference);
+ MessageOptionField numberOptionField = (MessageOptionField) option.getFields().get(1);
+ IScope scope = provider.scope_OptionField_target(numberOptionField, reference);
Message codeMessage = xtext.find("Code", " {", Message.class);
assertThat(descriptionsIn(scope), containAllFieldsIn(codeMessage));
}
@@ -180,8 +180,8 @@
// }
@Test public void should_provide_group_fields_for_first_field_in_field_custom_option() {
CustomFieldOption option = xtext.find("type", ")", CustomFieldOption.class, IGNORE_CASE);
- OptionMessageFieldSource codeOptionField = (OptionMessageFieldSource) option.getOptionFields().get(0);
- IScope scope = provider.scope_OptionMessageFieldSource_optionMessageField(codeOptionField, reference);
+ MessageOptionField codeOptionField = (MessageOptionField) option.getFields().get(0);
+ IScope scope = provider.scope_OptionField_target(codeOptionField, reference);
Group groupMessage = xtext.find("Type", " =", Group.class);
assertThat(descriptionsIn(scope), containAllFieldsIn(groupMessage));
}
diff --git a/com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/scoping/ProtobufScopeProvider_scope_OptionSource_optionField_Test.java b/com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/scoping/ProtobufScopeProvider_scope_OptionSource_target_Test.java
similarity index 82%
rename from com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/scoping/ProtobufScopeProvider_scope_OptionSource_optionField_Test.java
rename to com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/scoping/ProtobufScopeProvider_scope_OptionSource_target_Test.java
index 0abef3a..c6317fa 100644
--- a/com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/scoping/ProtobufScopeProvider_scope_OptionSource_optionField_Test.java
+++ b/com.google.eclipse.protobuf.integration.test/src/com/google/eclipse/protobuf/scoping/ProtobufScopeProvider_scope_OptionSource_target_Test.java
@@ -27,11 +27,11 @@
import com.google.eclipse.protobuf.protobuf.*;
/**
- * Tests for <code>{@link ProtobufScopeProvider#scope_OptionSource_optionField(OptionSource, EReference)}</code>
+ * Tests for <code>{@link ProtobufScopeProvider#scope_OptionSource_target(OptionSource, EReference)}</code>
*
* @author alruiz@google.com (Alex Ruiz)
*/
-public class ProtobufScopeProvider_scope_OptionSource_optionField_Test {
+public class ProtobufScopeProvider_scope_OptionSource_target_Test {
private static EReference reference;
@@ -50,9 +50,9 @@
// syntax = "proto2";
//
// option optimize_for = SPEED;
- @Test public void should_provide_Property_fields_for_native_option() {
+ @Test public void should_provide_sources_for_native_option() {
Option option = xtext.find("optimize_for", Option.class);
- IScope scope = provider.scope_OptionSource_optionField(option.getSource(), reference);
+ IScope scope = provider.scope_OptionSource_target(option.getSource(), reference);
Collection<MessageField> optionSources = descriptor().optionsOfType(FILE);
assertThat(descriptionsIn(scope), containAll(optionSources));
}
@@ -62,9 +62,9 @@
// message Person {
// optional Type type = 1 [ctype = STRING];
// }
- @Test public void should_provide_Property_fields_for_native_field_option() {
+ @Test public void should_provide_sources_for_native_field_option() {
NativeFieldOption option = xtext.find("ctype", NativeFieldOption.class);
- IScope scope = provider.scope_OptionSource_optionField(option.getSource(), reference);
+ IScope scope = provider.scope_OptionSource_target(option.getSource(), reference);
Collection<MessageField> optionSources = descriptor().optionsOfType(FIELD);
assertThat(descriptionsIn(scope), containAll(optionSources));
}
@@ -85,9 +85,9 @@
// }
//
// option (code) = 68;
- @Test public void should_provide_Property_fields_for_custom_option() {
+ @Test public void should_provide_sources_for_custom_option() {
Option option = xtext.find("code", ")", Option.class);
- IScope scope = provider.scope_OptionSource_optionField(option.getSource(), reference);
+ IScope scope = provider.scope_OptionSource_target(option.getSource(), reference);
assertThat(descriptionsIn(scope), containAll("code", "proto.code", "google.proto.code", "com.google.proto.code",
".com.google.proto.code",
"info", "proto.info", "google.proto.info", "com.google.proto.info",
@@ -111,9 +111,9 @@
// import 'custom-options.proto';
//
// option (test.proto.code) = 68;
- @Test public void should_provide_imported_Property_fields_for_custom_option() {
+ @Test public void should_provide_imported_sources_for_custom_option() {
Option option = xtext.find("code", ")", Option.class);
- IScope scope = provider.scope_OptionSource_optionField(option.getSource(), reference);
+ IScope scope = provider.scope_OptionSource_target(option.getSource(), reference);
assertThat(descriptionsIn(scope), containAll("test.proto.code", ".test.proto.code",
"test.proto.info", ".test.proto.info"));
}
@@ -135,9 +135,9 @@
// import 'custom-options.proto';
//
// option (code) = 68;
- @Test public void should_provide_imported_Property_fields_for_custom_option_with_equal_package() {
+ @Test public void should_provide_imported_sources_for_custom_option_with_equal_package() {
Option option = xtext.find("code", ")", Option.class);
- IScope scope = provider.scope_OptionSource_optionField(option.getSource(), reference);
+ IScope scope = provider.scope_OptionSource_target(option.getSource(), reference);
assertThat(descriptionsIn(scope), containAll("code", "proto.code", "google.proto.code", "com.google.proto.code",
".com.google.proto.code",
"info", "proto.info", "google.proto.info", "com.google.proto.info",
@@ -156,9 +156,9 @@
// message Person {
// optional boolean active = 1 [(code) = 68];
// }
- @Test public void should_provide_Property_fields_for_custom_field_option() {
+ @Test public void should_provide_sources_for_custom_field_option() {
CustomFieldOption option = xtext.find("code", ")", CustomFieldOption.class);
- IScope scope = provider.scope_OptionSource_optionField(option.getSource(), reference);
+ IScope scope = provider.scope_OptionSource_target(option.getSource(), reference);
assertThat(descriptionsIn(scope), containAll("code", "proto.code", "google.proto.code", "com.google.proto.code",
".com.google.proto.code",
"info", "proto.info", "google.proto.info", "com.google.proto.info",
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/contentassist/ProtobufProposalProvider.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/contentassist/ProtobufProposalProvider.java
index 242acd7..d4424c1 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/contentassist/ProtobufProposalProvider.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/contentassist/ProtobufProposalProvider.java
@@ -447,37 +447,37 @@
return imageHelper.getImage(images.imageFor(Option.class));
}
- @Override public void completeCustomOption_OptionFields(EObject model, Assignment assignment,
+ @Override public void completeCustomOption_Fields(EObject model, Assignment assignment,
ContentAssistContext context, ICompletionProposalAcceptor acceptor) {}
- @Override public void completeCustomFieldOption_OptionFields(EObject model, Assignment assignment,
+ @Override public void completeCustomFieldOption_Fields(EObject model, Assignment assignment,
ContentAssistContext context, ICompletionProposalAcceptor acceptor) {}
- @Override public void completeOptionSource_OptionField(EObject model, Assignment assignment,
+ @Override public void completeOptionSource_Target(EObject model, Assignment assignment,
ContentAssistContext context, ICompletionProposalAcceptor acceptor) {}
- @Override public void completeOptionMessageFieldSource_OptionMessageField(EObject model, Assignment assignment,
+ @Override public void completeMessageOptionField_Target(EObject model, Assignment assignment,
ContentAssistContext context, ICompletionProposalAcceptor acceptor) {}
- @Override public void completeOptionExtendMessageFieldSource_OptionExtendMessageField(EObject model,
- Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {}
+ @Override public void completeExtensionOptionField_Target(EObject model, Assignment assignment,
+ ContentAssistContext context, ICompletionProposalAcceptor acceptor) {}
- @Override public void complete_OptionMessageFieldSource(EObject model, RuleCall ruleCall,
+ @Override public void complete_MessageOptionField(EObject model, RuleCall ruleCall,
ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
EObject e = findActualSemanticObjectFor(context.getCurrentNode());
if (e instanceof Protobuf) e = model;
Collection<IEObjectDescription> scope = emptySet();
if (e instanceof CustomOption) {
CustomOption option = (CustomOption) e;
- scope = scoping().findMessageFieldScope(option);
+ scope = scoping().findFieldScope(option);
}
if (e instanceof CustomFieldOption) {
CustomFieldOption option = (CustomFieldOption) e;
- scope = scoping().findMessageFieldScope(option);
+ scope = scoping().findFieldScope(option);
}
- if (e instanceof OptionMessageFieldSource) {
- OptionMessageFieldSource source = (OptionMessageFieldSource) e;
- scope = scoping().findScope(source);
+ if (e instanceof MessageOptionField) {
+ MessageOptionField field = (MessageOptionField) e;
+ scope = scoping().findScope(field);
}
for (IEObjectDescription d : descriptionChooser.shortestQualifiedNamesIn(scope)) {
Image image = imageHelper.getImage(images.imageFor(d.getEObjectOrProxy()));
@@ -485,21 +485,22 @@
}
}
- @Override public void complete_OptionExtendMessageFieldSource(EObject model, RuleCall ruleCall,
+ // TODO fix parenthesis
+ @Override public void complete_ExtensionOptionField(EObject model, RuleCall ruleCall,
ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
EObject e = findActualSemanticObjectFor(context.getCurrentNode());
if (e instanceof Protobuf) e = model;
Collection<IEObjectDescription> scope = emptySet();
if (e instanceof CustomOption) {
CustomOption option = (CustomOption) e;
- scope = scoping().findExtendMessageFieldScope(option);
+ scope = scoping().findFieldScope(option);
}
if (e instanceof CustomFieldOption) {
CustomFieldOption option = (CustomFieldOption) e;
- scope = scoping().findExtendMessageFieldScope(option);
+ scope = scoping().findFieldScope(option);
}
- if (e instanceof OptionExtendMessageFieldSource) {
- OptionExtendMessageFieldSource source = (OptionExtendMessageFieldSource) e;
+ if (e instanceof ExtensionOptionField) {
+ ExtensionOptionField source = (ExtensionOptionField) e;
scope = scoping().findScope(source);
}
for (IEObjectDescription d : descriptionChooser.shortestQualifiedNamesIn(scope)) {
@@ -532,7 +533,7 @@
// TODO content assist returns "{"
if (!(model instanceof CustomFieldOption)) return;
CustomFieldOption option = (CustomFieldOption) model;
- IndexedElement e = fieldOptions.lastFieldSourceFrom(option);
+ IndexedElement e = fieldOptions.sourceOfLastFieldIn(option);
if (e == null) e = fieldOptions.rootSourceOf(option);
if (e instanceof MessageField) {
proposeDefaultValue((MessageField) e, context, acceptor);
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 f854c15..42d2b7f 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
@@ -122,12 +122,12 @@
private void highlightOptions(IndexedElement element, IHighlightedPositionAcceptor acceptor) {
for (FieldOption option : indexedElements.fieldOptionsOf(element)) {
- ValueLink link = option.getValue();
- if (link instanceof LiteralLink) {
+ Value value = option.getValue();
+ if (value instanceof LiteralLink) {
highlightFirstFeature(option, FIELD_OPTION__VALUE, acceptor, ENUM_LITERAL_ID);
return;
}
- if (link instanceof NumberLink) {
+ if (value instanceof NumberLink) {
highlightFirstFeature(option, FIELD_OPTION__VALUE, acceptor, NUMBER_ID);
}
}
@@ -208,12 +208,12 @@
if (element != null) {
highlightFirstFeature(option, OPTION__SOURCE, acceptor, DEFAULT_ID);
}
- ValueLink link = option.getValue();
- if (link instanceof LiteralLink) {
+ Value value = option.getValue();
+ if (value instanceof LiteralLink) {
highlightFirstFeature(option, OPTION__VALUE, acceptor, ENUM_LITERAL_ID);
return;
}
- if (link instanceof NumberLink) {
+ if (value instanceof NumberLink) {
highlightFirstFeature(option, OPTION__VALUE, acceptor, NUMBER_ID);
}
}
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/labeling/Labels.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/labeling/Labels.java
index f714048..f9ddbd5 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/labeling/Labels.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/labeling/Labels.java
@@ -74,23 +74,23 @@
b.append(name);
if (isCustomOption) b.append(")");
if (option instanceof CustomOption) {
- appendFields(b, ((CustomOption) option).getOptionFields());
+ appendFields(b, ((CustomOption) option).getFields());
}
if (option instanceof CustomFieldOption) {
- appendFields(b, ((CustomFieldOption) option).getOptionFields());
+ appendFields(b, ((CustomFieldOption) option).getFields());
}
return b.toString();
}
- private void appendFields(StringBuilder b, List<OptionFieldSource> fields) {
- for (OptionFieldSource field : fields) {
+ private void appendFields(StringBuilder b, List<OptionField> fields) {
+ for (OptionField field : fields) {
b.append(".");
- if (field instanceof OptionMessageFieldSource) {
- IndexedElement source = ((OptionMessageFieldSource) field).getOptionMessageField();
+ if (field instanceof MessageOptionField) {
+ IndexedElement source = ((MessageOptionField) field).getTarget();
b.append(options.nameForOption(source));
}
- if (field instanceof OptionExtendMessageFieldSource) {
- IndexedElement source = ((OptionExtendMessageFieldSource) field).getOptionExtendMessageField();
+ if (field instanceof ExtensionOptionField) {
+ IndexedElement source = ((ExtensionOptionField) field).getTarget();
b.append("(")
.append(options.nameForOption(source))
.append(")");
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 a37934e..fbed3c2 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
@@ -134,57 +134,57 @@
NativeOption | CustomOption;
NativeOption:
- 'option' source=OptionSource '=' value=ValueLink ';';
+ 'option' source=OptionSource '=' value=Value ';';
CustomOption:
'option' '(' source=OptionSource ')'
- ('.' optionFields+=OptionFieldSource ('.' optionFields+=OptionFieldSource)*)? '=' value=ValueLink ';';
+ ('.' fields+=OptionField ('.' fields+=OptionField)*)? '=' value=Value ';';
FieldOption:
DefaultValueFieldOption | NativeFieldOption | CustomFieldOption;
DefaultValueFieldOption:
- 'default' '=' value=ValueLink;
+ 'default' '=' value=Value;
NativeFieldOption:
- source=OptionSource '=' value=ValueLink;
+ source=OptionSource '=' value=Value;
CustomFieldOption:
'(' source=OptionSource ')'
- ('.' optionFields+=OptionFieldSource ('.' optionFields+=OptionFieldSource)*)? '=' value=ValueLink;
+ ('.' fields+=OptionField ('.' fields+=OptionField)*)? '=' value=Value;
OptionSource:
- optionField=[IndexedElement|QualifiedName];
+ target=[IndexedElement|QualifiedName];
-OptionFieldSource:
- OptionMessageFieldSource | OptionExtendMessageFieldSource;
+OptionField:
+ MessageOptionField | ExtensionOptionField;
-OptionMessageFieldSource:
- optionMessageField=[IndexedElement];
+MessageOptionField:
+ target=[IndexedElement];
-OptionExtendMessageFieldSource:
- '(' optionExtendMessageField=[IndexedElement|QualifiedName] ')';
+ExtensionOptionField:
+ '(' target=[IndexedElement|QualifiedName] ')';
IndexedElement:
MessageField | Group;
-ValueLink:
- MessageNotation | SimpleValueLink;
+Value:
+ AggregateValue | SimpleValueLink;
// { foo: 1, bar: 2 }
-MessageNotation:
+AggregateValue:
'{'
- fields+=FieldNotation ((',')? fields+=FieldNotation)*
+ fields+=AggregateField ((',')? fields+=AggregateField)*
'}';
-FieldNotation:
+AggregateField:
SimpleFieldNotation | ComplexFieldNotation;
SimpleFieldNotation:
name=FieldNotationNameSource ':' value=SimpleValueLink;
ComplexFieldNotation:
- name=FieldNotationNameSource ':'? values=MessageNotation;
+ name=FieldNotationNameSource ':'? values=AggregateValue;
FieldNotationNameSource:
NormalFieldNotationNameSource | ExtensionFieldNotationNameSource;
diff --git a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/model/util/FieldOptions.java b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/model/util/FieldOptions.java
index f212187..01081da 100644
--- a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/model/util/FieldOptions.java
+++ b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/model/util/FieldOptions.java
@@ -66,7 +66,7 @@
* cannot be found.
*/
public IndexedElement sourceOf(CustomFieldOption option) {
- IndexedElement e = lastFieldSourceFrom(option);
+ IndexedElement e = sourceOfLastFieldIn(option);
if (e == null) e = rootSourceOf(option);
return e;
}
@@ -91,7 +91,7 @@
CustomFieldOption customOption = (CustomFieldOption) option;
source = customOption.getSource();
}
- return (source == null) ? null : source.getOptionField();
+ return (source == null) ? null : source.getTarget();
}
/**
@@ -105,10 +105,10 @@
* @return the last field of the given {@code CustomFieldOption} is referring to, or {@code null} if one cannot be
* found.
*/
- public IndexedElement lastFieldSourceFrom(CustomFieldOption option) {
- List<OptionFieldSource> fields = option.getOptionFields();
+ public IndexedElement sourceOfLastFieldIn(CustomFieldOption option) {
+ List<OptionField> fields = option.getFields();
if (fields.isEmpty()) return null;
- OptionFieldSource last = fields.get(fields.size() - 1);
+ OptionField last = fields.get(fields.size() - 1);
return optionFields.sourceOf(last);
}
}
diff --git a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/model/util/OptionFields.java b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/model/util/OptionFields.java
index 7956532..77bfc8a 100644
--- a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/model/util/OptionFields.java
+++ b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/model/util/OptionFields.java
@@ -21,17 +21,15 @@
/**
* Returns the field the given option field is referring to.
- * @param fieldSource the given option field.
+ * @param field the given option field.
* @return the field the given option field is referring to, or {@code null} if one cannot be found.
*/
- public IndexedElement sourceOf(OptionFieldSource fieldSource) {
- if (fieldSource instanceof OptionMessageFieldSource) {
- OptionMessageFieldSource source = (OptionMessageFieldSource) fieldSource;
- return source.getOptionMessageField();
+ public IndexedElement sourceOf(OptionField field) {
+ if (field instanceof MessageOptionField) {
+ return ((MessageOptionField) field).getTarget();
}
- if (fieldSource instanceof OptionExtendMessageFieldSource) {
- OptionExtendMessageFieldSource source = (OptionExtendMessageFieldSource) fieldSource;
- return source.getOptionExtendMessageField();
+ if (field instanceof ExtensionOptionField) {
+ return ((ExtensionOptionField) field).getTarget();
}
return null;
}
diff --git a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/model/util/Options.java b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/model/util/Options.java
index 17e7d16..6732395 100644
--- a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/model/util/Options.java
+++ b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/model/util/Options.java
@@ -66,7 +66,7 @@
*/
public IndexedElement rootSourceOf(Option option) {
OptionSource source = option.getSource();
- return (source == null) ? null : source.getOptionField();
+ return (source == null) ? null : source.getTarget();
}
/**
@@ -80,9 +80,9 @@
* @return the last field of the given {@code CustomOption} is referring to, or {@code null} if one cannot be found.
*/
public IndexedElement lastFieldSourceFrom(CustomOption option) {
- List<OptionFieldSource> fields = option.getOptionFields();
+ List<OptionField> fields = option.getFields();
if (fields.isEmpty()) return null;
- OptionFieldSource last = fields.get(fields.size() - 1);
+ OptionField last = fields.get(fields.size() - 1);
return optionFields.sourceOf(last);
}
diff --git a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/CustomOptionFieldScopeFinder.java b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/CustomOptionFieldScopeFinder.java
index 12fa210..7140cb1 100644
--- a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/CustomOptionFieldScopeFinder.java
+++ b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/CustomOptionFieldScopeFinder.java
@@ -31,13 +31,13 @@
@Inject private Options options;
@Inject private QualifiedNameDescriptions qualifiedNameDescriptions;
- Collection<IEObjectDescription> findScope(CustomOption option, OptionMessageFieldSource source) {
- return findScope(option, source, new MessageFieldDescriptorProvider());
+ Collection<IEObjectDescription> findScope(CustomOption option, OptionField field) {
+ return findScope(option, field, descriptionsProvider(field));
}
- private Collection<IEObjectDescription> findScope(final CustomOption option, EObject source,
+ private Collection<IEObjectDescription> findScope(final CustomOption option, OptionField field,
IEObjectDescriptionsProvider provider) {
- IndexedElement e = referredField(source, option.getOptionFields(), new Provider<IndexedElement>() {
+ IndexedElement e = referredField(field, option.getFields(), new Provider<IndexedElement>() {
@Override public IndexedElement get() {
return options.rootSourceOf(option);
}
@@ -46,21 +46,18 @@
return emptySet();
}
- Collection<IEObjectDescription> findScope(CustomFieldOption option, OptionMessageFieldSource source) {
- return findScope(option, source, new MessageFieldDescriptorProvider());
+ Collection<IEObjectDescription> findScope(CustomFieldOption option, OptionField field) {
+ return findScope(option, field, descriptionsProvider(field));
+ }
+
+ private IEObjectDescriptionsProvider descriptionsProvider(OptionField field) {
+ if (field instanceof MessageOptionField) return new MessageFieldDescriptorProvider();
+ return new ExtensionFieldDescriptorProvider();
}
- Collection<IEObjectDescription> findScope(CustomOption option, OptionExtendMessageFieldSource source) {
- return findScope(option, source, new ExtendMessageFieldDescriptorProvider());
- }
-
- Collection<IEObjectDescription> findScope(CustomFieldOption option, OptionExtendMessageFieldSource source) {
- return findScope(option, source, new ExtendMessageFieldDescriptorProvider());
- }
-
- private Collection<IEObjectDescription> findScope(final CustomFieldOption option, EObject source,
+ private Collection<IEObjectDescription> findScope(final CustomFieldOption option, OptionField field,
IEObjectDescriptionsProvider provider) {
- IndexedElement e = referredField(source, option.getOptionFields(), new Provider<IndexedElement>() {
+ IndexedElement e = referredField(field, option.getFields(), new Provider<IndexedElement>() {
@Override public IndexedElement get() {
return fieldOptions.rootSourceOf(option);
}
@@ -69,18 +66,18 @@
return emptySet();
}
- private IndexedElement referredField(EObject source, List<OptionFieldSource> allFieldSources,
+ private IndexedElement referredField(OptionField field, List<OptionField> allFields,
Provider<IndexedElement> provider) {
- OptionFieldSource previous = null;
+ OptionField previous = null;
boolean isFirstField = true;
- for (OptionFieldSource s : allFieldSources) {
- if (s == source) {
+ for (OptionField current : allFields) {
+ if (current == field) {
return (isFirstField) ? provider.get() : optionFields.sourceOf(previous);
}
- previous = s;
+ previous = current;
isFirstField = false;
}
- if (source == null) {
+ if (field == null) {
if (previous == null) return provider.get();
return optionFields.sourceOf(previous);
}
@@ -113,7 +110,7 @@
}
}
- private class ExtendMessageFieldDescriptorProvider implements IEObjectDescriptionsProvider {
+ private class ExtensionFieldDescriptorProvider implements IEObjectDescriptionsProvider {
@Override public Collection<IEObjectDescription> fieldsInTypeOf(IndexedElement e) {
if (!(e instanceof MessageField)) return emptyList();
Message fieldType = modelFinder.messageTypeOf((MessageField) e);
diff --git a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/FieldNotationScopeFinder.java b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/FieldNotationScopeFinder.java
index 56af398..0c90c7d 100644
--- a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/FieldNotationScopeFinder.java
+++ b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/FieldNotationScopeFinder.java
@@ -32,8 +32,8 @@
Collection<IEObjectDescription> sourceOf(FieldNotationNameSource s) {
EObject container = s.eContainer();
- if (!(container instanceof FieldNotation)) return emptySet();
- MessageField field = sourceOf((FieldNotation) container);
+ if (!(container instanceof AggregateField)) return emptySet();
+ MessageField field = sourceOf((AggregateField) container);
if (field == null) return emptySet();
if (s instanceof NormalFieldNotationNameSource) {
return propertiesInTypeOf(field);
@@ -41,10 +41,10 @@
return propertiesInExtendMessageOf(field);
}
- private MessageField sourceOf(FieldNotation notation) {
- EObject container = notation.eContainer();
+ private MessageField sourceOf(AggregateField field) {
+ EObject container = field.eContainer();
IndexedElement source = null;
- if (container instanceof MessageNotation) {
+ if (container instanceof AggregateValue) {
container = container.eContainer();
if (container instanceof CustomOption) {
CustomOption option = (CustomOption) container;
diff --git a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/ProtobufScopeProvider.java b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/ProtobufScopeProvider.java
index 0e1f131..012bf69 100644
--- a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/ProtobufScopeProvider.java
+++ b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/ProtobufScopeProvider.java
@@ -47,8 +47,8 @@
@Inject private TypeScopeFinder typeScopeFinder;
@SuppressWarnings("unused")
- public IScope scope_ComplexTypeLink_target(ComplexTypeLink t, EReference r) {
- EObject c = t.eContainer();
+ public IScope scope_ComplexTypeLink_target(ComplexTypeLink link, EReference r) {
+ EObject c = link.eContainer();
if (c instanceof MessageField) {
return createScope(findTypeScope(c));
}
@@ -61,8 +61,8 @@
}
@SuppressWarnings("unused")
- public IScope scope_MessageLink_target(MessageLink m, EReference r) {
- return createScope(findMessageScope(m));
+ public IScope scope_MessageLink_target(MessageLink link, EReference r) {
+ return createScope(findMessageScope(link));
}
@Override public Collection<IEObjectDescription> findMessageScope(EObject o) {
@@ -71,8 +71,8 @@
}
@SuppressWarnings("unused")
- public IScope scope_LiteralLink_target(LiteralLink l, EReference r) {
- EObject container = l.eContainer();
+ public IScope scope_LiteralLink_target(LiteralLink link, EReference r) {
+ EObject container = link.eContainer();
Enum anEnum = null;
if (container instanceof DefaultValueFieldOption) {
container = container.eContainer();
@@ -102,7 +102,7 @@
}
@SuppressWarnings("unused")
- public IScope scope_OptionSource_optionField(OptionSource s, EReference r) {
+ public IScope scope_OptionSource_target(OptionSource s, EReference r) {
EObject c = s.eContainer();
if (c instanceof NativeOption) {
NativeOption option = (NativeOption) c;
@@ -124,87 +124,54 @@
return createScope(descriptions);
}
- @Override public Collection<IEObjectDescription> findScope(CustomOption o) {
- OptionType optionType = typeOf(o);
+ @Override public Collection<IEObjectDescription> findScope(CustomOption option) {
+ OptionType optionType = typeOf(option);
Collection<IEObjectDescription> descriptions = emptySet();
if (optionType != null) {
- descriptions = astWalker.traverseAst(o, customOptionScopeFinder, optionType);
+ descriptions = astWalker.traverseAst(option, customOptionScopeFinder, optionType);
}
return descriptions;
}
- @Override public Collection<IEObjectDescription> findScope(CustomFieldOption o) {
- OptionType optionType = typeOf(o);
+ @Override public Collection<IEObjectDescription> findScope(CustomFieldOption option) {
+ OptionType optionType = typeOf(option);
Collection<IEObjectDescription> descriptions = emptySet();
if (optionType != null) {
- descriptions = astWalker.traverseAst(o, customOptionScopeFinder, optionType);
+ descriptions = astWalker.traverseAst(option, customOptionScopeFinder, optionType);
}
return descriptions;
}
@SuppressWarnings("unused")
- public IScope scope_OptionMessageFieldSource_optionMessageField(OptionMessageFieldSource s, EReference r) {
- return createScope(findScope(s));
+ public IScope scope_OptionField_target(OptionField field, EReference r) {
+ return createScope(findScope(field));
}
- @Override public Collection<IEObjectDescription> findScope(OptionMessageFieldSource s) {
- EObject container = s.eContainer();
+ @Override public Collection<IEObjectDescription> findScope(OptionField field) {
+ EObject container = field.eContainer();
if (container instanceof CustomOption) {
- return findSources((CustomOption) container, s);
+ return findSources((CustomOption) container, field);
}
if (container instanceof CustomFieldOption) {
- return findSources((CustomFieldOption) container, s);
+ return findSources((CustomFieldOption) container, field);
}
return emptySet();
}
- @Override public Collection<IEObjectDescription> findMessageFieldScope(CustomOption o) {
- return findSources(o, (OptionMessageFieldSource) null);
+ @Override public Collection<IEObjectDescription> findFieldScope(CustomOption option) {
+ return findSources(option, (MessageOptionField) null);
}
- @Override public Collection<IEObjectDescription> findMessageFieldScope(CustomFieldOption o) {
- return findSources(o, (OptionMessageFieldSource) null);
+ @Override public Collection<IEObjectDescription> findFieldScope(CustomFieldOption option) {
+ return findSources(option, (MessageOptionField) null);
}
- private Collection<IEObjectDescription> findSources(CustomOption o, OptionMessageFieldSource s) {
- return customOptionFieldScopeFinder.findScope(o, s);
+ private Collection<IEObjectDescription> findSources(CustomOption option,OptionField field) {
+ return customOptionFieldScopeFinder.findScope(option, field);
}
- private Collection<IEObjectDescription> findSources(CustomFieldOption o, OptionMessageFieldSource s) {
- return customOptionFieldScopeFinder.findScope(o, s);
- }
-
- @SuppressWarnings("unused")
- public IScope scope_OptionExtendMessageFieldSource_optionExtendMessageField(OptionExtendMessageFieldSource s,
- EReference r) {
- return createScope(findScope(s));
- }
-
- @Override public Collection<IEObjectDescription> findScope(OptionExtendMessageFieldSource s) {
- EObject container = s.eContainer();
- if (container instanceof CustomOption) {
- return findSources((CustomOption) container, s);
- }
- if (container instanceof CustomFieldOption) {
- return findSources((CustomFieldOption) container, s);
- }
- return emptySet();
- }
-
- @Override public Collection<IEObjectDescription> findExtendMessageFieldScope(CustomOption o) {
- return findSources(o, (OptionExtendMessageFieldSource) null);
- }
-
- @Override public Collection<IEObjectDescription> findExtendMessageFieldScope(CustomFieldOption o) {
- return findSources(o, (OptionExtendMessageFieldSource) null);
- }
-
- private Collection<IEObjectDescription> findSources(CustomOption option, OptionExtendMessageFieldSource s) {
- return customOptionFieldScopeFinder.findScope(option, s);
- }
-
- private Collection<IEObjectDescription> findSources(CustomFieldOption option, OptionExtendMessageFieldSource o) {
- return customOptionFieldScopeFinder.findScope(option, o);
+ private Collection<IEObjectDescription> findSources(CustomFieldOption option, OptionField field) {
+ return customOptionFieldScopeFinder.findScope(option, field);
}
@SuppressWarnings("unused")
diff --git a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/Scoping.java b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/Scoping.java
index 813a810..5deda46 100644
--- a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/Scoping.java
+++ b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/Scoping.java
@@ -20,21 +20,15 @@
*/
public interface Scoping {
- Collection<IEObjectDescription> findScope(CustomOption o);
+ Collection<IEObjectDescription> findScope(CustomOption option);
- Collection<IEObjectDescription> findScope(CustomFieldOption o);
+ Collection<IEObjectDescription> findScope(CustomFieldOption option);
- Collection<IEObjectDescription> findScope(OptionMessageFieldSource s);
+ Collection<IEObjectDescription> findScope(OptionField field);
- Collection<IEObjectDescription> findScope(OptionExtendMessageFieldSource s);
+ Collection<IEObjectDescription> findFieldScope(CustomOption option);
- Collection<IEObjectDescription> findMessageFieldScope(CustomOption o);
-
- Collection<IEObjectDescription> findMessageFieldScope(CustomFieldOption o);
-
- Collection<IEObjectDescription> findExtendMessageFieldScope(CustomOption o);
-
- Collection<IEObjectDescription> findExtendMessageFieldScope(CustomFieldOption o);
+ Collection<IEObjectDescription> findFieldScope(CustomFieldOption option);
Collection<IEObjectDescription> findTypeScope(EObject o);
diff --git a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/validation/ProtobufJavaValidator.java b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/validation/ProtobufJavaValidator.java
index c9f0265..4ac564b 100644
--- a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/validation/ProtobufJavaValidator.java
+++ b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/validation/ProtobufJavaValidator.java
@@ -50,7 +50,7 @@
@Check public void checkDefaultValueType(FieldOption option) {
if (!fieldOptions.isDefaultValueOption(option)) return;
MessageField field = (MessageField) option.eContainer();
- ValueLink defaultValue = option.getValue();
+ Value defaultValue = option.getValue();
if (properties.isString(field)) {
if (defaultValue instanceof StringLink) return;
error(expectedString, FIELD_OPTION__VALUE);