org.eclipse.cdt.internal.corext.util
Class CModelUtil

java.lang.Object
  extended by org.eclipse.cdt.internal.corext.util.CModelUtil

public class CModelUtil
extends java.lang.Object


Constructor Summary
CModelUtil()
           
 
Method Summary
static org.eclipse.cdt.core.model.ICContainer getSourceFolder(org.eclipse.cdt.core.model.ICElement element)
          Returns the source folder of ICElement.
static org.eclipse.cdt.core.model.ISourceRoot getSourceRoot(org.eclipse.cdt.core.model.ICElement element)
          Returns the source root of ICElement.
static org.eclipse.cdt.core.model.ITranslationUnit getTranslationUnit(org.eclipse.cdt.core.model.ICElement elem)
          Returns the translation unit the element belongs to or null if it does not.
static boolean isReferenced(org.eclipse.cdt.core.model.ISourceRoot root)
          Returns true if the given source root is referenced.
static org.eclipse.cdt.core.model.ITranslationUnit toOriginal(org.eclipse.cdt.core.model.ITranslationUnit unit)
           
static org.eclipse.cdt.core.model.ITranslationUnit toWorkingCopy(org.eclipse.cdt.core.model.ITranslationUnit unit)
          Returns the working copy CU of the given CU.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CModelUtil

public CModelUtil()
Method Detail

toWorkingCopy

public static org.eclipse.cdt.core.model.ITranslationUnit toWorkingCopy(org.eclipse.cdt.core.model.ITranslationUnit unit)
Returns the working copy CU of the given CU. If the CU is already a working copy or the CU has no working copy the input CU is returned.


toOriginal

public static org.eclipse.cdt.core.model.ITranslationUnit toOriginal(org.eclipse.cdt.core.model.ITranslationUnit unit)

getSourceRoot

public static org.eclipse.cdt.core.model.ISourceRoot getSourceRoot(org.eclipse.cdt.core.model.ICElement element)
Returns the source root of ICElement. If the given element is already a source root, the element itself is returned.


getSourceFolder

public static org.eclipse.cdt.core.model.ICContainer getSourceFolder(org.eclipse.cdt.core.model.ICElement element)
Returns the source folder of ICElement. If the given element is already a source folder, the element itself is returned.


isReferenced

public static boolean isReferenced(org.eclipse.cdt.core.model.ISourceRoot root)
Returns true if the given source root is referenced. This means it is own by a different project but is referenced by the root's parent. Returns false if the given root doesn't have an underlying resource.


getTranslationUnit

public static org.eclipse.cdt.core.model.ITranslationUnit getTranslationUnit(org.eclipse.cdt.core.model.ICElement elem)
Returns the translation unit the element belongs to or null if it does not.