Fixed bug 368354: Copy/Paste fails intermittently
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java
index dd01c7a..cf334b0 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2014 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
@@ -3137,6 +3137,7 @@
 					public void run() {
 						// check whether editor has not been disposed yet
 						if (fSourceViewer != null && fSourceViewer.getDocument() != null) {
+							handleCursorPositionChanged();
 							updateSelectionDependentActions();
 						}
 					}
@@ -3147,8 +3148,10 @@
 				public void selectionChanged(SelectionChangedEvent event) {
 					if (fDisplay == null)
 						fDisplay= getSite().getShell().getDisplay();
-					fDisplay.asyncExec(fRunnable);
-					handleCursorPositionChanged();
+					if (Display.getCurrent() == fDisplay)
+						fRunnable.run();
+					else
+						fDisplay.asyncExec(fRunnable);
 				}
 			};
 		}