Package com.google.eclipse.protobuf.protobuf

Examples of com.google.eclipse.protobuf.protobuf.Protobuf


  }

  @Test public void should_recognize_proto1_syntax() {
    store.setValue("misc.googleInternal", true);
    xtext.parseText(proto1);
    Protobuf root = xtext.root();
    assertThat(root, instanceOf(NonProto2Protobuf.class));
  }
View Full Code Here


  }

  @Test public void should_not_recognize_proto1_syntax() {
    store.setValue("misc.googleInternal", false);
    xtext.parseText(proto1);
    Protobuf root = xtext.root();
    assertNull(root);
  }
View Full Code Here

  @Inject private ResourceSets resourceSets;

  <T> Collection<IEObjectDescription> find(EObject start, FinderStrategy<T> strategy, T criteria) {
    Set<IEObjectDescription> descriptions = newHashSet();
    descriptions.addAll(local(start, strategy, criteria));
    Protobuf root = modelObjects.rootOf(start);
    descriptions.addAll(imported(root, strategy, criteria));
    return unmodifiableSet(descriptions);
  }
View Full Code Here

      }
      Resource imported = resourceSets.findResource(resourceSet, resolvedUri);
      if (imported == null) {
        continue;
      }
      Protobuf rootOfImported = resources.rootOf(imported);
      if (!protobufs.isProto2(rootOfImported)) {
        continue;
      }
      if (rootOfImported != null) {
        descriptions.addAll(publicImported(rootOfImported, strategy, criteria));
View Full Code Here

  @Inject private Imports imports;

  // 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

    options = new Options();
    descriptor = descriptorProvider.primaryDescriptor();
  }

  @Test public void should_return_all_file_options() {
    Protobuf optionContainer = mock(Protobuf.class);
    options.mapByName(descriptor.availableOptionsFor(optionContainer));
    assertThat(options.option("java_package"), isString());
    assertThat(options.option("java_outer_classname"), isString());
    assertThat(options.option("java_multiple_files"), isBool());
    assertThat(options.option("java_generate_equals_and_hash"), isBool());
View Full Code Here

    }
    EList<EObject> contents = resource.getContents();
    if (contents == null || contents.isEmpty()) {
      return;
    }
    Protobuf protobuf = (Protobuf) contents.get(0);
    highlight(protobuf, acceptor);
  }
View Full Code Here

       * IllegalStateException), so index updates (semantic) are done first and tracked in the
       * commentsToUpdate list, then a 2nd IUnitOfWork processes the comment updates (textual).
       */
      document.modify(new IUnitOfWork.Void<XtextResource>() {
        @Override public void process(XtextResource resource) {
          Protobuf root = resources.rootOf(resource);
          if (!protobufs.isProto2(root) /*|| !resource.getErrors().isEmpty()*/) {
            return;
          }
          int offset = styledTextAccess.caretOffset();
          ContentAssistContext[] context = contextFactory.create(editor.getInternalSourceViewer(), offset, resource);
View Full Code Here

   * @param o the given model object.
   * @return the package of the root containing the given model object or {@code null} if the root does not have a
   * package.
   */
  public Package packageOf(EObject o) {
    Protobuf root = rootOf(o);
    for (ProtobufElement e : root.getElements()) {
      if (e instanceof Package) {
        return (Package) e;
      }
    }
    return null;
View Full Code Here

  private void register(MessageMatcherStrategy strategy) {
    strategies.put(strategy.supportedType(), strategy);
  }

  public List<URI> matchingProtobufElementLocations(Resource resource, CppToProtobufMapping mapping) {
    Protobuf root = resources.rootOf(resource);
    // TODO check for proto2?
    List<String> qualifiedName = mapping.qualifiedName();
    AbstractProtobufElementMatcherStrategy strategy = strategies.get(mapping.type());
    if (strategy != null) {
      return strategy.matchingProtobufElementLocations(root, newIterator(qualifiedName));
View Full Code Here

TOP

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

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.