站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc (Current Development Version)

LibraryManager (External Libraries) - NetBeans API Javadoc (Current Development Version)

org.netbeans.modules.project.libraries/1 1.14

org.netbeans.api.project.libraries
Class LibraryManager

java.lang.Object
  extended by org.netbeans.api.project.libraries.LibraryManager

public final class LibraryManager
extends Object

LibraryManager provides registry of the installed libraries. LibraryManager can be used to list all installed libraries or to query library by its system name.


Field Summary
static String PROP_LIBRARIES
           
 
Method Summary
 void addLibrary(Library library)
          Installs a new library into the library manager.
 void addPropertyChangeListener(PropertyChangeListener listener)
          Adds PropertyChangeListener.
static LibraryManager getDefault()
          Get the default instance of the library manager.
 Library[] getLibraries()
          List all library defined in the IDE.
 Library getLibrary(String name)
          Returns library by its name.
 void removeLibrary(Library library)
          Removes installed library
 void removePropertyChangeListener(PropertyChangeListener listener)
          Removes PropertyChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROP_LIBRARIES

public static final String PROP_LIBRARIES
See Also:
Constant Field Values
Method Detail

getLibrary

public Library getLibrary(String name)
Returns library by its name.

Parameters:
name - of the library, must not be null
Returns:
library or null if the library is not found

getLibraries

public Library[] getLibraries()
List all library defined in the IDE.

Returns:
Library[] library definitions never null

addLibrary

public void addLibrary(Library library)
                throws IOException,
                       IllegalArgumentException
Installs a new library into the library manager.

A typical usage would be:

LibraryManager libraryManager = LibraryManager.getDefault(); LibraryImplementation libImpl = LibrariesSupport.getLibraryTypeProvider("j2se").createLibrary(); libImpl.setName("FooLibTest"); libImpl.setContent ("classpath",listOfResources); libraryManager.addLibrary(LibraryFactory.createLibrary(libImpl));

Parameters:
library - to be installed, the library has to be created with registered LibraryTypeProvider.
Throws:
IOException - when the library cannot be stored
IllegalArgumentException - if the library is not recognized by any LibraryTypeProvider or the library of the same name already exists.
Since:
org.netbeans.modules.project.libraries/1 1.14

removeLibrary

public void removeLibrary(Library library)
                   throws IOException,
                          IllegalArgumentException
Removes installed library

Parameters:
library - to be removed.
Throws:
IOException - when library cannot be deleted.
IllegalArgumentException - when library is not installed in a writable LibraryProvider
Since:
org.netbeans.modules.project.libraries/1 1.14

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Adds PropertyChangeListener. The listener is notified when library is added or removed.

Parameters:
listener - to be notified

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Removes PropertyChangeListener

Parameters:
listener -

getDefault

public static LibraryManager getDefault()
Get the default instance of the library manager.

Returns:
the singleton instance

org.netbeans.modules.project.libraries/1 1.14

Built on May 28 2007.  |  Portions Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.