Don't run validation in UI thread as it worsens the user experience
Make JsonDocument's model, jsonContent, and yamlContent multi-thread safe
Fix potential NPE by only passing non-null Model to JsonReferenceValidator
ZEN-4351 Invalid Thread Access Exception thrown when saving documents
Monitor.isCancelled() and the Main Thread.
Normally, monitor.isCancelled() should NOT be executed in the Main
thread - that's the idea of the progress monitor.
However, the save operations use a special implementation of the
progress monitor (EventLoopProgressMonitor) which is
used to run an event loop whenever progress monitor methods are
invoked
That's why isCancelled() operation must be executed in the Main Thread
for this implementation of the monitor.
org.eclipse.ui.internal.SaveableHelper.saveModels() creates and
EventLoopProgressMonitor, then it calls doSaveModel() which calls
the editor's save method (model.doSave(subMonitor.split(2), shellProvider);). This is how our doSave() methods gets this
implementation of the monitor and passes it to the validation.
Improvements:
model
,jsonContent
, andyamlContent
multi-thread safeJsonReferenceValidator
ZEN-4351 Invalid Thread Access Exception thrown when saving documents
Monitor.isCancelled() and the Main Thread.
Normally, monitor.isCancelled() should NOT be executed in the Main thread - that's the idea of the progress monitor.
However, the save operations use a special implementation of the progress monitor (
EventLoopProgressMonitor
) which isThat's why
isCancelled()
operation must be executed in the Main Thread for this implementation of the monitor.org.eclipse.ui.internal.SaveableHelper.saveModels()
creates andEventLoopProgressMonitor
, then it callsdoSaveModel()
which calls the editor's save method (model.doSave(subMonitor.split(2), shellProvider);
). This is how ourdoSave()
methods gets this implementation of the monitor and passes it to the validation.