mirror of
https://github.com/sigmasternchen/xtext-core
synced 2025-03-15 08:18:55 +00:00
[refactoring] introduced default method in 'IResourceRelocationStrategy' allowing an implementation to explicitly demand for live scope resource indexing during refactorings
updated implementation of 'FileAwareTestLanguage' Signed-off-by: Christian Schneider <christian.schneider@typefox.io>
This commit is contained in:
parent
dc5c0c6ff7
commit
265e4c97e3
4 changed files with 31 additions and 1 deletions
|
@ -29,6 +29,16 @@ interface IResourceRelocationStrategy {
|
|||
|
||||
def void applyChange(ResourceRelocationContext context)
|
||||
|
||||
/**
|
||||
* If possible refactoring operations may rely on persisted index data for reduced memory consumption,
|
||||
* which is the case in the Eclipse IDE. By overloading this method client implementations may
|
||||
* explicitly demand for live scope resource indexing.
|
||||
*
|
||||
* @since 2.18
|
||||
*/
|
||||
def boolean requiresLiveScopeResourceIndexing(ResourceRelocationContext context) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -30,4 +30,15 @@ import org.eclipse.xtext.ide.refactoring.ResourceRelocationContext;
|
|||
@SuppressWarnings("all")
|
||||
public interface IResourceRelocationStrategy {
|
||||
public abstract void applyChange(final ResourceRelocationContext context);
|
||||
|
||||
/**
|
||||
* If possible refactoring operations may rely on persisted index data for reduced memory consumption,
|
||||
* which is the case in the Eclipse IDE. By overloading this method client implementations may
|
||||
* explicitly demand for live scope resource indexing.
|
||||
*
|
||||
* @since 2.18
|
||||
*/
|
||||
public default boolean requiresLiveScopeResourceIndexing(final ResourceRelocationContext context) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,11 @@ class FileAwareTestLanguageResourceRelocationStrategy implements IResourceReloca
|
|||
def boolean canHandle(ResourceRelocationChange change) {
|
||||
resourceServiceProvider.canHandle(change.fromURI)
|
||||
}
|
||||
|
||||
|
||||
override requiresLiveScopeResourceIndexing(ResourceRelocationContext context) {
|
||||
true
|
||||
}
|
||||
|
||||
override applyChange(ResourceRelocationContext context) {
|
||||
context.changes.filter[ canHandle ].forEach [ change |
|
||||
context.addModification(change) [ resource |
|
||||
|
|
|
@ -22,6 +22,11 @@ public class FileAwareTestLanguageResourceRelocationStrategy implements IResourc
|
|||
return this.resourceServiceProvider.canHandle(change.getFromURI());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requiresLiveScopeResourceIndexing(final ResourceRelocationContext context) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyChange(final ResourceRelocationContext context) {
|
||||
final Function1<ResourceRelocationChange, Boolean> _function = (ResourceRelocationChange it) -> {
|
||||
|
|
Loading…
Reference in a new issue