Examples of TypeExtension


Examples of com.google.eclipse.protobuf.protobuf.TypeExtension

      OptionType optionType) {
    if (!isExtendingOptionMessage(target, optionType)) {
      return emptySet();
    }
    Set<IEObjectDescription> descriptions = newHashSet();
    TypeExtension extension = (TypeExtension) target;
    for (MessageElement e : extension.getElements()) {
      descriptions.addAll(qualifiedNamesDescriptions.qualifiedNames(e, namingStrategy));
    }
    return descriptions;
  }
View Full Code Here

Examples of com.google.eclipse.protobuf.protobuf.TypeExtension

  @Override public Collection<IEObjectDescription> local(Object target, OptionType optionType, int level) {
    if (!isExtendingOptionMessage(target, optionType)) {
      return emptySet();
    }
    Set<IEObjectDescription> descriptions = newHashSet();
    TypeExtension extension = (TypeExtension) target;
    for (MessageElement e : extension.getElements()) {
      List<QualifiedName> names = localNamesProvider.localNames(e, namingStrategy);
      int nameCount = names.size();
      for (int i = level; i < nameCount; i++) {
        descriptions.add(create(names.get(i), e));
      }
View Full Code Here

Examples of com.google.eclipse.protobuf.protobuf.TypeExtension

  //     }
  //     required string string_value = 1;
  //   }
  // }
  @Test public void should_recognize_extendMessage_in_nestedMessage() {
    TypeExtension extension = xtext.findFirst(TypeExtension.class);
    ExtensibleType extended = extension.getType().getTarget();
    assertThat(extended.getName(), equalTo("ProtoWithExtensions"));
  }
View Full Code Here

Examples of com.google.eclipse.protobuf.protobuf.TypeExtension

  //   optional string name = 1;
  // }
  //
  // extend Person {}
  @Test public void should_return_message_from_extension() {
    TypeExtension extension = xtext.find("Person", " {}", TypeExtension.class);
    Message message = typeExtensions.messageFrom(extension);
    assertThat(message.getName(), equalTo("Person"));
  }
View Full Code Here

Examples of com.google.eclipse.protobuf.protobuf.TypeExtension

    Message message = typeExtensions.messageFrom(extension);
    assertThat(message.getName(), equalTo("Person"));
  }

  @Test public void should_return_null_if_extension_is_not_referring_to_message() {
    TypeExtension extension = mock(TypeExtension.class);
    when(extension.getType()).thenReturn(null);
    assertNull(typeExtensions.messageFrom(extension));
  }
View Full Code Here

Examples of com.google.eclipse.protobuf.protobuf.TypeExtension

  @Override public void completeExtensibleTypeLink_Target(EObject model, Assignment assignment,
      ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
    Collection<IEObjectDescription> scope = emptySet();
    if (model instanceof TypeExtension) {
      TypeExtension typeExtension = (TypeExtension) model;
      scope = scopeProvider().potentialExtensibleTypesFor(typeExtension);
    }
    for (IEObjectDescription d : descriptionChooser.shortestQualifiedNamesIn(scope)) {
      Image image = imageHelper.getImage(images.imageFor(d.getEObjectOrProxy()));
      proposeAndAccept(d, image, context, acceptor);
View Full Code Here

Examples of com.google.eclipse.protobuf.protobuf.TypeExtension

  //
  // message Person {}
  //
  // extend Person {}
  @Test public void should_return_label_for_type_extension() {
    TypeExtension typeExtension = xtext.findFirst(TypeExtension.class);
    Object label = labels.labelFor(typeExtension);
    assertThat(label, instanceOf(String.class));
    String labelText = (String) label;
    assertThat(labelText, equalTo("Person"));
  }
View Full Code Here

Examples of com.google.eclipse.protobuf.protobuf.TypeExtension

  // syntax = "proto2";
  //
  // extend Person {}
  @Test public void should_return_label_for_type_extension_with_unresolved_type() {
    TypeExtension typeExtension = xtext.findFirst(TypeExtension.class);
    Object label = labels.labelFor(typeExtension);
    assertThat(label, instanceOf(String.class));
    String labelText = (String) label;
    assertThat(labelText, equalTo("<unresolved>"));
  }
View Full Code Here

Examples of com.google.eclipse.protobuf.protobuf.TypeExtension

  //
  // message Person {}
  //
  // extend Person {}
  @Test public void should_return_image_for_type_extension() {
    TypeExtension typeExtension = xtext.findFirst(TypeExtension.class);
    String image = images.imageFor(typeExtension);
    assertThat(image, equalTo("typeextension.gif"));
    assertThat(image, existsInProject());
  }
View Full Code Here

Examples of com.google.eclipse.protobuf.protobuf.TypeExtension

    if (o instanceof Stream) {
      Stream stream = (Stream) o;
      return labelFor(stream);
    }
    if (o instanceof TypeExtension) {
      TypeExtension extension = (TypeExtension) o;
      return labelFor(extension);
    }
    if (o instanceof EObject) {
      return nameResolver.nameOf((EObject) o);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.