project

Support Library for Extending the Project System
Predfined Global Variables
TrackedRegistry( regFn, unregFn ) [constructor]
TrackedRegistry.register( entity )
TrackedRegistry.unregister()
TrackedRegistry.unregisterAll()
ActionRegistry
NewActionRegistry
OpenerRegistry
MetadataRegistry
NewTaskTypeRegistry
unregisterAll()
testProjectScript()

Support Library for Extending the Project System

This library provides a set of functions that make it easier to add new features to the project system. Everything that you register using these methods will be tracked, so that it can be unregistered in a single step. For example code, see the Project Examples folder of the plug-in authoring kit.

Predfined Global Variables

The arkham.project package is imported into the name space, as is the class java.io.File. The constant ProjectUtils is also defined to be the class ProjectUtilities, to match the naming conventions used in other script libraries.

TrackedRegistry( regFn, unregFn ) [constructor]

A tracked registry registers and unregisters objects in some kind of registry, and also tracks the registered objects so that they can all be unregistered at once. Registry trackers are used by the rest of the project library to track various project entities.
regFn the function to call to perform registration
unregFn the function to call to perform unregistration

TrackedRegistry.register( entity )

Registers an entity with this tracker by calling the regFn used to create the tracker. Any arguments passed to the function will be passed to regFn, including entity.

TrackedRegistry.unregister()

Unregisters an entity with this tracker by calling the unregFn used to create the tracker.

TrackedRegistry.unregisterAll()

Unregisters all tracked entities.

ActionRegistry

A tracked registry of project actions. Project actions are commands that can be applied to the selected project file(s). The register function takes a task action and (optionally), a priority value. The priority determines the order of the action in the project view's context menu. The default is Actions.PRIORITY_DEFAULT.

NewActionRegistry

A tracked registry of child actions of the New action. These are actions that will appear as suboptions of the New menu in a project. The register function takes a task action and (optionally) an action (or the name of an action) that this action should be inserted after.

OpenerRegistry

A tracked registry of internal openers. Internal openers are used by the Open action to open files inside of the application. A new internal opener can be used to support opening new kinds of file.

MetadataRegistry

A tracked registry of project metadata sources. A metatdata source provides metadata for a particular file type. This includes the icon used for the file type in the project view, and the information listed on the Properties tab when files of that type are selected.

NewTaskTypeRegistry

A tracked registry of NewTaskTypes. New task types are used to add support for new kinds of task folders.

unregisterAll()

This function unregisters all entities that have been registered with any TrackedRegistry. It is typically called in a plug-in's unload() function.

testProjectScript()

When run directly from a script editor, this function calls the script's run() function, then creates an Unregister button that will call the script's unload() function (which should in turn call unregisterAll()). When developing a project plug-in, it is important to unregister changes you make to the project system before re-running your script, because many elements in the project system can only be registered once. For example, only one task action with a given name can be registered at a given time.

Contents