Package org.eclipse.emf.common.util

Examples of org.eclipse.emf.common.util.URI.path()


  // message Person {}
  @Test public void should_find_resource_if_URIs_are_exact_match() {
    XtextResource resource = xtext.resource();
    addToXtextIndex(resource);
    URI resourceUri = resource.getURI();
    IPath path = Path.fromOSString(resourceUri.path());
    IResourceDescription description = lookup.resourceIn(path);
    assertThat(description.getURI(), equalTo(resourceUri));
  }

  // syntax = "proto2";
View Full Code Here


  }

  @Test public void should_return_resolved_URI() {
    when(uriResolver.apply(anImport)).thenReturn("file:/protos/test.proto");
    URI uri = imports.resolvedUriOf(anImport);
    assertThat(uri.path(), equalTo("/protos/test.proto"));
  }

  @Test public void should_return_null_if_URI_cannot_be_resolved() {
    when(uriResolver.apply(anImport)).thenReturn(null);
    URI uri = imports.resolvedUriOf(anImport);
View Full Code Here

   * @return
   */
  private boolean isParent(IEObjectDescription desc, EObject o) {
    URI descUri = desc.getEObjectURI();
    URI oUri = o.eResource().getURI();
    if(!descUri.path().equals(oUri.path()))
      return false;
    // same resource, if desc's fragment is in at the start of the path, then o is contained
    boolean result = o.eResource().getURIFragment(o).startsWith(descUri.fragment());
    return result;
  }
View Full Code Here

    URI uri = getURI();
    try {
      switch(loadType) {
        case TYPE: {
          List<PPTypeInfo> typeInfo = helper.getTypeInfo(uri.path(), new InputStreamReader(inputStream));
          for(PPTypeInfo info : typeInfo) {
            Type type = PPTPFactory.eINSTANCE.createType();
            type.setName(info.getTypeName());
            type.setDocumentation(info.getDocumentation());
            for(Map.Entry<String, PPTypeInfo.Entry> entry : info.getParameters().entrySet()) {
View Full Code Here

          }
        }
          break;

        case FUNCTION: {
          List<PPFunctionInfo> functions = helper.getFunctionInfo(uri.path(), new InputStreamReader(
            inputStream));

          for(PPFunctionInfo info : functions) {
            Function pptpFunc = PPTPFactory.eINSTANCE.createFunction();
            pptpFunc.setName(info.getFunctionName());
View Full Code Here

          }
        }
          break;

        case META: {
          PPTypeInfo info = helper.getMetaTypeInfo(uri.path(), new InputStreamReader(inputStream));

          MetaType type = PPTPFactory.eINSTANCE.createMetaType();
          type.setName(info.getTypeName());
          type.setDocumentation(info.getDocumentation());
          for(Map.Entry<String, PPTypeInfo.Entry> entry : info.getParameters().entrySet()) {
View Full Code Here

          getContents().add(type);
          break;
        }

        case TYPEFRAGMENT: {
          for(PPTypeInfo type : helper.getTypeFragments(uri.path(), new InputStreamReader(inputStream))) {
            TypeFragment fragment = PPTPFactory.eINSTANCE.createTypeFragment();
            fragment.setName(type.getTypeName());

            // add the properties (will typically load just one).
            for(Map.Entry<String, PPTypeInfo.Entry> entry : type.getProperties().entrySet()) {
View Full Code Here

   * @return
   */
  private int containerSpecificity(IEObjectDescription contained, IEObjectDescription containerCandidate) {
    URI containedURI = contained.getEObjectURI();
    URI containerURI = containerCandidate.getEObjectURI();
    if(!containedURI.path().equals(containerURI.path()))
      return 0;
    // same resource, if desc's fragment is in at the start of the path, then contained is contained by containerCandidate
    if(containerURI.fragment().startsWith(containedURI.fragment()))
      return containerURI.fragment().length();
    return 0;
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.