Interface ICElement

    • Method Detail

      • exists

        boolean exists()
        Returns whether this C element exists in the model.
        Returns:
        true if this element exists in the C model
      • getAncestor

        ICElement getAncestor​(int ancestorType)
        Returns the first ancestor of this C element that has the given type. Returns null if no such an ancestor can be found. This is a handle-only method.
        Parameters:
        ancestorType - the given type
        Returns:
        the first ancestor of this C element that has the given type, null if no such an ancestor can be found
        Since:
        2.0
      • getElementName

        String getElementName()
        Returns the name of this element.
        Returns:
        the element name
      • getElementType

        int getElementType()
        Returns this element's kind encoded as an integer. This is a handle-only method.
        Returns:
        the kind of element; one of the constants declared in ICElement
      • getCModel

        ICModel getCModel()
        Returns the C model.
        Returns:
        the C model
      • getCProject

        ICProject getCProject()
        Returns the C project this element is contained in, or null if this element is not contained in any C project
        Returns:
        the containing C project, or null if this element is not contained in a C project
      • getParent

        ICElement getParent()
        Returns the element directly containing this element, or null if this element has no parent.
        Returns:
        the parent element, or null if this element has no parent
      • getPath

        org.eclipse.core.runtime.IPath getPath()
        Returns the path to the innermost resource enclosing this element. If this element is not included in an external archive, the path returned is the full, absolute path to the underlying resource, relative to the workbench. If this element is included in an external archive, the path returned is the absolute path to the archive in the file system. This is a handle-only method.
      • getLocationURI

        URI getLocationURI()
        Returns an absolute URI corresponding to the innermost file enclosing this element.
        Returns:
        the URI corresponding to the location
        Since:
        5.0
      • getUnderlyingResource

        org.eclipse.core.resources.IResource getUnderlyingResource()
        Returns the underlying resource that contains this element, or null if this element is not contained in a resource.
        Returns:
        the underlying resource, or null if none
      • getResource

        org.eclipse.core.resources.IResource getResource()
        Returns the corresponding resource for this element, or null if this element does not have a corresponding resource.
        Returns:
        the corresponding resource, or null if none
      • isReadOnly

        boolean isReadOnly()
        Returns whether this C element is read-only. An element is read-only if its structure cannot be modified by the C model.
        Returns:
        true if this element is read-only
      • isStructureKnown

        boolean isStructureKnown()
                          throws CModelException
        Returns whether the structure of this element is known. For example, for a translation unit that could not be parsed, false is returned. If the structure of an element is unknown, navigations will return reasonable defaults. For example, getChildren will return an empty collection.

        Note: This does not imply anything about consistency with the underlying resource/buffer contents.

        Returns:
        true if the structure of this element is known
        Throws:
        CModelException - if this element does not exist or if an exception occurs while accessing its corresponding resource
      • accept

        void accept​(ICElementVisitor visitor)
             throws org.eclipse.core.runtime.CoreException
        Accept a visitor and walk the ICElement tree with it.
        Parameters:
        visitor -
        Throws:
        CModelException
        org.eclipse.core.runtime.CoreException
      • getHandleIdentifier

        String getHandleIdentifier()
        Returns a string representation of this element handle. The format of the string is not specified; however, the identifier is stable across workspace sessions, and can be used to recreate this handle via the CoreModel.create(String) method.

        Some element types, like binaries, do not support handle identifiers and return null.

        Returns:
        the string handle identifier, or null if the element type is not supported
        Since:
        5.0
        See Also:
        CoreModel.create(java.lang.String)