use of org.eclipse.xtext.ide.refactoring.ResourceRelocationChange in project xtext-core by eclipse.
the class FileAwareTestLanguageResourceRelocationStrategy method applyChange.
@Override
public void applyChange(final ResourceRelocationContext context) {
final Function1<ResourceRelocationChange, Boolean> _function = (ResourceRelocationChange it) -> {
return Boolean.valueOf(this.canHandle(it));
};
final Consumer<ResourceRelocationChange> _function_1 = (ResourceRelocationChange change) -> {
final IChangeSerializer.IModification<Resource> _function_2 = (Resource resource) -> {
final EObject rootElement = IterableExtensions.<EObject>head(resource.getContents());
if ((rootElement instanceof PackageDeclaration)) {
final String newPackage = IterableExtensions.join(IterableExtensions.<String>drop(change.getToURI().trimSegments(1).segmentsList(), 2), ".");
((PackageDeclaration) rootElement).setName(newPackage);
}
};
context.addModification(change, _function_2);
};
IterableExtensions.<ResourceRelocationChange>filter(context.getChanges(), _function).forEach(_function_1);
}
Aggregations