From c1e6dc4ca15200379de8e516335fd75d5cb99d03 Mon Sep 17 00:00:00 2001
From: Sergey Prigogin
Date: Sun, 20 Jan 2013 20:51:40 -0800
Subject: Bug 398611 - Set input for the Outline page conditionally to avoid
unnecessary updates.
---
.../src/org/eclipse/cdt/internal/ui/editor/CEditor.java | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
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.
--
cgit v1.2.3