@Retention(value=RUNTIME) @Target(value=TYPE) public @interface Plugin
SciJavaPlugin
,
PluginService
Modifier and Type | Fields and Description |
---|---|
static String |
APPLICATION_MENU_ROOT
Deprecated.
Use
UIDetails.APPLICATION_MENU_ROOT instead. |
static 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!
|
Modifier and Type | Required Element and Description |
---|---|
Class<? extends SciJavaPlugin> |
type
The type of plugin; e.g.,
Service . |
Modifier and Type | Optional Element and Description |
---|---|
Attr[] |
attrs
A list of additional attributes which can be used to extend this annotation
beyond its built-in capabilities.
|
String |
description
A longer description of the plugin (e.g., for use as a tool tip).
|
boolean |
enabled
When false, the plugin is grayed out in the user interface, if applicable.
|
boolean |
headless
Provides a "hint" as to whether the plugin would behave correctly in a
headless context.
|
String |
iconPath
Path to the plugin's icon (e.g., shown in the menu structure).
|
String |
initializer
Defines a function that is called to initialize the plugin in some way.
|
String |
label
The human-readable label to use (e.g., in the menu structure).
|
Menu[] |
menu
Full menu path defining where the plugin is shown in the menu structure.
|
String |
menuPath
Abbreviated menu path defining where the plugin is shown in the menu
structure.
|
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.
|
String |
name
The name of the plugin.
|
double |
priority
The plugin index returns plugins sorted by priority.
|
boolean |
selectable
Whether the plugin can be selected in the user interface.
|
String |
selectionGroup
For selectable plugins, specifies a name defining a group of linked
plugins, only one of which is selected at any given time.
|
boolean |
visible
When false, the plugin is not displayed in the user interface.
|
@Deprecated public static final String APPLICATION_MENU_ROOT
UIDetails.APPLICATION_MENU_ROOT
instead.@Deprecated public static final String CONTEXT_MENU_ROOT
public abstract Class<? extends SciJavaPlugin> type
Service
.public abstract String name
public abstract String label
public abstract String description
public abstract String menuPath
>
) as a separator; e.g.: "Image
> Overlay > Properties..." defines a "Properties..." menu item within
the "Overlay" submenu of the "Image" menu. Use either menuPath()
or
menu()
but not both.public abstract Menu[] menu
menuPath()
or menu()
but
not both.public abstract String menuRoot
UIDetails.APPLICATION_MENU_ROOT
references the menu structure of the primary application window.public abstract String iconPath
public abstract double priority
Service
s 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:
Service
public abstract boolean selectable
selectionGroup()
).public abstract String selectionGroup
public abstract boolean enabled
public abstract boolean visible
public abstract boolean headless
Plugin developers should not specify headless = true
unless 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.
public abstract String initializer
public abstract Attr[] attrs
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.
Copyright © 2015–2022 SciJava. All rights reserved.