diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java index 2d4c743da09..070355e1c15 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2012 IBM Corporation and others. + * Copyright (c) 2005, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -1637,7 +1637,7 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi fOutlinePage = new CContentOutlinePage(this); fOutlinePage.addSelectionChangedListener(this); } - setOutlinePageInput(fOutlinePage, getEditorInput()); + setOutlinePageInputIfNotSame(fOutlinePage, getEditorInput()); return fOutlinePage; } @@ -2567,6 +2567,16 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi } } + private static void setOutlinePageInputIfNotSame(CContentOutlinePage page, IEditorInput input) { + if (page != null) { + IWorkingCopyManager manager = CUIPlugin.getDefault().getWorkingCopyManager(); + IWorkingCopy workingCopy = manager.getWorkingCopy(input); + if (workingCopy != page.getRoot()) { + page.setInput(workingCopy); + } + } + } + /** * Determines if folding is enabled. * @return true if folding is enabled, false otherwise.