use*_*967 2 eclipse-plugin eclipse-rcp
如何添加PackageExplorerView的所有工具栏和功能来使RCP应用程序黯淡?我使用PackageExplorer视图ID来显示PackageExplorer视图。它显示了rcp应用程序中的视图。但是,在PackageExplorer视图中创建项目后,它没有显示所创建项目的项目图标。如何解决这个问题?
这是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
我已将此代码添加到我的initialize方法中,以使图像显示在Project Explorer中,因此,如果这些图像与这些图像不同,则需要跟踪正确的图像以添加到Package 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);
}
Run Code Online (Sandbox Code Playgroud)
希望这可以帮助。
谢谢!
| 归档时间: |
|
| 查看次数: |
1569 次 |
| 最近记录: |