Interface INamingService


  • public interface INamingService
    This service provides a unified point for naming of EDT objects/resources. The following capabilities are provided:
    • Converts resource URI to corresponding qualified names
    • Converts filepaths to corresponding qualified names
    • Converts qualified names to corresonding URIs
    • Provides FQNs for related objects/external properties
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Interface Description
      static class  INamingService.UriType
      Type of a required URI
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      String getDependentObjectFqnAsString​(org.eclipse.emf.common.util.URI parentObjectUri, org.eclipse.emf.ecore.EClass targetEClass)
      Gets the dependent object FQN using the parent object URI and EClass of a target dependent object as a reference.
      String getFilePath​(String qualifiedPath)
      Gets file path corresponding to the given top object's FQN.
      String getFilePath​(org.eclipse.xtext.naming.QualifiedName qName)
      Gets file path corresponding to the given top object's FQN.
      org.eclipse.core.runtime.IPath getFilePath​(org.eclipse.xtext.naming.QualifiedName fqn, org.eclipse.emf.ecore.EClass eClass)
      Gets file path by the given top object FQN and EClass.
      org.eclipse.xtext.naming.QualifiedName getFqn​(String fileName)
      Gets top object's FQN corresponding to the given file name.
      org.eclipse.xtext.naming.QualifiedName getFqn​(org.eclipse.core.resources.IFile file)
      Gets top object's FQN corresponding to the given file.
      org.eclipse.xtext.naming.QualifiedName getFqn​(org.eclipse.core.runtime.IPath path)
      Gets top object's FQN corresponding to the given path.
      org.eclipse.emf.common.util.URI getParentObjectUri​(String dependentObjectFqn, String projectName)
      Gets the URI of a parent object using a provided project name and an FQN of a dependent object
      org.eclipse.emf.common.util.URI getParentObjectUri​(org.eclipse.emf.common.util.URI dependentObjectUri)
      Gets the parent object URI (in form of string) using the provided matching dependent object URI.
      String getParentObjectUriAsString​(org.eclipse.emf.common.util.URI dependentObjectUri)
      Gets the parent object URI (in form of string) using the provided matching dependent object URI.
      String getProjectPath​(String sourceUri, boolean includeFragment)
      Strips project and source parts from the URI and converts it to the string.
      String getProjectPath​(org.eclipse.emf.common.util.URI sourceUri, boolean includeFragment)
      Strips project and source parts from the URI and converts it to the string.
      org.eclipse.emf.common.util.URI toUriFromProjectPath​(String projectPath, String projectName, INamingService.UriType uriType)
      Converts relative project path to a speciefied type of an URI
    • Method Detail

      • getDependentObjectFqnAsString

        String getDependentObjectFqnAsString​(org.eclipse.emf.common.util.URI parentObjectUri,
                                             org.eclipse.emf.ecore.EClass targetEClass)
        Gets the dependent object FQN using the parent object URI and EClass of a target dependent object as a reference. The FQN is being returned in form of dot-separated name string.
        Parameters:
        parentObjectUri - The parent object URI. May not be null. Depending on the parent object nature may be either resource or BM URI
        targetEClass - The target EClass of a dependent object. May not be null
        Returns:
        The textual representation of an FQN. May be null
      • getFilePath

        String getFilePath​(org.eclipse.xtext.naming.QualifiedName qName)
        Gets file path corresponding to the given top object's FQN.
        Parameters:
        qName - - QualifiedName, not null.
        Returns:
        the path if can be resolved, null otherwise.
      • getFilePath

        org.eclipse.core.runtime.IPath getFilePath​(org.eclipse.xtext.naming.QualifiedName fqn,
                                                   org.eclipse.emf.ecore.EClass eClass)
        Gets file path by the given top object FQN and EClass.
        Parameters:
        fqn - the FQN, not null.
        eClass - the EClass, not null.
        Returns:
        the file path or null.
      • getFilePath

        String getFilePath​(String qualifiedPath)
        Gets file path corresponding to the given top object's FQN.
        Parameters:
        qualifiedPath - - qualified path to resource, not null.
        Returns:
        the path if can be resolved, null otherwise.
      • getFqn

        org.eclipse.xtext.naming.QualifiedName getFqn​(org.eclipse.core.resources.IFile file)
        Gets top object's FQN corresponding to the given file.
        Parameters:
        file - the file, not null.
        Returns:
        the FQN if can be resolved, null otherwise.
      • getFqn

        org.eclipse.xtext.naming.QualifiedName getFqn​(org.eclipse.core.runtime.IPath path)
        Gets top object's FQN corresponding to the given path.
        Parameters:
        path - the path, not null.
        Returns:
        the FQN if can be resolved, null otherwise.
      • getFqn

        org.eclipse.xtext.naming.QualifiedName getFqn​(String fileName)
        Gets top object's FQN corresponding to the given file name.
        Parameters:
        fileName - the file name, not null.
        Returns:
        the FQN if can be resolved, null otherwise.
      • getParentObjectUri

        org.eclipse.emf.common.util.URI getParentObjectUri​(String dependentObjectFqn,
                                                           String projectName)
        Gets the URI of a parent object using a provided project name and an FQN of a dependent object
        Parameters:
        dependentObjectFqn - Dependent object FQN. May not be null
        projectName - The name of a target project. May not be null
        Returns:
        URI of a parent object. May be null in case of unsupported input FQN
      • getParentObjectUri

        org.eclipse.emf.common.util.URI getParentObjectUri​(org.eclipse.emf.common.util.URI dependentObjectUri)
        Gets the parent object URI (in form of string) using the provided matching dependent object URI. The matching should be always one to one (a single dependent object may not have multiple parents)
        Parameters:
        dependentObjectUri - The dependent object URI. May not be null
        Returns:
        The textual representation of a parent object URI. May be null
      • getParentObjectUriAsString

        String getParentObjectUriAsString​(org.eclipse.emf.common.util.URI dependentObjectUri)
        Gets the parent object URI (in form of string) using the provided matching dependent object URI. The matching should be always one to one (a single dependent object may not have multiple parents)
        Parameters:
        dependentObjectUri - The dependent object URI. May not be null
        Returns:
        The textual representation of a parent object URI. May be null
      • getProjectPath

        String getProjectPath​(String sourceUri,
                              boolean includeFragment)
        Strips project and source parts from the URI and converts it to the string. Supports both resource and BM uris Input URI - platform:/resource/Конфигурация/src/CommonModules/ОбщийМодуль/Module.bsl Output path - CommonModules/ОбщийМодуль/Module.bsl
        Parameters:
        sourceUri - URI of the EDT resource or BM object. May not be null
      • getProjectPath

        String getProjectPath​(org.eclipse.emf.common.util.URI sourceUri,
                              boolean includeFragment)
        Strips project and source parts from the URI and converts it to the string. Supports both resource and BM uris Input URI - platform:/resource/Конфигурация/src/CommonModules/ОбщийМодуль/Module.bsl Output path - CommonModules/ОбщийМодуль/Module.bsl
        Parameters:
        sourceUri - URI of the EDT resource or BM object. May not be null
      • toUriFromProjectPath

        org.eclipse.emf.common.util.URI toUriFromProjectPath​(String projectPath,
                                                             String projectName,
                                                             INamingService.UriType uriType)
        Converts relative project path to a speciefied type of an URI
        Parameters:
        projectPath - The project path. May not be null
        projectName - The name of the project. May not be null
        uriType - The type of a required URI. May not be null
        Returns:
        A target URI. May not be null