Class ExternalPackageFragmentRoot

All Implemented Interfaces:
IBufferChangedListener, IJavaElement, IOpenable, IPackageFragmentRoot, IParent, org.eclipse.core.runtime.IAdaptable

public class ExternalPackageFragmentRoot extends PackageFragmentRoot
A package fragment root that corresponds to an external class folder.

NOTE: An external package fragment root never has an associated resource.

See Also:
IPackageFragmentRoot, PackageFragmentRootInfo
  • Field Details

    • externalPath

      protected final org.eclipse.core.runtime.IPath externalPath
      The path to the external folder (an OS path)
  • Constructor Details

    • ExternalPackageFragmentRoot

      protected ExternalPackageFragmentRoot(org.eclipse.core.runtime.IPath externalPath, JavaProject project)
      Constructs a package fragment root which is the root of the Java package directory hierarchy based on an external folder that is not contained in a IJavaProject and does not have an associated IResource.
    • ExternalPackageFragmentRoot

      protected ExternalPackageFragmentRoot(org.eclipse.core.resources.IResource linkedFolder, org.eclipse.core.runtime.IPath externalPath, JavaProject project)
  • Method Details

    • determineKind

      protected int determineKind(org.eclipse.core.resources.IResource underlyingResource)
      An external class folder is always K_BINARY.
      Overrides:
      determineKind in class PackageFragmentRoot
    • equals

      public boolean equals(Object o)
      Returns true if this handle represents the same external folder as the given handle.
      Overrides:
      equals in class PackageFragmentRoot
      See Also:
      Object.equals(java.lang.Object)
    • getElementName

      public String getElementName()
      Description copied from interface: IJavaElement
      Returns the name of this element. This is a handle-only method.
      Specified by:
      getElementName in interface IJavaElement
      Overrides:
      getElementName in class PackageFragmentRoot
      Returns:
      the element name
      See Also:
      IAdaptable
    • getKind

      public int getKind()
      Description copied from interface: IPackageFragmentRoot
      Returns this package fragment root's kind encoded as an integer. A package fragment root can contain source files (i.e. files with one of the Java-like extensions, or .class files, but not both. If the underlying folder or archive contains other kinds of files, they are ignored. In particular, .class files are ignored under a source package fragment root, and source files are ignored under a binary package fragment root.
      Specified by:
      getKind in interface IPackageFragmentRoot
      Overrides:
      getKind in class PackageFragmentRoot
      Returns:
      this package fragment root's kind encoded as an integer
      See Also:
      IPackageFragmentRoot
    • getPath

      public org.eclipse.core.runtime.IPath getPath()
      Description copied from interface: IJavaElement
      Returns the path to the innermost resource enclosing this element. If this element is not included in an external library, the path returned is the full, absolute path to the underlying resource, relative to the workbench. If this element is included in an external library, the path returned is the absolute path to the archive or to the folder in the file system. This is a handle-only method.
      Specified by:
      getPath in interface IJavaElement
      Overrides:
      getPath in class PackageFragmentRoot
      Returns:
      the path to the innermost resource enclosing this element
      See Also:
      IPackageFragmentRoot
    • getUnderlyingResource

      public org.eclipse.core.resources.IResource getUnderlyingResource() throws JavaModelException
      Description copied from interface: IJavaElement
      Returns the smallest underlying resource that contains this element, or null if this element is not contained in a resource.
      Specified by:
      getUnderlyingResource in interface IJavaElement
      Overrides:
      getUnderlyingResource in class PackageFragmentRoot
      Returns:
      the underlying resource, or null if none
      Throws:
      JavaModelException - if this element does not exist or if an exception occurs while accessing its underlying resource
      See Also:
      IJavaElement
    • hashCode

      public int hashCode()
      Description copied from class: JavaElement
      Returns the hash code for this Java element. By default, the hash code for an element is a combination of its name and parent's hash code. Elements with other requirements must override this method.
      Overrides:
      hashCode in class PackageFragmentRoot
    • isExternal

      public boolean isExternal()
      Description copied from interface: IPackageFragmentRoot
      Returns whether this package fragment root is external to the workbench (that is, a local file), and has no underlying resource.

      This is a handle-only method.

      Specified by:
      isExternal in interface IPackageFragmentRoot
      Overrides:
      isExternal in class PackageFragmentRoot
      Returns:
      true if this package fragment root is external to the workbench (that is, a local file), and has no underlying resource, false otherwise
      See Also:
      IPackageFragmentRoot
    • resource

      public org.eclipse.core.resources.IResource resource(PackageFragmentRoot root)
      Overrides:
      resource in class PackageFragmentRoot
    • resourceExists

      protected boolean resourceExists(org.eclipse.core.resources.IResource underlyingResource)
      Description copied from class: Openable
      Returns whether the corresponding resource or associated file exists
      Overrides:
      resourceExists in class Openable
    • toStringAncestors

      protected void toStringAncestors(StringBuffer buffer)
      Description copied from class: JavaElement
      Debugging purposes
      Overrides:
      toStringAncestors in class JavaElement