Package com.google.eclipse.protobuf.protobuf

Examples of com.google.eclipse.protobuf.protobuf.MessageField


  //
  // message Person {
  //   optional long id = 1;
  // }
  @Test public void should_not_create_error_if_field_index_is_greater_than_zero() {
    MessageField field = xtext.find("id", MessageField.class);
    validator.checkTagNumberIsGreaterThanZero(field);
    verifyZeroInteractions(messageAcceptor);
  }
View Full Code Here


  }

  @Override public void completeNativeOption_Value(EObject model, Assignment assignment,
      ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
    NativeOption option = (NativeOption) model;
    MessageField optionSource = (MessageField) options.rootSourceOf(option);
    if (optionSource == null) {
      return;
    }
    ProtoDescriptor descriptor = descriptorProvider.primaryDescriptor();
    Enum enumType = descriptor.enumTypeOf(optionSource);
View Full Code Here

      ICompletionProposalAcceptor acceptor) {
    proposeAndAccept(proposalText.toString(), context, acceptor);
  }

  private boolean isBoolProposalValid(ContentAssistContext context) {
    MessageField field = fieldFrom(context);
    return field != null && messageFields.isBool(field);
  }
View Full Code Here

  // syntax = "proto2";
  //
  // option java_package = 'com.google.eclipse.protobuf.tests';
  @Test public void should_return_source_of_native_option() {
    Option option = xtext.find("java_package", Option.class);
    MessageField field = (MessageField) options.rootSourceOf(option);
    assertThat(field.getName(), equalTo("java_package"));
  }
View Full Code Here

  // }
  //
  // option (encoding) = 'UTF-8';
  @Test public void should_return_source_of_custom_option() {
    Option option = xtext.find("encoding", ")", Option.class);
    MessageField field = (MessageField) options.rootSourceOf(option);
    assertThat(field.getName(), equalTo("encoding"));
  }
View Full Code Here

  @SuppressWarnings("unused")
  public IScope scope_ComplexTypeLink_target(ComplexTypeLink link, EReference r) {
    EObject c = link.eContainer();
    if (c instanceof MessageField) {
      MessageField field = (MessageField) c;
      Collection<IEObjectDescription> complexTypes = potentialComplexTypesFor(field);
      return createScope(complexTypes);
    }
    return createEmptyScope();
  }
View Full Code Here

  // message Person {
  //   optional boolean active = 1 [deprecated = false];
  // }
  @Test public void should_return_field_of_native_field_option() {
    FieldOption option = xtext.find("deprecated", FieldOption.class);
    MessageField field = (MessageField) options.rootSourceOf(option);
    assertThat(field.getName(), equalTo("deprecated"));
  }
View Full Code Here

  // message Person {
  //   optional boolean active = 1 [(encoding) = 'UTF-8'];
  // }
  @Test public void should_return_field_of_custom_field_option() {
    FieldOption option = xtext.find("encoding", ")", FieldOption.class);
    MessageField field = (MessageField) options.rootSourceOf(option);
    assertThat(field.getName(), equalTo("encoding"));
  }
View Full Code Here

  // message Person {
  //   optional boolean active = 1 [(custom).count = 6];
  // }
  @Test public void should_return_option_field() {
    CustomFieldOption option = xtext.find("custom", ").", CustomFieldOption.class);
    MessageField field = (MessageField) options.sourceOfLastFieldIn(option);
    assertThat(field.getName(), equalTo("count"));
  }
View Full Code Here

  //
  // message Person {
  //  optional string name = 1;
  // }
  @Test public void should_return_image_for_optional_field() {
    MessageField field = xtext.find("name", MessageField.class);
    String image = images.imageFor(field);
    assertThat(image, equalTo("optional.gif"));
    assertThat(image, existsInProject());
  }
View Full Code Here

TOP

Related Classes of com.google.eclipse.protobuf.protobuf.MessageField

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.