Carbide.c++

com.nokia.carbide.cdt.builder
Class MMPViewPathHelper

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

public class MMPViewPathHelper
extends java.lang.Object

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

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 MMP file references to real references and provide IPaths that will find real content in the workspace.

If an IPath refers to a target directory (i.e. Z:-relative), this API is meaningless and no conversions are likely to be made.

Instances of this class should be short-lived (e.g. if a project is deleted or renamed, it may cease to work).


Field Summary
protected  IPath epocRoot
           
 
Constructor Summary
MMPViewPathHelper(ICarbideBuildConfiguration buildConfiguration)
          Construct an instance with the given configuration providing the project and EPOCROOT.
MMPViewPathHelper(IPath projectRoot, java.lang.String epocRoot)
          Construct an instance with the project root and epocRoot.
 
Method Summary
 IPath convertMMPToFilesystem(EMMPPathContext context, IPath path)
          Convert the given path (from an IMMPView API) into a full path in the local filesystem.
 IPath convertMMPToProject(EMMPPathContext context, IPath path)
          Convert the given path (from an IMMPView API) into a project-relative path, if possible.
 IPath convertMMPToWorkspace(EMMPPathContext context, IPath path)
          Convert the given path (from an IMMPView API) into a workspace-relative path, if possible.
 IPath convertProjectOrFullPathToMMP(EMMPPathContext context, IPath path)
          Convert either a project-relative or a full filesystem path to an MMP-appropriate path, which may either a project-relative path, an EPOCROOT-relative path (with leading "/epoc32"), or an absolute (filesystem) path, depending on context.
 boolean isEpoc32RelativeFormat(IPath path)
          Identify the new-style EPOCROOT\epoc32 relative path (used only in MMP?)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

epocRoot

protected IPath epocRoot
Constructor Detail

MMPViewPathHelper

public MMPViewPathHelper(IPath projectRoot,
                         java.lang.String epocRoot)
Construct an instance with the project root and epocRoot. This constructor is used when a project doesn't exist yet. projectRoot may not be null, but epocRoot may be.

In this configuration, if epocRoot==null, convertMMPToFilesystem(EMMPPathContext, IPath) will return null for EPOCROOT-relative paths.

Parameters:
buildConfiguration -

MMPViewPathHelper

public MMPViewPathHelper(ICarbideBuildConfiguration buildConfiguration)
Construct an instance with the given configuration providing the project and EPOCROOT.

Parameters:
buildConfiguration -
Method Detail

isEpoc32RelativeFormat

public boolean isEpoc32RelativeFormat(IPath path)
Identify the new-style EPOCROOT\epoc32 relative path (used only in MMP?)

Parameters:
path -
Returns:

convertMMPToWorkspace

public IPath convertMMPToWorkspace(EMMPPathContext context,
                                   IPath path)
Convert the given path (from an IMMPView API) into a workspace-relative path, if possible.

Parameters:
context - the context from which the path was retrieved
path -
Returns:
workspace-relative non-absolute path, or null if not in workspace

convertMMPToProject

public IPath convertMMPToProject(EMMPPathContext context,
                                 IPath path)
Convert the given path (from an IMMPView API) into a project-relative path, if possible.

Parameters:
context - the context from which the path was retrieved
path -
Returns:
project-relative non-absolute path, or null

convertMMPToFilesystem

public IPath convertMMPToFilesystem(EMMPPathContext context,
                                    IPath path)
Convert the given path (from an IMMPView API) into a full path in the local filesystem.

Parameters:
context - the context from which the path was retrieved
path -
Returns:
absolute path, never null unless it came in null

convertProjectOrFullPathToMMP

public IPath convertProjectOrFullPathToMMP(EMMPPathContext context,
                                           IPath path)
                                    throws InvalidDriveInMMPPathException
Convert either a project-relative or a full filesystem path to an MMP-appropriate path, which may either a project-relative path, an EPOCROOT-relative path (with leading "/epoc32"), or an absolute (filesystem) path, depending on context.

Parameters:
path -
Returns:
path, never null unless it came in null
Throws:
InvalidDriveInMMPPathException - if the full path has a device which is incompatible with the SDK

Carbide.c++