2323import org .eclipse .jface .resource .ImageDescriptor ;
2424import org .eclipse .ui .IWorkbenchWindow ;
2525import org .eclipse .ui .PlatformUI ;
26+ import org .eclipse .ui .activities .IActivityManager ;
27+ import org .eclipse .ui .activities .IIdentifier ;
2628import org .eclipse .ui .activities .WorkbenchActivityHelper ;
2729import org .eclipse .ui .internal .IWorkbenchGraphicConstants ;
2830import org .eclipse .ui .internal .WorkbenchImages ;
3941 */
4042public class ViewProvider extends QuickAccessProvider {
4143
44+ /**
45+ * URI of any view on the platform has this prefix. ex:
46+ * bundleclass://org.eclipse.pde.spy.bundle/org.eclipse.pde.spy.bundle.BundleSpyPart
47+ */
48+ private static final String BUNDLE_CLASS_SCHEME = "bundleclass://" ; //$NON-NLS-1$
4249 private MApplication application ;
4350 private MWindow window ;
4451 private Map <String , QuickAccessElement > idToElement = new HashMap <>();
@@ -69,6 +76,7 @@ public QuickAccessElement[] getElements() {
6976 }
7077
7178 if (idToElement .isEmpty ()) {
79+ IActivityManager activityManager = PlatformUI .getWorkbench ().getActivitySupport ().getActivityManager ();
7280 for (MPartDescriptor descriptor : application .getDescriptors ()) {
7381 String uri = descriptor .getContributionURI ();
7482 if (uri != null ) {
@@ -85,7 +93,15 @@ public QuickAccessElement[] getElements() {
8593 idToElement .put (element .getId (), element );
8694 }
8795 } else {
88- idToElement .put (id , element );
96+ if (uri .startsWith (BUNDLE_CLASS_SCHEME )) {
97+ String viewQualUri = uri .substring (BUNDLE_CLASS_SCHEME .length ());
98+ IIdentifier identifier = activityManager .getIdentifier (viewQualUri );
99+ if (identifier .isEnabled ()) {
100+ idToElement .put (element .getId (), element );
101+ }
102+ } else {
103+ idToElement .put (element .getId (), element );
104+ }
89105 }
90106 }
91107 }
0 commit comments