View | Details | Raw Unified | Return to bug 32666
Collapse All | Expand All

(-)WorkbenchPage.java (-19 / +29 lines)
Lines 445-451 Link Here
445
			return;
445
			return;
446
446
447
		// If zoomed, unzoom.
447
		// If zoomed, unzoom.
448
		if (isZoomed() && partChangeAffectsZoom(getReference(part)))
448
		if (isZoomed() && partChangeAffectsZoom(getContainerReference(part)))
449
			zoomOut();
449
			zoomOut();
450
450
451
		if (part instanceof MultiEditor) {
451
		if (part instanceof MultiEditor) {
Lines 580-586 Link Here
580
			return;
580
			return;
581
581
582
		// If zoomed then ignore.
582
		// If zoomed then ignore.
583
		if (isZoomed() && partChangeAffectsZoom(getReference(part)))
583
		if (isZoomed() && partChangeAffectsZoom(getContainerReference(part)))
584
			return;
584
			return;
585
585
586
		String label = part != null ? part.getTitle() : "none"; //$NON-NLS-1$
586
		String label = part != null ? part.getTitle() : "none"; //$NON-NLS-1$
Lines 589-595 Link Here
589
			UIStats.start(UIStats.BRING_PART_TO_TOP, label);
589
			UIStats.start(UIStats.BRING_PART_TO_TOP, label);
590
			// Move part.
590
			// Move part.
591
			if (part instanceof IEditorPart) {
591
			if (part instanceof IEditorPart) {
592
				IEditorReference ref = (IEditorReference) getReference(part);
592
				IEditorReference ref = (IEditorReference) getContainerReference(part);
593
				broughtToTop = getEditorManager().setVisibleEditor(ref, false);
593
				broughtToTop = getEditorManager().setVisibleEditor(ref, false);
594
				actionSwitcher.updateTopEditor((IEditorPart) part);
594
				actionSwitcher.updateTopEditor((IEditorPart) part);
595
				if (broughtToTop) {
595
				if (broughtToTop) {
Lines 823-829 Link Here
823
			return false;
823
			return false;
824
824
825
		if (part instanceof IEditorPart) {
825
		if (part instanceof IEditorPart) {
826
			IEditorReference ref = (IEditorReference) getReference(part);
826
			IEditorReference ref = (IEditorReference) getContainerReference(part);
827
			return getEditorManager().containsEditor(ref);
827
			return getEditorManager().containsEditor(ref);
828
		}
828
		}
829
		if (part instanceof IViewPart) {
829
		if (part instanceof IViewPart) {
Lines 975-981 Link Here
975
			return false;
975
			return false;
976
976
977
		boolean partWasVisible = (editor == getActiveEditor());
977
		boolean partWasVisible = (editor == getActiveEditor());
978
		IEditorReference ref = (IEditorReference) getReference(editor);
978
		IEditorReference ref = (IEditorReference) getContainerReference(editor);
979
		activationList.remove(ref);
979
		activationList.remove(ref);
980
		boolean partWasActive = (editor == activePart);
980
		boolean partWasActive = (editor == activePart);
981
981
Lines 2715-2721 Link Here
2715
				if (newPart instanceof IEditorPart) {
2715
				if (newPart instanceof IEditorPart) {
2716
					lastActiveEditor = (IEditorPart) newPart;
2716
					lastActiveEditor = (IEditorPart) newPart;
2717
					IEditorReference ref =
2717
					IEditorReference ref =
2718
						(IEditorReference) getReference(lastActiveEditor);
2718
						(IEditorReference) getContainerReference(lastActiveEditor);
2719
					editorMgr.setVisibleEditor(ref, true);
2719
					editorMgr.setVisibleEditor(ref, true);
2720
				}
2720
				}
2721
			}
2721
			}
Lines 3255-3261 Link Here
3255
		return activationList.getParts();
3255
		return activationList.getParts();
3256
	}
3256
	}
3257
3257
3258
	public IWorkbenchPartReference getReference(IWorkbenchPart part) {
3258
	/**
3259
	 * This method behaves the same as {@link #getReference(IWorkbenchPart)}
3260
	 * except that the inner editors for a MultiEditor will return an
3261
	 * {@link IWorkbenchPartReference}to their outer editor.
3262
	 */
3263
	public IWorkbenchPartReference getContainerReference(IWorkbenchPart part) {
3259
		if (part == null)
3264
		if (part == null)
3260
			return null;
3265
			return null;
3261
		PartPane pane = ((PartSite) part.getSite()).getPane();
3266
		PartPane pane = ((PartSite) part.getSite()).getPane();
Lines 3263-3268 Link Here
3263
			MultiEditorInnerPane innerPane = (MultiEditorInnerPane) pane;
3268
			MultiEditorInnerPane innerPane = (MultiEditorInnerPane) pane;
3264
			return innerPane.getParentPane().getPartReference();
3269
			return innerPane.getParentPane().getPartReference();
3265
		}
3270
		}
3271
		return getReference(part, pane);
3272
	}
3273
	
3274
	public IWorkbenchPartReference getReference(IWorkbenchPart part) {
3275
		if (part == null)
3276
			return null;
3277
		PartPane pane = ((PartSite) part.getSite()).getPane();
3278
		return getReference(part, pane);
3279
	}
3280
3281
	private IWorkbenchPartReference getReference(IWorkbenchPart part, PartPane pane) {
3266
		if (pane == null) {
3282
		if (pane == null) {
3267
			/*
3283
			/*
3268
			 * An error has occurred while creating the view.
3284
			 * An error has occurred while creating the view.
Lines 3288-3304 Link Here
3288
			if (parts.size() <= 0)
3304
			if (parts.size() <= 0)
3289
				return;
3305
				return;
3290
			PartPane pane = ((PartSite) part.getSite()).getPane();
3306
			PartPane pane = ((PartSite) part.getSite()).getPane();
3291
			if (pane instanceof MultiEditorInnerPane) {
3307
			IWorkbenchPartReference ref = getContainerReference(part);
3292
				MultiEditorInnerPane innerPane = (MultiEditorInnerPane) pane;
3308
			if (ref == parts.get(parts.size() - 1))
3293
				setActive(
3309
				return;
3294
					innerPane.getParentPane().getPartReference().getPart(true));
3310
			parts.remove(ref);
3295
			} else {
3311
			parts.add(ref);
3296
				IWorkbenchPartReference ref = getReference(part);
3297
				if (ref == parts.get(parts.size() - 1))
3298
					return;
3299
				parts.remove(ref);
3300
				parts.add(ref);
3301
			}
3302
			pane.addPropertyChangeListener(propertyChangeListener);
3312
			pane.addPropertyChangeListener(propertyChangeListener);
3303
		}
3313
		}
3304
		/*
3314
		/*
Lines 3390-3396 Link Here
3390
		 * the index, the more recent it was used.
3400
		 * the index, the more recent it was used.
3391
		 */
3401
		 */
3392
		int indexOf(IWorkbenchPart part) {
3402
		int indexOf(IWorkbenchPart part) {
3393
			return parts.indexOf(getReference(part));
3403
			return parts.indexOf(getContainerReference(part));
3394
		}
3404
		}
3395
		/*
3405
		/*
3396
		 * Returns the index of the part reference within the activation list.  
3406
		 * Returns the index of the part reference within the activation list.  

Return to bug 32666