Annotation Type Plugin
-
@Retention(RUNTIME) @Target(TYPE) public @interface Plugin
Annotation identifying a plugin, which gets loaded by SciJava's dynamic discovery mechanism.- Author:
- Curtis Rueden
- See Also:
SciJavaPlugin,PluginService
-
-
Field Summary
Fields Modifier and Type Fields Description static StringAPPLICATION_MENU_ROOTDeprecated.UseUIDetails.APPLICATION_MENU_ROOTinstead.static StringCONTEXT_MENU_ROOTDeprecated.Use a context-specific menu root string instead.
-
Required Element Summary
Required Elements Modifier and Type Required Element Description Class<? extends SciJavaPlugin>typeThe type of plugin; e.g.,Service.
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description Attr[]attrsA list of additional attributes which can be used to extend this annotation beyond its built-in capabilities.StringdescriptionA longer description of the plugin (e.g., for use as a tool tip).booleanenabledWhen false, the plugin is grayed out in the user interface, if applicable.booleanheadlessProvides a "hint" as to whether the plugin would behave correctly in a headless context.StringiconPathPath to the plugin's icon (e.g., shown in the menu structure).StringinitializerDefines a function that is called to initialize the plugin in some way.StringlabelThe human-readable label to use (e.g., in the menu structure).Menu[]menuFull menu path defining where the plugin is shown in the menu structure.StringmenuPathAbbreviated menu path defining where the plugin is shown in the menu structure.StringmenuRootString identifier naming the menu to which this plugin belongs, or in the case of a tool, the context menu that should be displayed while the tool is active.StringnameThe name of the plugin.doublepriorityThe plugin index returns plugins sorted by priority.booleanselectableWhether the plugin can be selected in the user interface.StringselectionGroupFor selectable plugins, specifies a name defining a group of linked plugins, only one of which is selected at any given time.booleanvisibleWhen false, the plugin is not displayed in the user interface.
-
-
-
Field Detail
-
APPLICATION_MENU_ROOT
@Deprecated static final String APPLICATION_MENU_ROOT
Deprecated.UseUIDetails.APPLICATION_MENU_ROOTinstead.
-
-
-
CONTEXT_MENU_ROOT
@Deprecated static final String CONTEXT_MENU_ROOT
Deprecated.Use a context-specific menu root string instead. This one is too general. There is no such thing as a "default context menu" since such a thing wouldn't be a context menu!
-
-
Element Detail
-
type
Class<? extends SciJavaPlugin> type
The type of plugin; e.g.,Service.
-
-
-
name
String name
The name of the plugin.- Default:
- ""
-
-
-
label
String label
The human-readable label to use (e.g., in the menu structure).- Default:
- ""
-
-
-
description
String description
A longer description of the plugin (e.g., for use as a tool tip).- Default:
- ""
-
-
-
menuPath
String menuPath
Abbreviated menu path defining where the plugin is shown in the menu structure. Uses greater than signs (>) as a separator; e.g.: "Image > Overlay > Properties..." defines a "Properties..." menu item within the "Overlay" submenu of the "Image" menu. Use eithermenuPath()ormenu()but not both.- Default:
- ""
-
-
-
menu
Menu[] menu
Full menu path defining where the plugin is shown in the menu structure. This construction allows menus to be fully specified including mnemonics, accelerators and icons. Use eithermenuPath()ormenu()but not both.- Default:
- {}
-
-
-
menuRoot
String menuRoot
String identifier naming the menu to which this plugin belongs, or in the case of a tool, the context menu that should be displayed while the tool is active. The default value ofUIDetails.APPLICATION_MENU_ROOTreferences the menu structure of the primary application window.- Default:
- "app"
-
-
-
iconPath
String iconPath
Path to the plugin's icon (e.g., shown in the menu structure).- Default:
- ""
-
-
-
priority
double priority
The plugin index returns plugins sorted by priority. For example, this is useful forServices to control which service implementation is chosen when multiple implementations are present in the classpath, as well as to force instantiation of one service over another when the dependency hierarchy does not dictate otherwise.Any double value is allowed, but for convenience, there are some presets:
- See Also:
Service
- Default:
- 0.0
-
-
-
selectable
boolean selectable
Whether the plugin can be selected in the user interface. A plugin's selection state (if any) is typically rendered in the menu structure using a checkbox or radio button menu item (seeselectionGroup()).- Default:
- false
-
-
-
selectionGroup
String selectionGroup
For selectable plugins, specifies a name defining a group of linked plugins, only one of which is selected at any given time. Typically this is rendered in the menu structure as a group of radio button menu items. If no group is given, the plugin is assumed to be a standalone toggle, and typically rendered as a checkbox menu item.- Default:
- ""
-
-
-
headless
boolean headless
Provides a "hint" as to whether the plugin would behave correctly in a headless context.Plugin developers should not specify
headless = trueunless the plugin refrains from using any UI-specific features (e.g., AWT or Swing calls).Of course, merely setting this flag does not guarantee that the plugin will not invoke any headless-incompatible functionality, but it provides an extra safety net for downstream headless code that wishes to be conservative in which plugins it allows to execute.
- Default:
- false
-
-
-
initializer
String initializer
Defines a function that is called to initialize the plugin in some way.- Default:
- ""
-
-
-
attrs
Attr[] attrs
A list of additional attributes which can be used to extend this annotation beyond its built-in capabilities.Note to developers: when designing new plugin types, it is tempting to use this attribute to store additional information about each plugin. However, we suggest doing so only if you need that additional information before creating an instance of the plugin: e.g., to decide whether to instantiate one, or even whether to load the annotated plugin class at all. If you are going to create a plugin instance anyway, it is cleaner and more type-safe to add proper API methods to the plugin type's interface reporting the same information.
- Default:
- {}
-
-