diff options
author | Andrey Loskutov | 2019-05-02 14:06:01 +0000 |
---|---|---|
committer | Andrey Loskutov | 2019-05-02 14:06:01 +0000 |
commit | 1ae1f3baeaf8cdb3570b9c23665176335cce0014 (patch) | |
tree | 7607754eab707974c02348acfae1d77ac6088429 | |
parent | ead7de4749a856cec4c830d7bd331961cc5dad27 (diff) | |
download | eclipse.platform.text-1ae1f3baeaf8cdb3570b9c23665176335cce0014.tar.gz eclipse.platform.text-1ae1f3baeaf8cdb3570b9c23665176335cce0014.tar.xz eclipse.platform.text-1ae1f3baeaf8cdb3570b9c23665176335cce0014.zip |
Bug 546920 - FileDocumentProvider.createElementInfo(Object) should notI20190508-1800I20190508-0450I20190508-0150I20190507-1800I20190507-0155I20190506-1800I20190505-1800I20190504-1800I20190503-1800I20190502-1800
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.java | 13 |
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 a61d0616988..be9d6f94a79 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; |