本文整理了Java中org.scijava.plugin.Plugin
类的一些代码示例,展示了Plugin
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Plugin
类的具体详情如下:
包路径:org.scijava.plugin.Plugin
类名称:Plugin
暂无
代码示例来源:origin: org.scijava/scijava-common
/**
* Default service for managing available {@link InputWidget}s.
*
* @author Curtis Rueden
*/
@Plugin(type = Service.class)
public class DefaultWidgetService extends
AbstractWrapperService<WidgetModel, InputWidget<?, ?>> implements
WidgetService
{
// NB: No implementation needed.
}
代码示例来源:origin: org.scijava/scijava-common
/**
* Gets the plugin type of the given plugin class, as declared by its
* {@code @Plugin} annotation (i.e., {@link Plugin#type()}).
*
* @param pluginClass The plugin class whose plugin type is needed.
* @return The plugin type, or null if no {@link Plugin} annotation exists for
* the given class.
*/
public static <PT extends SciJavaPlugin, P extends PT> Class<PT> getPluginType(
final Class<P> pluginClass)
{
final Plugin annotation = pluginClass.getAnnotation(Plugin.class);
if (annotation == null) return null;
@SuppressWarnings("unchecked")
final Class<PT> type = (Class<PT>) annotation.type();
return type;
}
代码示例来源:origin: net.imagej/imagej-legacy
/**
* Command which focuses the ImageJ search bar.
* <p>
* This overrides the old ImageJ 1.x Command Finder plugin.
* </p>
*
* @author Curtis Rueden
*/
@Plugin(type = Command.class, menu = { @Menu(label = "Plugins"), @Menu(
label = "Utilities"), @Menu(label = "Focus Search Bar",
accelerator = "meta L") }, priority = Priority.HIGH, enabled = false)
public class FocusSearchBar implements Command {
@Parameter
private LegacyService legacyService;
@Override
public void run() {
final Object searchBar = legacyService.getIJ1Helper().getSearchBar();
if (!(searchBar instanceof SwingSearchBar)) return;
((SwingSearchBar) searchBar).activate();
}
}
代码示例来源:origin: imagej/imagej-ops
@Plugin(type = Op.class, name = "test.arrr!")
public static class Captain extends NoOp {
@Parameter
private Booty inventory;
}
代码示例来源:origin: org.scijava/scijava-common
final Plugin ann = getAnnotation();
if (ann == null) return;
setName(ann.name());
setLabel(ann.label());
setDescription(ann.description());
final Menu[] menu = ann.menu();
if (menu.length > 0) {
menuPath = parseMenuPath(menu);
menuPath = new MenuPath(ann.menuPath());
setMenuRoot(ann.menuRoot());
final String iconPath = ann.iconPath();
setIconPath(iconPath);
setPriority(ann.priority());
setEnabled(ann.enabled());
setVisible(ann.visible());
setSelectable(ann.selectable());
setSelectionGroup(ann.selectionGroup());
for (final Attr attr : ann.attrs()) {
final String name = attr.name();
final String value = attr.value();
代码示例来源:origin: net.imagej/imagej-legacy
!info.getAnnotation().visible())
代码示例来源:origin: net.imagej/imagej-legacy
/**
* A command to switch between legacy and modern UI modes.
*
* @author Johannes Schindelin
*/
@Plugin(type = Command.class, menu = { @Menu(label = "Help"),
@Menu(label = "Switch to Legacy Mode") }, attrs = { @Attr(name = "no-legacy") })
public class SwitchToLegacyMode extends ContextCommand {
@Parameter
private LegacyService legacyService;
@Override
public void run() {
legacyService.toggleLegacyMode(true);
}
}
代码示例来源:origin: imagej/imagej-ops
@Plugin(type = Foo.class)
public static class AppleIface2Foo extends NoOp implements Foo {
@Parameter(type = ItemIO.INPUT)
private AppleIface2 in;
}
代码示例来源:origin: scijava/scijava-common
final Plugin ann = getAnnotation();
if (ann == null) return;
setName(ann.name());
setLabel(ann.label());
setDescription(ann.description());
final Menu[] menu = ann.menu();
if (menu.length > 0) {
menuPath = parseMenuPath(menu);
menuPath = new MenuPath(ann.menuPath());
setMenuRoot(ann.menuRoot());
final String iconPath = ann.iconPath();
setIconPath(iconPath);
setPriority(ann.priority());
setEnabled(ann.enabled());
setVisible(ann.visible());
setSelectable(ann.selectable());
setSelectionGroup(ann.selectionGroup());
for (final Attr attr : ann.attrs()) {
final String name = attr.name();
final String value = attr.value();
代码示例来源:origin: net.imagej/imagej-common
/**
* Runs the Edit::Options::Reset dialog.
*
* @author Barry DeZonia
*/
@Plugin(type = Command.class, menu = {
@Menu(label = MenuConstants.EDIT_LABEL, weight = MenuConstants.EDIT_WEIGHT,
mnemonic = MenuConstants.EDIT_MNEMONIC),
@Menu(label = "Options", mnemonic = 'o'),
@Menu(label = "Reset", weight = 20) }, attrs = { @Attr(name = "no-legacy") })
public class OptionsReset implements Command {
@Parameter
private OptionsService optionsService;
@Override
public void run() {
optionsService.reset();
}
}
代码示例来源:origin: imagej/imagej-ops
@Plugin(type = Foo.class)
public static class OrangeIfaceFoo extends NoOp implements Foo {
@Parameter(type = ItemIO.INPUT)
private OrangeIface in;
}
代码示例来源:origin: org.scijava/scijava-common
/**
* Default service for managing available {@link CodeRunner} plugins.
*
* @author Curtis Rueden
*/
@Plugin(type = Service.class)
public class DefaultRunService extends
AbstractHandlerService<Object, CodeRunner> implements RunService
{
// NB: No implementation needed.
}
代码示例来源:origin: scijava/scijava-common
/**
* Gets the plugin type of the given plugin class, as declared by its
* {@code @Plugin} annotation (i.e., {@link Plugin#type()}).
*
* @param pluginClass The plugin class whose plugin type is needed.
* @return The plugin type, or null if no {@link Plugin} annotation exists for
* the given class.
*/
public static <PT extends SciJavaPlugin, P extends PT> Class<PT> getPluginType(
final Class<P> pluginClass)
{
final Plugin annotation = pluginClass.getAnnotation(Plugin.class);
if (annotation == null) return null;
@SuppressWarnings("unchecked")
final Class<PT> type = (Class<PT>) annotation.type();
return type;
}
代码示例来源:origin: org.scijava/scijava-plugins-commands
/**
* Clears the list of recently opened files.
*
* @author Curtis Rueden
*/
@Plugin(type = Command.class, label = "Clear Recent", menu = {
@Menu(label = MenuConstants.FILE_LABEL, weight = MenuConstants.FILE_WEIGHT,
mnemonic = MenuConstants.FILE_MNEMONIC),
@Menu(label = "Open Recent", weight = 4, mnemonic = 'r'),
@Menu(label = "Clear List", weight = RecentFileService.MAX_FILES_SHOWN + 10,
mnemonic = 'c') }, attrs = { @Attr(name = "no-legacy") })
public class ClearRecent implements Command {
@Parameter
private RecentFileService recentFileService;
// -- Command methods --
@Override
public void run() {
recentFileService.clear();
}
}
代码示例来源:origin: imagej/imagej-ops
@Plugin(type = Foo.class)
public static class OrangeClassFoo extends NoOp implements Foo {
@Parameter(type = ItemIO.INPUT)
private OrangeClass in;
}
代码示例来源:origin: org.scijava/scijava-common
/**
* Default implementation of {@link ScriptProcessorService}.
*
* @author Curtis Rueden
*/
@Plugin(type = Service.class)
public class DefaultScriptProcessorService extends
AbstractPTService<ScriptProcessor> implements ScriptProcessorService
{
// NB: No implementation needed.
}
代码示例来源:origin: imagej/imagej-ops
/**
* Gets the type of op, as specified via {@code @Plugin(type = <type>)}).
*/
public Class<? extends Op> getType() {
// HACK: The CommandInfo.getPluginType() method returns Command.class.
// But we want to get the actual type of the wrapped PluginInfo.
// CommandInfo does not have a getPluginInfo() unwrap method, though.
// So let's extract the type directly from the @Plugin annotation.
final Class<? extends SciJavaPlugin> type = cInfo.getAnnotation().type();
if (type == null || !Op.class.isAssignableFrom(type)) {
throw new IllegalStateException("Op type " + type + " is not an Op!");
}
@SuppressWarnings("unchecked")
final Class<? extends Op> opType = (Class<? extends Op>) type;
return opType;
}
代码示例来源:origin: org.scijava/scijava-plugins-commands
/**
* Closes the active display.
*
* @author Curtis Rueden
*/
@Plugin(type = Command.class, menu = {
@Menu(label = MenuConstants.FILE_LABEL, weight = MenuConstants.FILE_WEIGHT,
mnemonic = MenuConstants.FILE_MNEMONIC),
@Menu(label = "Close", weight = 16, mnemonic = 'c', accelerator = "^W") },
attrs = { @Attr(name = "no-legacy") })
public class Close extends ContextCommand {
// -- Parameters --
@Parameter(type = ItemIO.BOTH)
private Display<?> display;
// -- Runnable methods --
@Override
public void run() {
display.close();
}
}
代码示例来源:origin: imagej/imagej-ops
@Plugin(type = FruitOp.class, name = "test.fakeInplaceD")
public static class FakeInplaceA extends AbstractFruitOp {
@Parameter(type = ItemIO.BOTH)
private Apple a;
}
代码示例来源:origin: org.scijava/scijava-common
/**
* Default {@link ConvertService} implementation.
*
* @author Mark Hiner
*/
@Plugin(type = Service.class)
public class DefaultConvertService extends AbstractConvertService
{
// Trivial implementation
}
内容来源于网络,如有侵权,请联系作者删除!