Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Loskutov2019-05-02 10:06:01 -0400
committerAndrey Loskutov2019-05-02 10:06:01 -0400
commit1ae1f3baeaf8cdb3570b9c23665176335cce0014 (patch)
tree7607754eab707974c02348acfae1d77ac6088429
parentead7de4749a856cec4c830d7bd331961cc5dad27 (diff)
downloadeclipse.platform.text-I20190507-0155.tar.gz
eclipse.platform.text-I20190507-0155.tar.xz
eclipse.platform.text-I20190507-0155.zip
refresh unconditionally An attempt to call refreshFile() while workspace is locked results in a blocking progress dialog. This is not needed if the file is not out-of-sync, which can be tested via *non-blocking* file.isSynchronized() API. This patch does exact that. Change-Id: Ia1b0b7ba250f92e49bbe4343ba542a5d5c4e752b Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/FileDocumentProvider.java13
1 files changed, 9 insertions, 4 deletions
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/FileDocumentProvider.java b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/FileDocumentProvider.java
index a61d06169..be9d6f94a 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/FileDocumentProvider.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/FileDocumentProvider.java
@@ -673,10 +673,15 @@ public class FileDocumentProvider extends StorageDocumentProvider {
IFileEditorInput input= (IFileEditorInput) element;
- try {
- refreshFile(input.getFile());
- } catch (CoreException x) {
- handleCoreException(x, TextEditorMessages.FileDocumentProvider_createElementInfo);
+ // Note that file.isSynchronized does not require a scheduling rule and thus helps to identify a no-op attempt
+ // to refresh the file. The no-op will otherwise be blocked by a running build or cancel a running build
+ IFile file= input.getFile();
+ if (!file.isSynchronized(IResource.DEPTH_ZERO)) {
+ try {
+ refreshFile(file);
+ } catch (CoreException x) {
+ handleCoreException(x, TextEditorMessages.FileDocumentProvider_createElementInfo);
+ }
}
IDocument d= null;

Back to the top