Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 5a97d8d8bac..a90990ff900 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 304764912dc..3fc7152220e 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;

Back to the top