Package com.google.eclipse.protobuf.scoping

Examples of com.google.eclipse.protobuf.scoping.ProtoDescriptor


  // }
  @Test public void should_provide_fields_for_native_option() {
    NativeFieldOption option = xtext.find("deprecated", NativeFieldOption.class);
    IScope scope = scopeProvider.scope_OptionSource_target(option.getSource(), reference);
    Group group = xtext.find("membership", Group.class);
    ProtoDescriptor descriptor = descriptorProvider.primaryDescriptor();
    Collection<MessageField> optionSources = descriptor.availableOptionsFor(group);
    assertThat(descriptionsIn(scope), containAll(optionSources));
  }
View Full Code Here


    }
  }

  @Override public void completeNativeOption_Source(EObject model, Assignment assignment,
      ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
    ProtoDescriptor descriptor = descriptorProvider.primaryDescriptor();
    Collection<MessageField> optionProperties = descriptor.availableOptionsFor(model);
    if (!optionProperties.isEmpty()) {
      proposeOptions(optionProperties, context, acceptor);
    }
  }
View Full Code Here

    NativeOption option = (NativeOption) model;
    MessageField optionSource = (MessageField) options.rootSourceOf(option);
    if (optionSource == null) {
      return;
    }
    ProtoDescriptor descriptor = descriptorProvider.primaryDescriptor();
    Enum enumType = descriptor.enumTypeOf(optionSource);
    if (enumType != null) {
      proposeAndAccept(enumType, context, acceptor);
      return;
    }
    proposePrimitiveValues(optionSource, context, acceptor);
View Full Code Here

  private void proposeNativeOptions(MessageField field, ContentAssistContext context,
      ICompletionProposalAcceptor acceptor) {
    List<String> optionNames = existingFieldOptionNames(field);
    proposeDefaultKeyword(field, optionNames, context, acceptor);
    ProtoDescriptor descriptor = descriptorProvider.primaryDescriptor();
    for (MessageField optionSource : descriptor.availableOptionsFor(field)) {
      String optionName = optionSource.getName();
      if (optionNames.contains(optionName) || ("packed".equals(optionName) && !canBePacked(field))) {
        continue;
      }
      proposeOption(optionSource, context, acceptor);
View Full Code Here

  @Override public void completeNativeFieldOption_Value(EObject model, Assignment assignment,
      ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
    if (model instanceof NativeFieldOption) {
      NativeFieldOption option = (NativeFieldOption) model;
      ProtoDescriptor descriptor = descriptorProvider.primaryDescriptor();
      MessageField field = (MessageField) options.rootSourceOf(option);
      Enum enumType = descriptor.enumTypeOf(field);
      if (enumType != null) {
        proposeAndAccept(enumType, context, acceptor);
        return;
      }
      proposePrimitiveValues(field, context, acceptor);
View Full Code Here

TOP

Related Classes of com.google.eclipse.protobuf.scoping.ProtoDescriptor

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.