Package org.eclipse.emf.common.util

Examples of org.eclipse.emf.common.util.URI$URICache


  public static GenPackage createGenPackage(EPackage ePackage, String basePackage, String prefix, int genOptions, ResourceSet resourceSet)
  {
    GenModel genModel = ecore2GenModel(ePackage, basePackage, prefix, genOptions);

    URI ecoreURI = URI.createURI("file:///" + ePackage.getName() + ".ecore");
    URI genModelURI = ecoreURI.trimFileExtension().appendFileExtension("genmodel");

    Resource ecoreResource = resourceSet.createResource(ecoreURI);
    ecoreResource.getContents().add(ePackage);

    Resource genModelResource = resourceSet.createResource(genModelURI);
View Full Code Here


  public static void generateFromEPackage(EPackage ePackage, String targetDirectory, String basePackage, String prefix, int genOptions)
  {
    GenModel genModel = ecore2GenModel(ePackage, basePackage, prefix, genOptions);

    ResourceSet resourceSet = DataObjectUtil.createResourceSet();
    URI ecoreURI = URI.createURI("file:///temp.ecore");
    URI genModelURI = ecoreURI.trimFileExtension().appendFileExtension("genmodel");

    Resource ecoreResource = resourceSet.createResource(ecoreURI);
    ecoreResource.getContents().add(ePackage);

    Resource genModelResource = resourceSet.createResource(genModelURI);
View Full Code Here

            new XMIResourceFactoryImpl());
    // create resource set to hold the resource we're loading and its dependent resources
    ResourceSet resourceSet = new ResourceSetImpl();
    // convert file path to absolute path -- seems to be required for propery proxy resolution
    File inputFile = new File(aEcoreFilePath);
    URI absoluteInputURI = URI.createFileURI(inputFile.getAbsolutePath());
    // load the resource
    Resource resource = resourceSet.getResource(absoluteInputURI, true);
    // convert to UIMA TypeSystem
    return ecore2UimaTypeSystem(resource, aOptions);
  }
View Full Code Here

  public static GenPackage createGenPackage(EPackage ePackage, String basePackage, String prefix, int genOptions, ResourceSet resourceSet)
  {
    GenModel genModel = ecore2GenModel(ePackage, basePackage, prefix, genOptions);

    URI ecoreURI = URI.createURI("file:///" + ePackage.getName() + ".ecore");
    URI genModelURI = ecoreURI.trimFileExtension().appendFileExtension("genmodel");

    Resource ecoreResource = resourceSet.createResource(ecoreURI);
    ecoreResource.getContents().add(ePackage);

    Resource genModelResource = resourceSet.createResource(genModelURI);
View Full Code Here

  public static void generateFromEPackage(EPackage ePackage, String targetDirectory, String basePackage, String prefix, int genOptions)
  {
    GenModel genModel = ecore2GenModel(ePackage, basePackage, prefix, genOptions);

    ResourceSet resourceSet = DataObjectUtil.createResourceSet();
    URI ecoreURI = URI.createURI("file:///temp.ecore");
    URI genModelURI = ecoreURI.trimFileExtension().appendFileExtension("genmodel");

    Resource ecoreResource = resourceSet.createResource(ecoreURI);
    ecoreResource.getContents().add(ePackage);

    Resource genModelResource = resourceSet.createResource(genModelURI);
View Full Code Here

   *          from schema location map.
   * @return string form of URI from provided value, deresolved if appropriate.
   */
  protected String deresolve(String value)
  {
    URI location = URI.createURI(value);
    URI resourceURI = resource.getURI();
    boolean shouldDeresolve = resourceURI != null && !resourceURI.isRelative()
        && resourceURI.isHierarchical();
    if (shouldDeresolve && !location.isRelative())
    {
      URI deresolvedURI = location.deresolve(resourceURI, true, true, false);
      if (deresolvedURI.hasRelativePath())
      {
        location = deresolvedURI;
      }
    }
    return location.toString();
View Full Code Here

   *          for schema location from input parameter.
   * @return string form of URI from provided value, resolved if appropriate.
   */
  protected String resolve(String value)
  {
    URI location = URI.createURI(value);
    URI resourceURI = resource.getURI();
    boolean shouldResolve = resourceURI != null && resourceURI.isHierarchical()
        && !resourceURI.isRelative();
    if (shouldResolve && location.isRelative() && location.hasRelativePath())
    {
      location = location.resolve(resourceURI, false);
    }
    return location.toString();
View Full Code Here

  public static String getDefaultPackageName(String targetNamespace)
  {
      if (targetNamespace == null)
          return null;
    
      URI uri = URI.createURI(targetNamespace);
      List parsedName;
      if (uri.isHierarchical())
      {
        String host = uri.host();
        if (host != null && host.startsWith("www."))
        {
          host = host.substring(4);
        }
        parsedName = parseNameStatic(host, '.');
        Collections.reverse(parsedName);
        if (!parsedName.isEmpty())
        {
          parsedName.set(0, ((String)parsedName.get(0)).toLowerCase());
        }
 
        parsedName.addAll(parseNameStatic(uri.trimFileExtension().path(), '/'));
      }
      else
      {
        String opaquePart = uri.opaquePart();
        int index = opaquePart.indexOf(":");
        if (index != -1 && "urn".equalsIgnoreCase(uri.scheme()))
        {
          parsedName = parseNameStatic(opaquePart.substring(0, index), '-');
          if (parsedName.size() > 0 && DOMAINS.contains(parsedName.get(parsedName.size() - 1)))
          {
            Collections.reverse(parsedName);
View Full Code Here

            }

        }
    }
    private File checkProjectEnvironment() {
        URI projectUri = project.eResource().getURI();
        String devicePath = projectUri.devicePath();
        String projectFolderFile = new File(devicePath).getParent();
        File dataFolder = new File(projectFolderFile + File.separator + "data");
        if (dataFolder.exists() || dataFolder.mkdirs()) {
            return dataFolder;
        }
View Full Code Here

        saveResource(copy);
        monitor.worked(1);
    }

    private static String generateDestinationProjectFilePath( Resource resource, String name, String destinationDirectory ) {
        URI origURI = resource.getURI();
        File file = new File(origURI.toFileString());
        return destinationDirectory + File.separator + name + ".udig" + File.separator + file.getName(); //$NON-NLS-1$
    }
View Full Code Here

TOP

Related Classes of org.eclipse.emf.common.util.URI$URICache

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.