Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 320226 - Provide way to trigger validation
Summary: Provide way to trigger validation
Status: CLOSED INVALID
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-19 04:40 EDT by Florian Philipp CLA
Modified: 2017-09-19 16:39 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Philipp CLA 2010-07-19 04:40:10 EDT
Build Identifier: 20100617-1415

When I start my RCP application or open a file in it, the validation is not triggered automatically. So I see the content, complete with outline and syntax highlighting but parser errors are not shown and my own validators are not executed. I need to make some change to the file, for example inserting a blank line, in order to trigger evaluation.

It is my understanding that this is a desired behavior because it avoids possibly resource intensive validations and builds. However, there should be some way to trigger validation nonetheless.

I tried the following code snippet:
for(IProject project: ResourcesPlugin.getWorkspace().getRoot().getProjects())
    for(IResource member: project.members())
        if(member.getType() == IResource.FILE)
            member.touch(new NullProgressMonitor());

It did not work, though. Since the documentation for IResource.touch specifically states that it can be used for triggering rebuilds and that it causes a resource change event, I'm wondering whether XText's behavior is really conforming.

Reproducible: Always

Steps to Reproduce:
1. Extend AbstractDeclarativeValidator
2. Open a new file which contains an error
3. Notice that no error is shown
4. Make a minor change to the file
5. Notice that the error suddenly appears
6. Restart the application
7. Notice that the error is once again gone
Comment 1 Sebastian Zarnekow CLA 2010-07-20 04:16:19 EDT
Hi Florian,

did you try to use the ValidatingEditorCallback?
Comment 2 Florian Philipp CLA 2010-07-27 05:02:00 EDT
Ah, thanks. Now that you told me the class name I was able to find some hints on the web on how to use this.

Is this documented anywhere?
Comment 3 Sebastian Zarnekow CLA 2010-07-27 05:10:15 EDT
(In reply to comment #2)
> Is this documented anywhere?

I'm afraid it is not.
Comment 4 Karsten Thoms CLA 2017-09-19 16:39:24 EDT
Closing bug which were set to RESOLVED before Eclipse Neon.0.