Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| org.openide.loaders 5.9.22
PREV NEXT | FRAMES NO FRAMES

# NetBeans Loaders API

See:
Description

Loaders API
org.openide.actions |
org.openide.awt |
org.openide.loaders | Datasystems are the logical layer between a filesystem and the regular functions of the IDE.
org.openide.text |

### What is New (see all changes)?

- Oct 26 '05 All standard loaders reads their data from the layer

  Default loaders, default XML loader and instances loader read their actions from `Loaders/content/unknown/Actions`, `Loaders/text/xml/Actions` and `Loaders/application/x-nbsettings/Actions`.

- Sep 19 '05 New DataNode constructor that takes Lookup

  It was not possible to use DataNode with own Lookup as the constructor that takes it was available only on Node and there was no way to pass it thru DataNode.

- May 11 '05 Introduction of a new interface FolderRenameHandler which allows plugging into `DataFolder.FolderNode.setName()`

  Refactoring needs to handle rename of DataFolder's Node. It is allowed through FolderRenameHandler. Any client can put it's FolderRenameHandler into Lookup (only one instance is allowed). Implementation of FolderNode.setName() will use this instance to handle rename request.

- Mar 9 '05 A factory method to simplify creation of `DataEditorSupport`

  Many people subclass `DataEditorSupport` to provide editing ability for data objects. The great majority of them wish to provide an editor cookie and with standard semantics for open, modify, save, undo, close, reload, etc. By using the `DataEditorSupport.create` factory method this task is simplified to two lines of code.

- Feb 7 '05 Added `DataLoaderPool.getDefault()`

  `DataLoaderPool` now has a new method `getDefault()` to allow simple access to the default system loader pool.

### Use Cases

A lot of usecases is described in the javadoc. Here is the list of some faqs:

##### How to add action to folder's popup menu?

The actions that the default folder loader shows in its popup menu are read from a layer folder `Loaders/folder/any/Actions` so if any module wishes to extend, hide or reorder some of them it can just register its actions there. As code like this does:

        <folder name="Loaders" >
            <folder name="folder" >
                <folder name="any" >
                    <folder name="Actions" >
                        <file name="org-mymodule-MyAction.instance" >
                            <attr name="instanceCreate" stringvalue="org.mymodule.MyAction" />
                        </file>
                    </folder>
                </folder>
            </folder>
        </folder>

As described in general actions registration tutorial.

This functionality is available since version 5.0 of the loaders module. Please use `OpenIDE-Module-Module-Dependencies: org.openide.loaders > 5.0` in your module dependencies.

In version 5.8 all the standard loaders were changed to read actions from layer:

- The actions that the standard XML loader shows in its popup menu are read from a layer folder `Loaders/text/xml/Actions`
- The actions that the loader for unrecognized files shows in its popup menu are read from a layer folder `Loaders/content/unknown/Actions`
- The actions that the loader for instance and settings files shows in its popup menu are read from a layer folder `Loaders/application/x-nbsettings/Actions`

##### How to allow others to enhance actions of your loader?

If you want other modules to enhance or modify actions that are visible on `DataObject`s produced by your `DataLoader` and you are either using `DataNode` or its subclass, you can just override `protected String actionsContext()` method to return non-null location of context in layers from where to read the actions.

The usual value should match `Loaders/mime/type/Actions` scheme, for example java is using `Loaders/text/x-java/Actions`, but the name can be arbitrary.

This functionality is available since version 5.0 of the loaders module. Please use `OpenIDE-Module-Module-Dependencies: org.openide.loaders > 5.0` in your module dependencies.

### Exported Interfaces

This table lists all of the module exported APIs with defined stability classifications. It is generated based on answers to questions about the architecture of the module. Read them all...

##### Group of java interfaces

Interface Name | In/Out | Stability | Specified in What Document?
LoadersAPI | Exported | Official | .../openide/loaders/doc-files/api.html

##### Group of layer interfaces

