Bug 333081 Elements in the shared area gets displayed when switching to a perspective that shouldn't show the area
After the perspective dialog is closed, it seems that the system tries to grant activation to the active part again before the switch actually happens. We enqueue such a request and then perform the perspective switch. When the switch is complete, we process the original activation request and since the element is found in the active perspective, we try to activate it. We should instead also check whether the element or its parents should be rendered in the current perspective before we make such an activation request.
bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/StackRenderer.java
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Widget;
import org.osgi.service.event.Event;
import org.osgi.service.event.EventHandler;
public class StackRenderer extends LazyStackRenderer {
	public static final String TAG_VIEW_MENU = "ViewMenu"; 
	private static final String SHELL_CLOSE_EDITORS_MENU = "shell_close_editors_menu"; 
	private static final String STACK_SELECTED_PART = "stack_selected_part"; 
	Image viewMenuImage;
	@Inject
	IStylingEngine stylingEngine;
	@Inject
	IEventBroker eventBroker;
	@Inject
	IPresentationEngine renderer;
	private EventHandler itemUpdater;
	private EventHandler dirtyUpdater;
	private boolean ignoreTabSelChanges = false;
	private class ActivationJob implements Runnable {