org.eclipse.etrice.generator.base
Class FileSystemHelpers

java.lang.Object
  extended by org.eclipse.etrice.generator.base.FileSystemHelpers

public class FileSystemHelpers
extends java.lang.Object

Author:
Henrik Rentz-Reichert

Constructor Summary
FileSystemHelpers()
           
 
Method Summary
static URI getMarkerFileURI(EObject obj, java.lang.String markerFileName)
          determines the URI of the first directory in the path of an object's resource which contains a file with a given name
static URI getProjectURI(EObject obj)
          calls getMarkerFileURI(EObject, String) to determine the URI of the parent Eclipse project containing this object
static java.lang.String getRelativePath(java.lang.String base, java.lang.String path)
          the given paths are converted to file URIs (using URI#createFileURI(String) and then getRelativePath(URI, URI, boolean) is called with goUpIfNeeded=false.
static java.lang.String getRelativePath(java.lang.String base, java.lang.String path, boolean goUpIfNeeded)
          the given paths are converted to file URIs (using URI#createFileURI(String) and then getRelativePath(URI, URI, boolean) is called.
static java.lang.String getRelativePath(URI base, URI path)
          getRelativePath(URI, URI, boolean) is called with goUpIfNeeded=false
static java.lang.String getRelativePath(URI base, URI path, boolean goUpIfNeeded)
          compute a relative path to a given base path.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileSystemHelpers

public FileSystemHelpers()
Method Detail

getProjectURI

public static URI getProjectURI(EObject obj)
calls getMarkerFileURI(EObject, String) to determine the URI of the parent Eclipse project containing this object

Parameters:
obj - an objected which should be located in a resource
Returns:
the URI of the Eclipse project

getMarkerFileURI

public static URI getMarkerFileURI(EObject obj,
                                   java.lang.String markerFileName)
determines the URI of the first directory in the path of an object's resource which contains a file with a given name

Parameters:
obj - an objected which should be located in a resource
markerFileName - name of marker file
Returns:
the URI of the first directory containing marker or null if not found

getRelativePath

public static java.lang.String getRelativePath(java.lang.String base,
                                               java.lang.String path)
the given paths are converted to file URIs (using URI#createFileURI(String) and then getRelativePath(URI, URI, boolean) is called with goUpIfNeeded=false.

Parameters:
base - the base path
path - the path for which the relative path is computed
Returns:
relative path (nullif there is none)

getRelativePath

public static java.lang.String getRelativePath(java.lang.String base,
                                               java.lang.String path,
                                               boolean goUpIfNeeded)
the given paths are converted to file URIs (using URI#createFileURI(String) and then getRelativePath(URI, URI, boolean) is called.

Parameters:
base - the base path
path - the path for which the relative path is computed
goUpIfNeeded - allow also ascending to parent directories
Returns:
relative path (nullif there is none)

getRelativePath

public static java.lang.String getRelativePath(URI base,
                                               URI path)
getRelativePath(URI, URI, boolean) is called with goUpIfNeeded=false

Parameters:
base - the base path
path - the path for which the relative path is computed
Returns:
relative path (nullif there is none)

getRelativePath

public static java.lang.String getRelativePath(URI base,
                                               URI path,
                                               boolean goUpIfNeeded)
compute a relative path to a given base path. Both paths must be of the same scheme and absolute and the given path has to have the first segments identical with the base path. Returned is a relative path separated by / characters. If there is no such relative path null is returned.

Parameters:
base - the base path
path - the path for which the relative path is computed
goUpIfNeeded - allow also ascending to parent directories
Returns:
relative path (nullif there is none)