当前位置: 首页>>代码示例>>Java>>正文


Java PluginWrapper类代码示例

本文整理汇总了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();
}
 
开发者ID:czp3009,项目名称:danmuji,代码行数:23,代码来源:PluginListDialog.java

示例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());
}
 
开发者ID:HuajiStudio,项目名称:ChessMaster,代码行数:9,代码来源:RenderEngineSelector.java

示例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()));
}
 
开发者ID:HuajiStudio,项目名称:ChessMaster,代码行数:9,代码来源:ResourceHelper.java

示例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 "";
	}
}
 
开发者ID:HuajiStudio,项目名称:ChessMaster,代码行数:12,代码来源:I18n.java

示例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();
                }
            });
}
 
开发者ID:intellimate,项目名称:Izou,代码行数:20,代码来源:PermissionModule.java

示例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;
}
 
开发者ID:HuajiStudio,项目名称:ChessMaster,代码行数:61,代码来源:OpenGLUtils.java

示例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()));
}
 
开发者ID:HuajiStudio,项目名称:ChessMaster,代码行数:6,代码来源:LanguageManager.java

示例8: Main

import ro.fortsoft.pf4j.PluginWrapper; //导入依赖的package包/类
public Main(PluginWrapper pluginWrapper) {
    super(pluginWrapper);
    pluginId = pluginWrapper.getPluginId();
    log = super.log;
}
 
开发者ID:czp3009,项目名称:danmuji,代码行数:6,代码来源:Main.java

示例9: Main

import ro.fortsoft.pf4j.PluginWrapper; //导入依赖的package包/类
public Main(PluginWrapper pluginWrapper) {
    super(pluginWrapper);
    pluginId = pluginWrapper.getPluginId();
}
 
开发者ID:czp3009,项目名称:danmuji,代码行数:5,代码来源:Main.java

示例10: Plugin1

import ro.fortsoft.pf4j.PluginWrapper; //导入依赖的package包/类
public Plugin1(PluginWrapper wrapper) {
    super(wrapper);
}
 
开发者ID:DTeam-Top,项目名称:dfx,代码行数:4,代码来源:Plugin1.java

示例11: Plugin2

import ro.fortsoft.pf4j.PluginWrapper; //导入依赖的package包/类
public Plugin2(PluginWrapper wrapper) {
    super(wrapper);
}
 
开发者ID:DTeam-Top,项目名称:dfx,代码行数:4,代码来源:Plugin2.java

示例12: getProvider

import ro.fortsoft.pf4j.PluginWrapper; //导入依赖的package包/类
default Optional<PluginWrapper> getProvider() {
	return Optional.empty();
}
 
开发者ID:UnknownStudio,项目名称:UIDE-API,代码行数:4,代码来源:Registry.java

示例13: Plugin

import ro.fortsoft.pf4j.PluginWrapper; //导入依赖的package包/类
public Plugin(PluginWrapper wrapper) {
    super(wrapper);
    instance = this;
    groovyConsole = new GroovyConsole();
}
 
开发者ID:lovromazgon,项目名称:gitblit-groovy-console-plugin,代码行数:6,代码来源:Plugin.java

示例14: Plugin

import ro.fortsoft.pf4j.PluginWrapper; //导入依赖的package包/类
public Plugin(PluginWrapper wrapper) {
	super(wrapper);

	IRuntimeManager runtimeManager = GitblitContext.getManager(IRuntimeManager.class);
	Slacker.init(runtimeManager);
}
 
开发者ID:gitblit,项目名称:gitblit-slack-plugin,代码行数:7,代码来源:Plugin.java

示例15: Plugin

import ro.fortsoft.pf4j.PluginWrapper; //导入依赖的package包/类
public Plugin(PluginWrapper wrapper) {
	super(wrapper);
}
 
开发者ID:gitblit,项目名称:gitblit-smartticketbranches-plugin,代码行数:4,代码来源:Plugin.java


注:本文中的ro.fortsoft.pf4j.PluginWrapper类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。