Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 327866

Summary: Validation depending on index fails
Product: [Modeling] TMF Reporter: Benjamin Schwertfeger <benjamin.schwertfeger>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: sebastian.zarnekow
Version: 1.0.0   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Benjamin Schwertfeger CLA 2010-10-15 05:20:21 EDT
If you write a validation and access the Xtext index inside, the validation fails after project clean, because the index is updated after the global validation. The order should be changed in PersistableResourceDescriptionsImpl.

See also http://www.eclipse.org/forums/index.php?t=msg&th=198442.

1. Create a Check which references the Xtext index and warns, if the checked element is not inside.
2. create a model for the checked element in 1.
3. select project -> clean -> all projects
4. The error appears.
Comment 1 Sebastian Zarnekow CLA 2010-10-15 05:23:54 EDT
See Svens last message in the newsgroup:

You should use the same IResourceDescriptions
used in the AbstractGlobalScopeProvider so you will get a view on the
IResourceDescriptions containing the old state, shadowed by the new
state (and most important without the dirty resource information).

This is the relevant code o obtain the right IResourceDescriptions based
on the current context (we should encaspulate that better):

@Inject
@Named(NAMED_BUILDER_SCOPE)
private Provider<IResourceDescriptions>
                            builderScopeResourceDescriptions;

@Inject
private Provider<IResourceDescriptions> resourceDescriptions;
    
public IResourceDescriptions getResourceDescriptions(EObject ctx) {
  Map<Object, Object> loadOptions = ctx.eResource().getResourceSet()
                                       .getLoadOptions();
  IResourceDescriptions result = createResourceDescriptions();
  if (loadOptions.containsKey(NAMED_BUILDER_SCOPE)) {
    result = createBuilderScopeResourceDescriptions();
  }
  if (result instanceof IResourceDescriptions.IContextAware) {
    ((IResourceDescriptions.IContextAware) result).setContext(ctx);
  }
  return result;
}
Comment 2 Karsten Thoms CLA 2017-09-19 17:03:22 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 3 Karsten Thoms CLA 2017-09-19 17:14:56 EDT
Closing all bugs that were set to RESOLVED before Neon.0