Carbide.c++

com.nokia.carbide.cdt.builder
Class EpocEnginePathHelper

java.lang.Object
  extended by com.nokia.carbide.cdt.builder.EpocEnginePathHelper

public class EpocEnginePathHelper
extends java.lang.Object

This class manages conversion of IPaths provided by an EPOC engine view back and forth to real-world paths in the filesystem or workspace.

Use MMPViewPathHelper for any MMP-provided IPaths, which have interesting semantics for absolute paths. This is only suitable for bld.inf or Makefiles.

This also handles correcting the capitalization in a path. Eclipse's IPaths are not case-insensitive, as they should be, so we need to match up file references to real references and provide IPaths that will find real content in the workspace.


Field Summary
protected  IProject project
           
protected  java.lang.String projectName
           
protected  IPath projectRoot
           
 
Constructor Summary
EpocEnginePathHelper(IData data, boolean unused)
          Construct an instance using the given data, to provide the project root.
EpocEnginePathHelper(IPath projectRoot)
          Construct an instance with the project root.
 
Method Summary
 IPath convertFilesystemToWorkspace(IPath fullPath)
          Convert a filesystem path to the workspace, taking care to account for incorrect capitalization.
 IPath convertPathToView(IPath path)
          Convert a project-relative or absolute path to the format expected by the view.
 IPath convertToFilesystem(IPath path)
          Convert the given path (from an IView API) into a canonical full path in the local filesystem.
 IPath convertToProject(IPath path)
          Convert the given path (from an IView API) into a project-relative path, if possible.
 IPath convertToWorkspace(IPath path)
          Convert the given path (from an IView API) into a workspace-relative path, if possible.
 IPath resolve(java.lang.String projectName, IPath path)
          Resolve a project-relative path to correct any problems in capitalization.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

projectName

protected java.lang.String projectName

projectRoot

protected IPath projectRoot

project

protected IProject project
Constructor Detail

EpocEnginePathHelper

public EpocEnginePathHelper(IPath projectRoot)
Construct an instance with the project root. This constructor is used when a project doesn't exist yet. projectRoot may not be null.

Parameters:
projectRoot - filesystem path to root of project

EpocEnginePathHelper

public EpocEnginePathHelper(IData data,
                            boolean unused)
Construct an instance using the given data, to provide the project root.

The data may not be null.

Parameters:
data -
unused - data to distinguish IData from IView constructor
Method Detail

convertFilesystemToWorkspace

public IPath convertFilesystemToWorkspace(IPath fullPath)
Convert a filesystem path to the workspace, taking care to account for incorrect capitalization.

Parameters:
fullPath -
Returns:
workspace-relative non-absolute path, or null if not resolvable to workspace

convertToWorkspace

public IPath convertToWorkspace(IPath path)
Convert the given path (from an IView API) into a workspace-relative path, if possible.

Parameters:
path - relative or absolute path
Returns:
workspace-relative non-absolute path, or null if not in workspace

convertToProject

public IPath convertToProject(IPath path)
Convert the given path (from an IView API) into a project-relative path, if possible.

Parameters:
path - relative or absolute path
Returns:
project-relative non-absolute path, or null

convertToFilesystem

public IPath convertToFilesystem(IPath path)
Convert the given path (from an IView API) into a canonical full path in the local filesystem.

Parameters:
path - relative or absolute path
Returns:
absolute path, never null unless it came in null

resolve

public IPath resolve(java.lang.String projectName,
                     IPath path)
Resolve a project-relative path to correct any problems in capitalization. This version only works with a constructor that passes a real project.

Parameters:
projectName -
path - project-relative path
Returns:
resolved path, as far as actual resources exist (the suffix may be unchanged if an intervening folder is missing)

convertPathToView

public IPath convertPathToView(IPath path)
Convert a project-relative or absolute path to the format expected by the view. Inverse of #convertTo{Project|Filesystem}().

Parameters:
path - relative path for project-relative path, or full path for filesystem path
Returns:
project-relative path, if possible, or self

Carbide.c++