本文整理汇总了Java中ro.fortsoft.pf4j.PluginWrapper类的典型用法代码示例。如果您正苦于以下问题:Java PluginWrapper类的具体用法?Java PluginWrapper怎么用?Java PluginWrapper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PluginWrapper类属于ro.fortsoft.pf4j包,在下文中一共展示了PluginWrapper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: PluginListDialog
import ro.fortsoft.pf4j.PluginWrapper; //导入依赖的package包/类
public PluginListDialog() {
$$$setupUI$$$();
setContentPane(contentPane);
setModal(true);
getRootPane().setDefaultButton(buttonOK);
List<PluginWrapper> pluginWrappers = DanMuJi.getPluginManager().getPlugins();
DefaultListModel<String> defaultListModel = new DefaultListModel<>();
pluginWrappers.forEach(pluginWrapper -> {
PluginDescriptor pluginDescriptor = pluginWrapper.getDescriptor();
defaultListModel.addElement(String.format("%s %s", pluginDescriptor.getPluginId(), pluginDescriptor.getVersion()));
});
list.setModel(defaultListModel);
totalLabel.setText("Total: " + pluginWrappers.size());
buttonOK.addActionListener(actionEvent -> dispose());
setTitle("Plugin list");
setLocationRelativeTo(null);
pack();
}
示例2: toString
import ro.fortsoft.pf4j.PluginWrapper; //导入依赖的package包/类
@Override
public String toString() {
PluginWrapper plugin = ChessMaster.getPluginManager().whichPlugin(renderer.getClass());
if (plugin == null)
return I18n.format(I18n.CURRENT_LOCALE.get(), "chessmaster", "render." + renderer.getName());
else
return I18n.format(I18n.CURRENT_LOCALE.get(), plugin.getPluginId(), "render." + renderer.getName());
}
示例3: openInputStream
import ro.fortsoft.pf4j.PluginWrapper; //导入依赖的package包/类
static Optional<InputStream> openInputStream(ResourceLocation location) {
if (location.getDomain().equals("chessmaster"))
return Optional.ofNullable(ChessMaster.class.getClassLoader().getResourceAsStream(location.toString()));
PluginWrapper plugin = ChessMaster.getPluginManager().getPlugin(location.getDomain());
if (plugin == null)
return Optional.empty();
return Optional.ofNullable(plugin.getPluginClassLoader().getResourceAsStream(location.toString()));
}
示例4: format
import ro.fortsoft.pf4j.PluginWrapper; //导入依赖的package包/类
static String format(String key, Object... args) {
try {
PluginWrapper plugin = ChessMaster.getPluginManager().whichPlugin(Class.forName(new Throwable().getStackTrace()[1].getClassName()));
if (plugin == null)
return format(CURRENT_LOCALE.get(), "chessmaster", key, args);
else
return format(CURRENT_LOCALE.get(), plugin.getPluginId(), key, args);
} catch (ClassNotFoundException ignored) {
return "";
}
}
示例5: registerOrThrow
import ro.fortsoft.pf4j.PluginWrapper; //导入依赖的package包/类
/**
* registers the addon if checkPermission returns true, else throws the exception provided by the exceptionSupplier.
* If the Addon was not added through PF4J it gets ignored
* @param addOn the addon to check
* @param checkPermission returns true if eligible for registering
*/
protected <X extends IzouPermissionException> void registerOrThrow(AddOnModel addOn, Supplier<X> exceptionSupplier,
Function<PluginDescriptor, Boolean> checkPermission) {
getMain().getAddOnManager().getPluginWrapper(addOn)
.map(PluginWrapper::getDescriptor)
.map(checkPermission)
.ifPresent(allowedToRun -> {
if (allowedToRun) {
registerAddOn(addOn);
} else {
throw exceptionSupplier.get();
}
});
}
示例6: bindTexture
import ro.fortsoft.pf4j.PluginWrapper; //导入依赖的package包/类
static int bindTexture(ResourceLocation location) {
ChessMaster.getLogger().info("Binding texture " + location);
int textureId = glGenTextures();
URL imageURL = null;
if (location.getDomain().equals("chessmaster"))
imageURL = ChessMaster.class.getResource("assets/chessmaster/textures/" + location.getLocation());
else {
PluginWrapper wrapper = ChessMaster.getPluginManager().getPlugin(location.getDomain());
if (wrapper == null)
ChessMaster.getLogger().error("No such plugin called " + location.getDomain(), new NullPointerException());
else
imageURL = wrapper.getPluginClassLoader().getResource("assets/" + location.getDomain() + "/textures/" + location.getLocation());
}
try {
//noinspection ConstantConditions
BufferedImage image = ImageIO.read(imageURL);
ChessMaster.getLogger().info("Readed image " + image);
int[] pixels = new int[image.getWidth() * image.getHeight()];
image.getRGB(0, 0, image.getWidth(), image.getHeight(), pixels, 0, image.getWidth());
ByteBuffer buffer = BufferUtils.createByteBuffer(image.getWidth() * image.getHeight() * 4); //4 for RGBA, 3 for RGB
for(int y = 0; y < image.getHeight(); y++){
for(int x = 0; x < image.getWidth(); x++){
int pixel = pixels[y * image.getWidth() + x];
buffer.put((byte) ((pixel >> 16) & 0xFF)); // Red component
buffer.put((byte) ((pixel >> 8) & 0xFF)); // Green component
buffer.put((byte) (pixel & 0xFF)); // Blue component
buffer.put((byte) ((pixel >> 24) & 0xFF)); // Alpha component. Only for RGBA
}
}
buffer.flip();
ChessMaster.getLogger().info("Create buffer of " + imageURL + " : " + buffer);
GL13.glActiveTexture(textureId);
glBindTexture(GL_TEXTURE_2D, textureId);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
//Setup wrap mode
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE);
//Setup texture scaling filtering
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, image.getWidth(), image.getHeight(), 0, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
GL30.glGenerateMipmap(GL_TEXTURE_2D);
} catch (Exception e) {
ChessMaster.getLogger().error("Cannot bind texture " + location, e);
}
OpenGLRenderer.getResourceTextureIdMap().put(location, textureId);
return textureId;
}
示例7: LanguageManager
import ro.fortsoft.pf4j.PluginWrapper; //导入依赖的package包/类
public LanguageManager(Locale locale) {
bundleMap.put("chessmaster", ResourceBundle.getBundle("assets/lang/", locale, ChessMaster.class.getClassLoader(), new UTF8Control()));
for (PluginWrapper plugin : ChessMaster.getPluginManager().getPlugins())
bundleMap.put(plugin.getPluginId(), ResourceBundle.getBundle("assets/lang/", locale, plugin.getPluginClassLoader(), new UTF8Control()));
}
示例8: Main
import ro.fortsoft.pf4j.PluginWrapper; //导入依赖的package包/类
public Main(PluginWrapper pluginWrapper) {
super(pluginWrapper);
pluginId = pluginWrapper.getPluginId();
log = super.log;
}
示例9: Main
import ro.fortsoft.pf4j.PluginWrapper; //导入依赖的package包/类
public Main(PluginWrapper pluginWrapper) {
super(pluginWrapper);
pluginId = pluginWrapper.getPluginId();
}
示例10: Plugin1
import ro.fortsoft.pf4j.PluginWrapper; //导入依赖的package包/类
public Plugin1(PluginWrapper wrapper) {
super(wrapper);
}
示例11: Plugin2
import ro.fortsoft.pf4j.PluginWrapper; //导入依赖的package包/类
public Plugin2(PluginWrapper wrapper) {
super(wrapper);
}
示例12: getProvider
import ro.fortsoft.pf4j.PluginWrapper; //导入依赖的package包/类
default Optional<PluginWrapper> getProvider() {
return Optional.empty();
}
示例13: Plugin
import ro.fortsoft.pf4j.PluginWrapper; //导入依赖的package包/类
public Plugin(PluginWrapper wrapper) {
super(wrapper);
instance = this;
groovyConsole = new GroovyConsole();
}
示例14: Plugin
import ro.fortsoft.pf4j.PluginWrapper; //导入依赖的package包/类
public Plugin(PluginWrapper wrapper) {
super(wrapper);
IRuntimeManager runtimeManager = GitblitContext.getManager(IRuntimeManager.class);
Slacker.init(runtimeManager);
}
示例15: Plugin
import ro.fortsoft.pf4j.PluginWrapper; //导入依赖的package包/类
public Plugin(PluginWrapper wrapper) {
super(wrapper);
}