Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.activities.IActivityManager;
import org.eclipse.ui.activities.IIdentifier;
import org.eclipse.ui.activities.WorkbenchActivityHelper;
import org.eclipse.ui.internal.IWorkbenchGraphicConstants;
import org.eclipse.ui.internal.WorkbenchImages;
Expand All @@ -39,6 +41,11 @@
*/
public class ViewProvider extends QuickAccessProvider {

/**
* URI of any view on the platform has this prefix. ex:
* bundleclass://org.eclipse.pde.spy.bundle/org.eclipse.pde.spy.bundle.BundleSpyPart
*/
private static final String BUNDLE_CLASS_SCHEME = "bundleclass://"; //$NON-NLS-1$
private MApplication application;
private MWindow window;
private Map<String, QuickAccessElement> idToElement = new HashMap<>();
Expand Down Expand Up @@ -69,6 +76,7 @@ public QuickAccessElement[] getElements() {
}

if (idToElement.isEmpty()) {
IActivityManager activityManager = PlatformUI.getWorkbench().getActivitySupport().getActivityManager();
for (MPartDescriptor descriptor : application.getDescriptors()) {
String uri = descriptor.getContributionURI();
if (uri != null) {
Expand All @@ -85,7 +93,15 @@ public QuickAccessElement[] getElements() {
idToElement.put(element.getId(), element);
}
} else {
idToElement.put(id, element);
if (uri.startsWith(BUNDLE_CLASS_SCHEME)) {
String viewQualUri = uri.substring(BUNDLE_CLASS_SCHEME.length());
IIdentifier identifier = activityManager.getIdentifier(viewQualUri);
if (identifier.isEnabled()) {
idToElement.put(element.getId(), element);
}
} else {
idToElement.put(element.getId(), element);
}
}
}
}
Expand Down
Loading