Eclipse rcp 导出rcp插件时输出文件夹
在我的rcp插件中,我希望在导出插件时创建文件夹,比如导出文件夹中的图像。例如,我导出的文件夹现在有配置、p2、插件和工作区文件夹。我想要一个默认文件夹来存储图像,并且可以从插件内部进行判断。您可能在这方面做得有点不正确;您可以将图像打包到插件中,然后通过代码轻松访问它们。只需在插件项目中创建图像文件夹,然后在plugin.xml编辑器的构建配置页面的“二进制构建”窗格中选择该文件夹 然后,您可以通过缓存管理图像,如下所示:Eclipse rcp 导出rcp插件时输出文件夹,eclipse-rcp,Eclipse Rcp,在我的rcp插件中,我希望在导出插件时创建文件夹,比如导出文件夹中的图像。例如,我导出的文件夹现在有配置、p2、插件和工作区文件夹。我想要一个默认文件夹来存储图像,并且可以从插件内部进行判断。您可能在这方面做得有点不正确;您可以将图像打包到插件中,然后通过代码轻松访问它们。只需在插件项目中创建图像文件夹,然后在plugin.xml编辑器的构建配置页面的“二进制构建”窗格中选择该文件夹 然后,您可以通过缓存管理图像,如下所示: public class ImageCache { priv
public class ImageCache
{
private static ImageCache s_instance = new ImageCache();
private ImageRegistry m_imageRegistry = Activator.getDefault().getImageRegistry();
public static enum AppImage
{
EXAMPLE("images/example.gif")
;
public String location;
private AppImage(String location)
{
this.location = location;
}
}
private ImageCache()
{
for(AppImage image : AppImage.values())
{
imageRegistry.put(image.name(),Activator.getImageDescriptor(image.location));
}
}
public static ImageCache instance()
{
return s_instance;
}
public final static Image get(AppImage key)
{
return instance().m_imageRegistry.get(key.name());
}
public final static ImageDescriptor getDescriptor(AppImage key)
{
return instance().m_imageRegistry.getDescriptor(key.name());
}
}
其中example.gif位于插件项目根目录下的images文件夹中
另见:
并且:导出后我可以添加更多照片吗?好的-那么您想要管理一组改变后期生成的图像?比如在照片管理应用程序中?在这种情况下,您可能希望使用eclipse工作区,您可以按如下方式获取其位置:
File rootDir=new File(Platform.getInstanceLocation().getURL().getFile())代码>,并且可以从产品的启动配置中配置其位置。