Search in sources :

Example 1 with LinkingDiagnosticProducer

use of org.eclipse.xtext.linking.impl.LinkingDiagnosticProducer in project xtext-core by eclipse.

the class LazyLinker method doLinkModel.

@Override
protected void doLinkModel(final EObject model, IDiagnosticConsumer consumer) {
    final Multimap<EStructuralFeature.Setting, INode> settingsToLink = ArrayListMultimap.create();
    final LinkingDiagnosticProducer producer = new LinkingDiagnosticProducer(consumer);
    cache.execWithoutCacheClear(model.eResource(), new IUnitOfWork.Void<Resource>() {

        @Override
        public void process(Resource state) throws Exception {
            TreeIterator<EObject> iterator = getAllLinkableContents(model);
            boolean clearAllReferencesRequired = isClearAllReferencesRequired(state);
            while (iterator.hasNext()) {
                EObject eObject = iterator.next();
                if (clearAllReferencesRequired) {
                    clearReferences(eObject);
                }
                installProxies(eObject, producer, settingsToLink);
            }
        }
    });
    installQueuedLinks(settingsToLink);
}
Also used : IUnitOfWork(org.eclipse.xtext.util.concurrent.IUnitOfWork) INode(org.eclipse.xtext.nodemodel.INode) LinkingDiagnosticProducer(org.eclipse.xtext.linking.impl.LinkingDiagnosticProducer) EObject(org.eclipse.emf.ecore.EObject) InternalEObject(org.eclipse.emf.ecore.InternalEObject) Resource(org.eclipse.emf.ecore.resource.Resource) TreeIterator(org.eclipse.emf.common.util.TreeIterator) WrappedException(org.eclipse.emf.common.util.WrappedException)

Aggregations

TreeIterator (org.eclipse.emf.common.util.TreeIterator)1 WrappedException (org.eclipse.emf.common.util.WrappedException)1 EObject (org.eclipse.emf.ecore.EObject)1 InternalEObject (org.eclipse.emf.ecore.InternalEObject)1 Resource (org.eclipse.emf.ecore.resource.Resource)1 LinkingDiagnosticProducer (org.eclipse.xtext.linking.impl.LinkingDiagnosticProducer)1 INode (org.eclipse.xtext.nodemodel.INode)1 IUnitOfWork (org.eclipse.xtext.util.concurrent.IUnitOfWork)1