Package com.google.eclipse.protobuf.protobuf

Examples of com.google.eclipse.protobuf.protobuf.Import


  // syntax = "proto2";
  //
  // import 'google/protobuf/descriptor.proto';
  @Test public void should_return_label_for_import() {
    Import anImport = xtext.findFirst(Import.class);
    Object label = labels.labelFor(anImport);
    assertThat(label, instanceOf(String.class));
    String labelText = (String) label;
    assertThat(labelText, equalTo("google/protobuf/descriptor.proto"));
  }
View Full Code Here


  // syntax = "proto2";
  // import "types.proto";
  @Test public void should_return_import_URI_as_entered_by_user() {
    Protobuf root = xtext.root();
    Import anImport = firstImportOf(root);
    anImport.setImportURI("file:/test-protos/types.proto"); // simulate the URI is resolved
    assertThat(imports.uriAsEnteredByUser(anImport), equalTo("types.proto"));
  }
View Full Code Here

  // import "B.proto";
  // import "C.proto";
  @Test public void should_add_warning_if_import_if_import_refers_directly_to_non_proto2() {
    protobufs.nonProto2FileName = "B.proto";
    validator.checkNonProto2Imports(xtext.root());
    Import importWithNonProto2File = findImportReferreringToFile(protobufs.nonProto2FileName);
    verifyThatImportingNonProto2FileCreatedWarning(importWithNonProto2File);
  }
View Full Code Here

  //
  // import "B.proto";
  @Test public void should_add_warning_if_import_if_import_refers_indirectly_to_non_proto2() {
    protobufs.nonProto2FileName = "C.proto";
    validator.checkNonProto2Imports(xtext.root());
    Import importWithNonProto2File = findImportReferreringToFile("B.proto");
    verifyThatImportingNonProto2FileCreatedWarning(importWithNonProto2File);
  }
View Full Code Here

    assertThat(options.option("deprecated"), isBool());
    assertThat(options.option("experimental_map_key"), isString());
  }

  @Test public void should_return_empty_List_if_given_model_does_not_have_options() {
    Import optionContainer = mock(Import.class);
    Collection<MessageField> foundOptions = descriptor.availableOptionsFor(optionContainer);
    assertThat(foundOptions.size(), equalTo(0));
  }
View Full Code Here

      @Override public IHyperlink[] exec(XtextResource resource) {
        EObject resolved = eObjectAtOffsetHelper.resolveElementAt(resource, region.getOffset());
        if (!(resolved instanceof Import)) {
          return NO_HYPERLINKS;
        }
        Import anImport = (Import) resolved;
        if (!imports.isResolved(anImport)) {
          return NO_HYPERLINKS;
        }
        INode importUriNode = nodes.firstNodeForFeature(anImport, IMPORT__IMPORT_URI);
        if (importUriNode.getLength() == 0) {
View Full Code Here

    if (o instanceof Extensions) {
      Extensions extensions = (Extensions) o;
      return labelFor(extensions);
    }
    if (o instanceof Import) {
      Import anImport = (Import) o;
      return labelFor(anImport);
    }
    if (o instanceof Literal) {
      Literal literal = (Literal) o;
      return labelFor(literal);
View Full Code Here

   * @param from the given element to resolve.
   * @return the {@code String} representation of the given object's {@code URI}.
   */
  @Override public String apply(EObject from) {
    if (from instanceof Import) {
      Import anImport = (Import) from;
      delegate.resolveAndUpdateUri(anImport);
    }
    return super.apply(from);
  }
View Full Code Here

TOP

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

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.