Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 306952
Collapse All | Expand All

(-)Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java (+55 lines)
Lines 1704-1709 Link Here
1704
			return (IEditorPart) activePart;
1704
			return (IEditorPart) activePart;
1705
		}
1705
		}
1706
1706
1707
		if (!activationList.isEmpty()) {
1708
			IEditorPart editor = findActiveEditor();
1709
			if (editor != null) {
1710
				return editor;
1711
			}
1712
		}
1713
1714
		MUIElement area = findSharedArea();
1715
		if (area instanceof MPlaceholder) {
1716
			area = ((MPlaceholder) area).getRef();
1717
		}
1718
		if (area != null && area.isVisible() && area.isToBeRendered()) {
1719
			// we have a shared area, try iterating over its editors first
1720
			List<MPart> editors = modelService.findElements(area,
1721
					CompatibilityEditor.MODEL_ELEMENT_ID, MPart.class, null);
1722
			for (MPart model : editors) {
1723
				Object object = model.getObject();
1724
				if (object instanceof CompatibilityEditor) {
1725
					CompatibilityEditor editor = (CompatibilityEditor) object;
1726
					// see bug 308492
1727
					if (!editor.isBeingDisposed() && isInArea(area, model)) {
1728
						return ((CompatibilityEditor) object).getEditor();
1729
					}
1730
				}
1731
			}
1732
		}
1733
1734
		MPerspective perspective = getPerspectiveStack().getSelectedElement();
1735
		List<MPart> parts = modelService.findElements(perspective,
1736
				CompatibilityEditor.MODEL_ELEMENT_ID, MPart.class, null);
1737
		for (MPart part : parts) {
1738
			Object object = part.getObject();
1739
			if (object instanceof CompatibilityEditor) {
1740
				CompatibilityEditor editor = (CompatibilityEditor) object;
1741
				// see bug 308492
1742
				if (!editor.isBeingDisposed()) {
1743
					if (isValid(perspective, part) || isValid(window, part)) {
1744
						return ((CompatibilityEditor) object).getEditor();
1745
					}
1746
				}
1747
			}
1748
		}
1749
		return null;
1750
	}
1751
1752
	/**
1753
	 * Searches and returns an editor from the activation list that is being
1754
	 * displayed in the current presentation. If an editor is in the
1755
	 * presentation but is behind another part it will not be returned.
1756
	 * 
1757
	 * @return an editor that is being shown in the current presentation and was
1758
	 *         previously activated, editors that are behind another part in a
1759
	 *         stack will not be returned
1760
	 */
1761
	private IEditorPart findActiveEditor() {
1707
		List<MPart> candidates = new ArrayList<MPart>(activationList);
1762
		List<MPart> candidates = new ArrayList<MPart>(activationList);
1708
		MUIElement area = findSharedArea();
1763
		MUIElement area = findSharedArea();
1709
		if (area instanceof MPlaceholder) {
1764
		if (area instanceof MPlaceholder) {

Return to bug 306952