Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 327866 - Validation depending on index fails
Summary: Validation depending on index fails
Status: CLOSED WONTFIX
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 1.0.0   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-15 05:20 EDT by Benjamin Schwertfeger CLA
Modified: 2017-09-19 17:14 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 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