Bug 317250 [Compatibility] second Java perspective in perspective switcher
bundles/org.eclipse.e4.ui.workbench.addons.swt/src/org/eclipse/e4/ui/workbench/addons/perspectiveswitcher/PerspectiveSwitcher.java
}
		});
		new ToolItem(psTB, SWT.SEPARATOR);
		MPerspectiveStack stack = getPerspectiveStack();
		if (stack != null) {
			
			for (MPerspective persp : stack.getChildren()) {
				if (persp.isToBeRendered()) {
					addPerspectiveItem(persp);
				}
			}
		}
	}
	MPerspectiveStack getPerspectiveStack() {
		List<MPerspectiveStack> psList = modelService.findElements(window, null,
				MPerspectiveStack.class, null);
		if (psList.size() > 0)
			return psList.get(0);
		return null;
	}
	@PreDestroy
	void removeListeners() {
		eventBroker.unsubscribe(toBeRenderedHandler);
		eventBroker.unsubscribe(childrenHandler);
		eventBroker.unsubscribe(selectionHandler);
	}
	private ToolItem addPerspectiveItem(MPerspective persp) {
		final ToolItem psItem = new ToolItem(psTB, SWT.RADIO);
		psItem.setData(persp);
		IPerspectiveDescriptor descriptor = getDescriptorFor(persp.getElementId());