Interface Name | In/Out | Stability | Specified in What Document?
Loaders-folder-any-Actions | Exported | Stable | The actions that the default folder loader shows in its popup menu are read from a layer folder `Loaders/folder/any/Actions` so if any module wishes to extend, hide or reorder some of them it can just register its actions there.
Loaders-text-xml-Actions | Exported | Stable | The actions that the standard XML loader shows in its popup menu are read from a layer folder `Loaders/text/xml/Actions`
Loaders-content-unknown-Actions | Exported | Stable | The actions that the loader for unrecognized files shows in its popup menu are read from a layer folder `Loaders/content/unknown/Actions`
Loaders-application-x-nbsettings-Actions | Exported | Stable | The actions that the loader for instance and settings files shows in its popup menu are read from a layer folder `Loaders/application/x-nbsettings/Actions`
PrivilegedTemplates | Exported | Under Development | A folder Privileged offers to other module possibility add own templates.
RecentTemplates | Exported | Private | A folder Recent stores a set of recently used templates, it's not open to other module.

##### Group of property interfaces

Interface Name | In/Out | Stability | Specified in What Document?
NetBeansAttrAssignedLoader | Exported | Stable | Extended attribute for holding the class of the loader that should be used to recognize a file object before the normal processing takes place.
NetBeansAttrAssignedLoaderModule | Exported | Private | Extended attribute which may be used in addition to EA_ASSIGNED_LOADER which indicates the code name base of the module that installed that preferred loader. If the indicated module is not installed, ignore the loader request. See #13816.
template | Exported | Stable | If set to Boolean.TRUE the file is recognized as template and its instantiation is allowed.
isRemoteAndSlow | Exported | Private | NewObjectWizardPanel: The Attribute "isRemoteAndSlow" will be checked for on the targetFolder, and if it is found and true, then targetFolder.getPrimaryFile().getFileObject will NOT be called.
templateWizardURL | Exported | Stable | Attribute that defines a template wizard description page (type `URL` to HTML).
templateWizardIterator | Exported | Stable | Attribute that defines a custom template wizard iterator (type `TemplateWizard.Iterator`).
originalFile | Exported | Stable | Path to the target file in its filesystem (type `String`).
originalFileSystem | Exported | Stable | System name of filesystem of target file (type `String`; default is same as that of shadow).
UseOwnName | Exported | Private | if true, the DataShadow name is used instead of original's name, affects DataShadows of filesystem roots only
PartialOrders | Exported | Stable | Read the list of intended partial orders from disk. Each element is a string of the form `a/b` for `a`, `b` filenames with extension, where `a` should come before `b`. The value of the attribute must be of type `Boolean`; ignored unless `true`.
OpenIDE-Folder-SortMode | Exported | Private | Extended attribute for order of children. The values are "F", "N", "C", "0" (type `String`).
OpenIDE-Folder-Order | Exported | Private | Extended attribute for order of children - stores list of file names separated by '/' (type `String`).
EA-OpenIDE-Connection | Exported | Private | Extended attribute to store (ArrayList of Type and Node.Handle). Used by Java synchronization feature at least; generally, `ConnectionCookie`.
DataFolder.Index.reorderable | Exported | Friend | If set to `Boolean.TRUE` on a folder not in the system filesystem, make its node reorderable.
org.openide.loaders.FolderList.refresh.interval | Exported | Private | The value of type integer determines the number of milliseconds between successive refreshes of contents of a folder. Can be used to tweak performance of folder refresh. Defaults to 10.
netbeans.dataobject.insecure.operation | Exported | Friend | If set to true, the `DataObject.copy, move, createFromTemplate` are executed in insecure way. That means that other threads can access the products of such operation before it finishes. This is a friend contract with projects, that need to do such strange things. Will be removed when they fix it.

### Implementation Details

Read more about the implementation in the answers to architecture questions.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| org.openide.loaders 5.9.22
PREV NEXT | FRAMES NO FRAMES

Built on December 7 2006. | Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.