Class IzClasspathContainer

  • All Implemented Interfaces:
    org.eclipse.jdt.core.IClasspathContainer

    public class IzClasspathContainer
    extends java.lang.Object
    implements org.eclipse.jdt.core.IClasspathContainer
    The iizi classpath container for the Core and Plug-in libraries that dynamically adjust the classpath for the plug-ins used.
    Author:
    Christopher Mindus
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  IzClasspathContainer.Type
      The type of container.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String BASE_PATH
      The base string for the iizi libraries path, i.e.
      static java.lang.String CURRENT_VERSION
      The current version of the libraries: "1.0".
      • Fields inherited from interface org.eclipse.jdt.core.IClasspathContainer

        K_APPLICATION, K_DEFAULT_SYSTEM, K_SYSTEM
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void finalize()
      Called for garbage collection.
      org.eclipse.jdt.core.IClasspathEntry[] getClasspathEntries()
      Answers the set of classpath entries this container is mapping to.
      java.lang.String getDescription()
      Answers a readable description of this container.
      int getKind()
      Answers the kind of this container.
      org.eclipse.core.runtime.IPath getPath()
      Answers the container path identifying this container.
      static void onProjectClean​(org.eclipse.core.resources.IProject project)
      Cleans a project and its classpath container(s).
      static org.eclipse.core.runtime.IPath pathFromURL​(java.net.URL url)
      Converts an URL to IPath.
      static org.eclipse.core.runtime.IPath pathFromURL​(java.net.URL url, boolean logError)
      Converts an URL to IPath.
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • BASE_PATH

        public static final java.lang.String BASE_PATH
        The base string for the iizi libraries path, i.e. the first segment in the path: "com.iizix".
        See Also:
        Constant Field Values
      • CURRENT_VERSION

        public static final java.lang.String CURRENT_VERSION
        The current version of the libraries: "1.0".
        See Also:
        Constant Field Values
    • Method Detail

      • onProjectClean

        public static void onProjectClean​(org.eclipse.core.resources.IProject project)
        Cleans a project and its classpath container(s).
        Parameters:
        project - The project.
      • pathFromURL

        public static org.eclipse.core.runtime.IPath pathFromURL​(java.net.URL url)
        Converts an URL to IPath. The URL is pointing to the root classpath in a bundle's plug-in Jar and is either a directory "file:/..." or a jar "jar:file:/....jar!/". Due to problems in URIUtil.toPath(uri) when illegal characters such as spaces is present, use the File processing instead. If the path returned points to a Jar file, it will be treated as a Jar file classpath entry, and if it's a directory, then it will point to that directory.
        Parameters:
        url - The URL to convert.
        Returns:
        null if unsuccessful.
      • pathFromURL

        public static org.eclipse.core.runtime.IPath pathFromURL​(java.net.URL url,
                                                                 boolean logError)
        Converts an URL to IPath. The URL is pointing to the root classpath in a bundle's plug-in Jar and is either a directory "file:/..." or a jar "jar:file:/....jar!/". Due to problems in URIUtil.toPath(uri) when illegal characters such as spaces is present, use the File processing instead. If the path returned points to a Jar file, it will be treated as a Jar file classpath entry, and if it's a directory, then it will point to that directory.
        Parameters:
        url - The URL to convert.
        logError - Flag to log error in case URL cannot be resolved or not.
        Returns:
        null if unsuccessful.
      • finalize

        protected void finalize()
                         throws java.lang.Throwable
        Called for garbage collection.
        Overrides:
        finalize in class java.lang.Object
        Throws:
        java.lang.Throwable - For finalize exceptions.
      • getKind

        public int getKind()
        Answers the kind of this container. Can be either:
        • K_APPLICATION if this container maps to an application library
        • K_SYSTEM if this container maps to a system library
        • K_DEFAULT_SYSTEM if this container maps to a default system library (library implicitly contributed by the runtime).
        Typically, system containers should be placed first on a build path.
        Specified by:
        getKind in interface org.eclipse.jdt.core.IClasspathContainer
        Returns:
        The kind of this container: K_APPLICATION.
      • getDescription

        public java.lang.String getDescription()
        Answers a readable description of this container.
        Specified by:
        getDescription in interface org.eclipse.jdt.core.IClasspathContainer
        Returns:
        A string description of the container.
      • getPath

        public org.eclipse.core.runtime.IPath getPath()
        Answers the container path identifying this container. A container path is formed by a first ID segment followed with extra segments, which can be used as additional hints for resolving to this container.

        The container ID is also used to identify aClasspathContainerInitializer registered on the extension point "org.eclipse.jdt.core.classpathContainerInitializer", which can be invoked if needing to resolve the container before it is explicitly set.

        Specified by:
        getPath in interface org.eclipse.jdt.core.IClasspathContainer
        Returns:
        The container path that is associated with this container.
      • getClasspathEntries

        public org.eclipse.jdt.core.IClasspathEntry[] getClasspathEntries()
        Answers the set of classpath entries this container is mapping to.

        The set of entries associated with a classpath container may contain any of the following:

        • library entries (CPE_LIBRARY)
        • project entries (CPE_PROJECT)
        A classpath container can neither reference further classpath containers or classpath variables.

        A library entry can reference other libraries through the Class-Path section of the JAR's MANIFEST.MF file. If the container wants such referenced entries to be part of the classpath, the container must explicitly add them to the result.

        This method is called by the Java model when it needs to resolve this classpath container entry into a list of library and project entries. The method is typically called exactly once for a given Java project, and the resulting list of entries cached internally by the Java model. This method must not be called by other clients.

        There are a wide variety of conditions under which this method may be invoked. To ensure that the implementation does not interfere with correct functioning of the Java model, the implementation should use only the following Java model APIs:

        • JavaCore.newLibraryEntry(IPath, IPath, IPath, boolean) and variants
        • JavaCore.newProjectEntry(IPath, boolean) and variants
        • JavaCore.create(org.eclipse.core.resources.IWorkspaceRoot)
        • JavaCore.create(org.eclipse.core.resources.IProject)
        • JavaCore.getReferencedClasspathEntries(IClasspathEntry, IJavaProject) with null as project
        • IJavaModel.getJavaProjects()
        • IJavaProject.getRawClasspath()
        • IJavaProject.readRawClasspath()
        • IJavaProject.getOutputLocation()
        • IJavaProject.readOutputLocation()
        • Java element operations marked as "handle-only"
        The effects of using other Java model APIs are unspecified.
        Specified by:
        getClasspathEntries in interface org.eclipse.jdt.core.IClasspathContainer
        Returns:
        IClasspathEntry [] - the classpath entries this container represents.
        See Also:
        IClasspathEntry