Reputation: 5335
How to add PackageExplorerView's all toolbars and functionalities to eclipse RCP applications? I used PackageExplorer view id to show the PackageExplorer view. It is showing the view in the rcp application. But after creating the project in the PackageExplorer view, it is not showing the project icons for the prjects created. How to ressolve this issue?
Upvotes: 2
Views: 1758
Reputation: 960
This is a known issue in Eclipse RCP applications.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=234252
The work around is to add some code to your ApplicationWorkbenchAdvisor.java
Here's some more documentation about this issue in RCP
http://help.eclipse.org/ganymede/topic/org.eclipse.platform.doc.isv/guide/cnf_rcp.htm
I've add this code to my initialize method in order to get the images to show up in the Project Explorer, so you'll need to track down the correct images to add for the Package Explorer if those images are different from these.
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);
}
Hope this helps.
Thanks!
Upvotes: 5