diff options
| author | Dean Roberts | 2011-10-20 13:00:04 +0000 |
|---|---|---|
| committer | Remy Suen | 2011-10-20 13:00:04 +0000 |
| commit | ba20d05731c7e31d4909888f4885a0a351dd090a (patch) | |
| tree | 82cd7f4e5c3d09980daa90f2b4dbf91356d8c961 | |
| parent | f7cf9b25d251cd8f247a9c3ad384d4fdcb548f66 (diff) | |
| download | eclipse.platform.ui-ba20d05731c7e31d4909888f4885a0a351dd090a.tar.gz eclipse.platform.ui-ba20d05731c7e31d4909888f4885a0a351dd090a.tar.xz eclipse.platform.ui-ba20d05731c7e31d4909888f4885a0a351dd090a.zip | |
Bug 355497 [Compatibility] Activities/Capabilities in Eclipse4
3 files changed, 24 insertions, 7 deletions
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/ViewProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/ViewProvider.java index b18747b6c46..e43ab759846 100644 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/ViewProvider.java +++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/ViewProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2010 IBM Corporation and others. + * Copyright (c) 2006, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -72,7 +72,10 @@ public class ViewProvider extends QuickAccessProvider { if (id != null) { ViewElement element = new ViewElement(this, window, descriptors.get(i)); IViewDescriptor viewDescriptor = viewRegistry.find(element.getId()); - // filterItem() can accept a null argument + // Ignore if restricted + if (viewDescriptor == null) + continue; + // Ignore if filtered if (!WorkbenchActivityHelper.filterItem(viewDescriptor)) { idToElement.put(element.getId(), element); } diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ViewCategory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ViewCategory.java index ad66d12bbf1..fae86e08f14 100644 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ViewCategory.java +++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ViewCategory.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. + * Copyright (c) 2010, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -12,9 +12,11 @@ package org.eclipse.ui.internal.registry; import java.util.ArrayList; +import java.util.Collection; import java.util.List; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; +import org.eclipse.ui.activities.WorkbenchActivityHelper; import org.eclipse.ui.views.IViewCategory; import org.eclipse.ui.views.IViewDescriptor; @@ -36,7 +38,9 @@ public class ViewCategory implements IViewCategory { } public IViewDescriptor[] getViews() { - return descriptors.toArray(new IViewDescriptor[descriptors.size()]); + Collection<?> allowedViews = WorkbenchActivityHelper.restrictCollection(descriptors, + new ArrayList<Object>()); + return allowedViews.toArray(new IViewDescriptor[allowedViews.size()]); } public String getId() { diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ViewRegistry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ViewRegistry.java index 4bc347529b8..8dd02c65ac4 100644 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ViewRegistry.java +++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ViewRegistry.java @@ -12,6 +12,7 @@ package org.eclipse.ui.internal.registry; import java.util.ArrayList; +import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -26,6 +27,7 @@ import org.eclipse.e4.ui.model.application.MApplication; import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptor; import org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicFactoryImpl; import org.eclipse.ui.IPageLayout; +import org.eclipse.ui.activities.WorkbenchActivityHelper; import org.eclipse.ui.internal.WorkbenchMessages; import org.eclipse.ui.internal.WorkbenchPlugin; import org.eclipse.ui.internal.e4.compatibility.CompatibilityPart; @@ -133,7 +135,11 @@ public class ViewRegistry implements IViewRegistry { } public IViewDescriptor find(String id) { - return descriptors.get(id); + IViewDescriptor candidate = descriptors.get(id); + if (WorkbenchActivityHelper.restrictUseOf(candidate)) { + return null; + } + return candidate; } /* @@ -151,7 +157,9 @@ public class ViewRegistry implements IViewRegistry { * @see org.eclipse.ui.views.IViewRegistry#getViews() */ public IViewDescriptor[] getViews() { - return descriptors.values().toArray(new IViewDescriptor[descriptors.size()]); + Collection<?> allowedViews = WorkbenchActivityHelper.restrictCollection( + descriptors.values(), new ArrayList<Object>()); + return allowedViews.toArray(new IViewDescriptor[allowedViews.size()]); } /* @@ -160,7 +168,9 @@ public class ViewRegistry implements IViewRegistry { * @see org.eclipse.ui.views.IViewRegistry#getStickyViews() */ public IStickyViewDescriptor[] getStickyViews() { - return stickyDescriptors.toArray(new IStickyViewDescriptor[stickyDescriptors.size()]); + Collection<?> allowedViews = WorkbenchActivityHelper.restrictCollection(stickyDescriptors, + new ArrayList<Object>()); + return allowedViews.toArray(new IStickyViewDescriptor[allowedViews.size()]); } /** |
