Force editor to (re)validate/refresh [message #1831665] |
Wed, 26 August 2020 09:02 |
M. J. Messages: 6 Registered: September 2018 |
Junior Member |
|
|
Hello everyone,
I'm having a eclipse plugin, which includes an editor (extension point org.eclipse.ui.editors), in fact the MultiPageEditorPart. The editor has some more components and related extensions, like the configuration (extension point org.eclipse.wst.sse.ui.editorConfiguration) and validator (extension point org.eclipse.wst.sse.ui.sourcevalidation).
The problem is, sometimes the "configuration" (the internal state of the editor backend) sometimes changes during the runtime, thus the behaviour of the editor may change. The most important is to re-run the validation of the editor input. Secondly, the editor may be rerendered/redrawn, because some elements/regions may then be displayed by different style.
The question is how to force the validation (or, in general, to update/refresh) the editor.
What did I try:
- refresh the file resource opened in the editor
- look for some "validate" method of the editor
- try to incorporate the PropertyChangeEvent s
- debug the Validator calls and try to find out something in the stack trace
All I know is the validation gets triggered some time after user interaction with the editor. (Which is currently the workaround, press some key and wait a few seconds.)
Is there any way to trigger the validation (or rerender) or just the general refresh of the editor by hand?
Regards,
Martin
|
|
|
|
Re: Force editor to (re)validate/refresh [message #1834914 is a reply to message #1831671] |
Fri, 20 November 2020 13:10 |
M. J. Messages: 6 Registered: September 2018 |
Junior Member |
|
|
Rolf Theunissen wrote on Wed, 26 August 2020 10:19I don't think that you will get proper reaction here, the validation extensions you are using are provided by the WST project. You will have better changes asking it on their forum.
Have a look at the source of interfaces you had to implement to provide the validator, i.e. the IValidator: 'A validator's verification starts when the ValidatorLauncher singleton calls <code>validate</code>.'
The ValidationFramework calls might be helpful too.
https://www.eclipse.org/forums/index.php?t=thread&frm_id=251
Excelent! There was a little trick needed. Our validator is org.eclipse.wst.sse.ui.sourcevalidation extension (class implementing org.eclipse.wst.sse.ui.internal.reconcile.validator.ISourceValidator;), which is not compatible with the org.eclipse.wst.validation.validator validator extension (class implementing org.eclipse.wst.validation.internal.provisional.core.IValidator).
To be able to use the ValidatorLauncher it was needed to make the validator IValidator as well. Finally, I was able to do:
FileEditorInput input = (FileEditorInput) getEditorInput();
IFile file = input.getFile();
ValidationRunner.validate(file, ValType.Manual, null, true);
[Updated on: Fri, 20 November 2020 13:12] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.02926 seconds