use of org.eclipse.xtext.resource.IReferenceDescription in project xtext-eclipse by eclipse.
the class AbstractReferenceUpdater method createReferenceUpdates.
protected void createReferenceUpdates(ElementRenameArguments elementRenameArguments, Iterable<IReferenceDescription> referenceDescriptions, IRefactoringUpdateAcceptor updateAcceptor, RefactoringResourceSetProvider resourceSetProvider, IProgressMonitor monitor) {
SubMonitor progress = SubMonitor.convert(monitor, 100);
progress.beginTask("Sort references by project", 1);
Multimap<IProject, IReferenceDescription> project2references = sorter.sortByProject(referenceDescriptions);
SubMonitor allProjectsProgress = progress.newChild(98).setWorkRemaining(project2references.keySet().size());
for (IProject project : project2references.keySet()) {
if (allProjectsProgress.isCanceled()) {
throw new OperationCanceledException();
}
Multimap<URI, IReferenceDescription> resource2references = sorter.sortByResource(project2references.get(project));
ResourceSet resourceSet = resourceSetProvider.get(project);
StatusWrapper status = updateAcceptor.getRefactoringStatus();
createClusteredReferenceUpdates(elementRenameArguments, resource2references, resourceSet, updateAcceptor, status, allProjectsProgress.newChild(1));
}
}
use of org.eclipse.xtext.resource.IReferenceDescription in project xtext-eclipse by eclipse.
the class XbaseReferenceUpdater method processReferringResource.
@Override
protected void processReferringResource(Resource referringResource, Iterable<IReferenceDescription> referenceDescriptions, ElementRenameArguments elementRenameArguments, IRefactoringUpdateAcceptor updateAcceptor, IProgressMonitor monitor) {
ImportAwareUpdateAcceptor importAwareUpdateAcceptor = createUpdateAcceptor(referringResource, updateAcceptor);
Iterable<IReferenceDescription> importTypeReferences = getImportTypeReferences(referenceDescriptions);
super.processReferringResource(referringResource, importTypeReferences, elementRenameArguments, importAwareUpdateAcceptor, monitor);
importAwareUpdateAcceptor.getImportSection().update();
Iterable<IReferenceDescription> notImportTypeReferences = getNotImportTypeReferences(referenceDescriptions);
super.processReferringResource(referringResource, notImportTypeReferences, elementRenameArguments, importAwareUpdateAcceptor, monitor);
List<ReplaceRegion> importChanges = importAwareUpdateAcceptor.getImportSection().rewrite();
TextEdit importChangeEdit = replaceConverter.convertToTextEdit(importChanges);
if (importChangeEdit != null)
updateAcceptor.accept(referringResource.getURI(), importChangeEdit);
}
Aggregations