Package com.google.eclipse.protobuf.protobuf

Examples of com.google.eclipse.protobuf.protobuf.CustomOption


  //     value: { name: "External" },
  //     value: { name: "Error" },
  //   };
  // }
  @Test public void should_support_comma_after_each_option_field() {
    CustomOption option = xtext.find("values", ")", CustomOption.class);
    ComplexValue value = (ComplexValue) option.getValue();
    List<ValueField> fields = value.getFields();
    assertThat(fields.size(), equalTo(3));
  }
View Full Code Here


  //   optional string encoding = 1000;
  // }
  //
  // option (encoding) = 'UTF-8';
  @Test public void should_return_source_of_custom_option() {
    CustomOption option = xtext.find("encoding", ")", CustomOption.class);
    MessageField p = (MessageField) options.sourceOf(option);
    assertThat(p.getName(), equalTo("encoding"));
  }
View Full Code Here

  //   optional Custom custom = 1000;
  // }
  //
  // option (custom).count = 6;
  @Test public void should_return_source_of_field_in_option() {
    CustomOption option = xtext.find("custom", ")", CustomOption.class);
    MessageField p = (MessageField) options.sourceOf(option);
    assertThat(p.getName(), equalTo("count"));
  }
View Full Code Here

  //   optional Type type = 1000;
  // }
  //
  // option (type).(active) = true;
  @Test public void should_return_label_for_custom_option() {
    CustomOption option = xtext.find("type", ")", CustomOption.class);
    Object label = labels.labelFor(option);
    assertThat(label, instanceOf(String.class));
    String labelText = (String) label;
    assertThat(labelText, equalTo("(type).(active)"));
  }
View Full Code Here

  //   optional Type type = 1000;
  // }
  //
  // 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);
    ExtensionOptionField codeOptionField = (ExtensionOptionField) option.getFields().get(0);
    IScope scope = scopeProvider.scope_OptionField_target(codeOptionField, reference);
    assertThat(descriptionsIn(scope), containAll("active", "com.google.proto.active", ".com.google.proto.active"));
  }
View Full Code Here

  //   optional Type type = 1000;
  // }
  //
  // option (type).code = 68;
  @Test public void should_provide_message_fields_for_first_field_in_custom_option() {
    CustomOption option = xtext.find("type", ")", CustomOption.class);
    MessageOptionField codeOptionField = (MessageOptionField) option.getFields().get(0);
    IScope scope = scopeProvider.scope_OptionField_target(codeOptionField, reference);
    Message typeMessage = xtext.find("Type", " {", Message.class);
    assertThat(descriptionsIn(scope), containAllFieldsIn(typeMessage));
  }
View Full Code Here

  //   optional Type type = 1000;
  // }
  //
  // option (type).code.number = 68;
  @Test public void should_provide_message_fields_for_field_in_custom_option() {
    CustomOption option = xtext.find("type", ")", CustomOption.class);
    MessageOptionField numberOptionField = (MessageOptionField) option.getFields().get(1);
    IScope scope = scopeProvider.scope_OptionField_target(numberOptionField, reference);
    Message codeMessage = xtext.find("Code", " {", Message.class);
    assertThat(descriptionsIn(scope), containAllFieldsIn(codeMessage));
  }
View Full Code Here

  //   }
  // }
  //
  // 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);
    MessageOptionField codeOptionField = (MessageOptionField) option.getFields().get(0);
    IScope scope = scopeProvider.scope_OptionField_target(codeOptionField, reference);
    Group groupMessage = xtext.find("Type", " =", Group.class);
    assertThat(descriptionsIn(scope), containAllFieldsIn(groupMessage));
  }
View Full Code Here

  }

  @Override public void completeCustomOption_Fields(EObject model, Assignment assignment,
      ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
    if (model instanceof CustomOption) {
      CustomOption option = (CustomOption) model;
      proposeAndAccept(scopeProvider().potentialMessageFieldsFor(option), context, acceptor);
      proposeAndAccept(scopeProvider().potentialExtensionFieldsFor(option), "(%s)", "(%s)", context, acceptor);
    }
  }
View Full Code Here

      ContentAssistContext context, ICompletionProposalAcceptor acceptor) {}

  @Override public void completeCustomOption_Value(EObject model, Assignment assignment, ContentAssistContext context,
      ICompletionProposalAcceptor acceptor) {
    if (model instanceof CustomOption) {
      CustomOption option = (CustomOption) model;
      IndexedElement e = options.sourceOfLastFieldIn(option);
      if (e == null) {
        e = options.rootSourceOf(option);
      }
      if (e instanceof MessageField) {
View Full Code Here

TOP

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

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.