|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.openide.loaders.DataLoaderPool
Pool of data loaders.
Provides access to set of registered
loaders
in the system. They are used to find valid data objects
for given files.
The default instance can be retrieved using lookup.
Constructor Summary | |
protected |
DataLoaderPool()
Create new loader pool. |
protected |
DataLoaderPool(DataLoader loader)
Create new loader pool and set preferred loader. |
Method Summary | |
void |
addChangeListener(ChangeListener chl)
Add a new listener to the listener list. |
void |
addOperationListener(OperationListener l)
Add a listener for operations on data objects. |
Enumeration |
allLoaders()
Get an enumeration of all loaders, including the preferred and system loaders. |
static OperationListener |
createWeakOperationListener(OperationListener l,
Object s)
Factory to create weak OperationListener |
DataObject |
findDataObject(FileObject fo)
Find a data object for this file object (not for normal users of the APIs). |
DataObject |
findDataObject(FileObject fo,
DataLoader.RecognizedFiles r)
Find a data object for this file object, considering already-recognized files (not for normal users of the APIs). |
protected void |
fireChangeEvent(ChangeEvent che)
Fire change event to all listeners. |
DataLoader |
firstProducerOf(Class clazz)
Finds the first producer of a representation class. |
static DataLoaderPool |
getDefault()
Getter for the default pool of loaders used in the system. |
static DataLoader |
getPreferredLoader(FileObject fo)
Get the preferred loader for a file. |
protected abstract Enumeration |
loaders()
Get an enumeration of data loaders. |
Enumeration |
producersOf(Class clazz)
Get an enumeration of all producers of a representation class. |
void |
removeChangeListener(ChangeListener chl)
Remove a listener from the listener list. |
void |
removeOperationListener(OperationListener l)
Remove a listener for operations on data objects. |
static void |
setPreferredLoader(FileObject fo,
DataLoader loader)
Utility method to mark a file as belonging to a loader. |
DataLoader[] |
toArray()
Get an array of loaders that are currently registered. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected DataLoaderPool()
protected DataLoaderPool(DataLoader loader)
loader
- the preferred loaderMethod Detail |
public static DataLoaderPool getDefault()
protected abstract Enumeration loaders()
DataLoader
spublic final void addChangeListener(ChangeListener chl)
chl
- new listenerpublic final void removeChangeListener(ChangeListener chl)
chl
- listener to removeprotected final void fireChangeEvent(ChangeEvent che)
che
- change eventpublic static OperationListener createWeakOperationListener(OperationListener l, Object s)
l
- listeners
- the source the new listener will be attached topublic final void addOperationListener(OperationListener l)
l
- the listenerpublic final void removeOperationListener(OperationListener l)
l
- the listenerpublic final Enumeration allLoaders()
DataLoader
spublic DataLoader[] toArray()
loaders()
public final DataLoader firstProducerOf(Class clazz)
clazz
.
clazz
- class to find producer for
null
if there is no loader that
can produce the classpublic final Enumeration producersOf(Class clazz)
clazz
- class to find producers for
DataLoader
sfirstProducerOf(java.lang.Class)
public DataObject findDataObject(FileObject fo) throws IOException
DataObject.find(org.openide.filesystems.FileObject)
instead.
This call will throw an exception if it already exists, and it is normally
only for use by the loader infrastructure.
All loaders are asked to recognize it according to their priority.
fo
- file object to recognize
null
if
no loader recognizes this file
DataObjectExistsException
- if the object for this primary file
already exists
IOException
- if the data object is recognized but
an error occurs during instantiationfindDataObject(FileObject, DataLoader.RecognizedFiles)
public DataObject findDataObject(FileObject fo, DataLoader.RecognizedFiles r) throws IOException
DataObject.find(org.openide.filesystems.FileObject)
instead.
This call will throw an exception if it already exists, and it is normally
only for use by the loader infrastructure.
First of all looks at the
file extended attribute NetBeansDataLoader
; if it is set and it
contains the class name of a valid DataLoader
, that loader is given preference.
For all loaders used, the first to return non-null
from DataLoader.findDataObject(org.openide.filesystems.FileObject, org.openide.loaders.DataLoader.RecognizedFiles)
is used.
fo
- file object to recognizer
- recognized files buffer
DataObjectExistsException
- if the object for this primary file
already exists
IOException
- if the data object is recognized but
an error occurs during instantiationpublic static void setPreferredLoader(FileObject fo, DataLoader loader) throws IOException
fo
- file to markloader
- the loader to assign to the file or null if previous
association should be cleared
IOException
- if setting the file's attribute failedpublic static DataLoader getPreferredLoader(FileObject fo)
fo
- the file to get loader from
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |