gpt4 book ai didi

eclipse-plugin - 向 RCP 显示项目浏览器 View 及其功能

转载 作者:行者123 更新时间:2023-12-02 22:43:47 26 4
gpt4 key购买 nike

如何将 PackageExplorerView 的所有工具栏和功能添加到 eclipse RCP 应用程序中?我使用 PackageExplorer View ID 来显示 PackageExplorer View 。它显示了 rcp 应用程序中的 View 。但是在 PackageExplorer View 中创建项目后,它不显示创建的项目的项目图标。如何解决这个问题?

最佳答案

这是 Eclipse RCP 应用程序中的一个已知问题。

https://bugs.eclipse.org/bugs/show_bug.cgi?id=234252

解决方法是向您的 ApplicationWorkbenchAdvisor.java 添加一些代码

这里有一些关于 RCP 中这个问题的更多文档

http://help.eclipse.org/ganymede/topic/org.eclipse.platform.doc.isv/guide/cnf_rcp.htm

我已将这段代码添加到我的初始化方法中,以便让图像显示在 Project Explorer 中,因此如果这些图像不同于这些。

  public void initialize(IWorkbenchConfigurer configurer) {
super.initialize(configurer);

// here's some of my code that does some typical RCP type configuration
configurer.setSaveAndRestore(true);
PlatformUI.getPreferenceStore().setValue(
IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS, false);

// here is the work around code
/*
* This is a hack to get Project tree icons to show up in the Project Explorer.
* It is descriped in the Eclipse Help Documents here.
*
* http://help.eclipse.org/ganymede/topic/org.eclipse.platform.doc.isv/guide/cnf_rcp.htm
*
*/

IDE.registerAdapters();

final String ICONS_PATH = "icons/full/";

Bundle ideBundle = Platform.getBundle(IDEWorkbenchPlugin.IDE_WORKBENCH);

declareWorkbenchImage(
configurer,
ideBundle,
IDE.SharedImages.IMG_OBJ_PROJECT,
ICONS_PATH + "obj16/prj_obj.gif",
true);

declareWorkbenchImage(
configurer,
ideBundle,
IDE.SharedImages.IMG_OBJ_PROJECT_CLOSED,
ICONS_PATH + "obj16/cprj_obj.gif",
true);


/*
* End of hack in this method...
*/
}

private void declareWorkbenchImage(IWorkbenchConfigurer configurer_p, Bundle ideBundle, String symbolicName, String path, boolean shared)
{
URL url = ideBundle.getEntry(path);
ImageDescriptor desc = ImageDescriptor.createFromURL(url);
configurer_p.declareImage(symbolicName, desc, shared);
}

希望这对您有所帮助。

谢谢!

关于eclipse-plugin - 向 RCP 显示项目浏览器 View 及其功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10345977/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com