Bug 206175 - API Request for creation of User Libs
Summary: API Request for creation of User Libs
Status: VERIFIED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: 3.4 M3   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-10-12 13:53 EDT by Gerry Kessler CLA
Modified: 2007-10-30 07:40 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gerry Kessler CLA 2007-10-12 13:53:00 EDT
We would like to request that API be created so that User Libraries can be created programatically, and so that a plugin can create and contribute User Libraries to a workspace.  
 
The WTP JSF sub-project built something we call JSF Libraries.  These libraries allow for named sets of jars to be added to the build classpath, and, when a WTP classpathAttribute is set, the library can be deployed to the web server.  The libraries are very similar to User Libraries except that we allow for plugins to create them using an extension-point.  However we do not have support for the source, javadoc and other attributes that people are now asking for. 
 
Adopters are using our libaries to define sets of JSF Implementations and JSF Component libraries so that: 
    a) end-users do not need to configure them themselves, and 
    b) so that the plugins can have a more predictable classpath environment for a web app.
 
We believe that there could be many other adopters outside of the JSF project that would also benefit from this feature.
Comment 1 Jerome Lanneluc CLA 2007-10-15 06:20:54 EDT
This API already exists. See ClasspathContainerInitializer#requestClasspathContainerUpdate(...).

Here is an example on how to use it:

final IClasspathEntry[] entries = {JavaCore.newLibraryEntry(path, null, null)};
final IPath containerPath = 
  new Path(JavaCore.USER_LIBRARY_CONTAINER_ID).append("MyUserLibrary");
IClasspathContainer newContainer = 
  new IClasspathContainer() {
    public IClasspathEntry[] getClasspathEntries() {
      return entries;
    }
    public String getDescription() {
      return "MyUserLibrary";
    }
    public int getKind() {
      return IClasspathContainer.K_APPLICATION;
    }
    public IPath getPath() {
      return containerPath;
    }
};
ClasspathContainerInitializer initializer =
  JavaCore.getClasspathContainerInitializer(JavaCore.USER_LIBRARY_CONTAINER_ID);
initializer.requestClasspathContainerUpdate(containerPath, otherProject,
  newContainer);

Please reopen if this doesn't suit your needs.
Comment 2 Frederic Fusier CLA 2007-10-30 07:40:32 EDT
Verified for 3.4M3 using I20071029-0010 build.