summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorDean Roberts2011-10-20 09:25:57 (EDT)
committer Remy Suen2011-10-20 09:25:57 (EDT)
commitf16d6c4775e91caa31b7a6a3b4f9453ab960a9d0 (patch)
tree0ccdbec580ae9902897153bebe9f6fd51d295e04
parentba20d05731c7e31d4909888f4885a0a351dd090a (diff)
downloadeclipse.platform.ui-f16d6c4775e91caa31b7a6a3b4f9453ab960a9d0.zip
eclipse.platform.ui-f16d6c4775e91caa31b7a6a3b4f9453ab960a9d0.tar.gz
eclipse.platform.ui-f16d6c4775e91caa31b7a6a3b4f9453ab960a9d0.tar.bz2
Bug 355497 [Compatibility] Activities/Capabilities in Eclipse4
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/e4/ui/workbench/addons/perspectiveswitcher/PerspectiveSwitcher.java10
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PerspectiveRegistry.java7
2 files changed, 15 insertions, 2 deletions
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/e4/ui/workbench/addons/perspectiveswitcher/PerspectiveSwitcher.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/e4/ui/workbench/addons/perspectiveswitcher/PerspectiveSwitcher.java
index 5a97d8d..a90990f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/e4/ui/workbench/addons/perspectiveswitcher/PerspectiveSwitcher.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/e4/ui/workbench/addons/perspectiveswitcher/PerspectiveSwitcher.java
@@ -62,6 +62,7 @@ import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.ToolItem;
import org.eclipse.ui.IPerspectiveDescriptor;
+import org.eclipse.ui.IPerspectiveRegistry;
import org.eclipse.ui.IWorkbenchCommandConstants;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPreferenceConstants;
@@ -75,6 +76,7 @@ import org.eclipse.ui.internal.WorkbenchImages;
import org.eclipse.ui.internal.WorkbenchMessages;
import org.eclipse.ui.internal.WorkbenchPage;
import org.eclipse.ui.internal.e4.compatibility.E4Util;
+import org.eclipse.ui.internal.registry.PerspectiveRegistry;
import org.eclipse.ui.internal.util.PrefUtil;
import org.eclipse.ui.statushandlers.StatusManager;
import org.osgi.service.event.Event;
@@ -429,7 +431,13 @@ public class PerspectiveSwitcher {
// FIXME see https://bugs.eclipse.org/bugs/show_bug.cgi?id=313771
private IPerspectiveDescriptor getDescriptorFor(String id) {
- return PlatformUI.getWorkbench().getPerspectiveRegistry().findPerspectiveWithId(id);
+ IPerspectiveRegistry perspectiveRegistry = PlatformUI.getWorkbench()
+ .getPerspectiveRegistry();
+ if (perspectiveRegistry instanceof PerspectiveRegistry) {
+ return ((PerspectiveRegistry) perspectiveRegistry).findPerspectiveWithId(id, false);
+ }
+
+ return perspectiveRegistry.findPerspectiveWithId(id);
}
private void selectPerspective() {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PerspectiveRegistry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PerspectiveRegistry.java
index 3047649..3fc7152 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PerspectiveRegistry.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PerspectiveRegistry.java
@@ -153,8 +153,13 @@ public class PerspectiveRegistry implements IPerspectiveRegistry, IExtensionChan
* )
*/
public IPerspectiveDescriptor findPerspectiveWithId(String perspectiveId) {
+ return findPerspectiveWithId(perspectiveId, true);
+ }
+
+ public IPerspectiveDescriptor findPerspectiveWithId(String perspectiveId,
+ boolean considerRestrictRules) {
IPerspectiveDescriptor candidate = descriptors.get(perspectiveId);
- if (WorkbenchActivityHelper.restrictUseOf(candidate)) {
+ if (considerRestrictRules && WorkbenchActivityHelper.restrictUseOf(candidate)) {
return null;
}
return candidate;