Package jetbrains.mps.scope
Class VisibleDepsSearchScope
- java.lang.Object
 - 
- jetbrains.mps.smodel.BaseScope
 - 
- jetbrains.mps.scope.VisibleDepsSearchScope
 
 
 
- 
- All Implemented Interfaces:
 SearchScope
public class VisibleDepsSearchScope extends BaseScope
SearchScopeimplementation that uses'visible'module dependencies to build a scope.Since this class deals with
SModuleandSModel, appropriate model access (at least read) is expected from the caller.Note, this class is stateful and doesn't track changes to initial modules, though there's no obligation it's a snapshot either. At the moment, set of modules is fixed at init time, while set of models is dynamic. This is not given, implementation may change at any moment. Likely, we will cache everything at init time (depending on observed performance).
{@implNote The reason I don't want to keep scope instance along with an AbstractModule is that there's little value in caching these scopes. We need to invalidate them in bulk on any module change anyway. Most usage scenarios obtain scope instance, perform some activities and abandon it afterwards, therefore stateful instance if perfectly fine.- Since:
 - 2018.2
 
 
- 
- 
Constructor Summary
Constructors Constructor Description VisibleDepsSearchScope(SRepository repository, Collection<? extends SModule> modules, Collection<SLanguage> usedLanguages)VisibleDepsSearchScope(SRepository repository, SModule module) 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Iterable<SModel>getModels()Iterable<SModule>getModules()SModelresolve(SModelReference reference)Finder use this method to go from model reference to SModel object, Find Usages client may use this method to limit what's visible/accessible to a Finder.SModuleresolve(SModuleReference reference)Finder use this method to go from module reference to SModule object, Find Usages client may use this method to limit what's visible/accessible to a Finder.- 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
- 
Methods inherited from interface org.jetbrains.mps.openapi.module.SearchScope
resolve 
 - 
 
 - 
 
- 
- 
Constructor Detail
- 
VisibleDepsSearchScope
public VisibleDepsSearchScope(@Nullable SRepository repository, @NotNull SModule module)
- Parameters:
 repository- repository to look up dependencies (dependant modules and accessory models of used languages) in. Ifnull, scope consists of a module itself only.module- source of dependencies to scan
 
- 
VisibleDepsSearchScope
public VisibleDepsSearchScope(@Nullable SRepository repository, Collection<? extends SModule> modules, Collection<SLanguage> usedLanguages)
 
 - 
 
- 
Method Detail
- 
getModules
@NotNull public Iterable<SModule> getModules()
- Specified by:
 getModulesin interfaceSearchScope- Specified by:
 getModulesin classBaseScope- Returns:
 - all modules 
jetbrains.mps.ide.findusages.findalgorithm.finders.Findershall look into for occurrences 
 
- 
getModels
@NotNull public Iterable<SModel> getModels()
- Specified by:
 getModelsin interfaceSearchScope- Overrides:
 getModelsin classBaseScope- Returns:
 - all models 
jetbrains.mps.ide.findusages.findalgorithm.finders.Findershall look into for occurrences 
 
- 
resolve
public SModule resolve(@NotNull SModuleReference reference)
Description copied from interface:SearchScopeFinder use this method to go from module reference to SModule object, Find Usages client may use this method to limit what's visible/accessible to a Finder. shall always resolve references to modules fromSearchScope.getModules()- Specified by:
 resolvein interfaceSearchScope- Overrides:
 resolvein classBaseScope- Parameters:
 reference- module to look up in the scope- Returns:
 - module instance, or 
nullif there's no such module in the scope 
 
- 
resolve
public SModel resolve(@NotNull SModelReference reference)
Description copied from interface:SearchScopeFinder use this method to go from model reference to SModel object, Find Usages client may use this method to limit what's visible/accessible to a Finder. Generally, finder use this method to resolve references to search values shall always resolve references to models fromSearchScope.getModels()- Specified by:
 resolvein interfaceSearchScope- Overrides:
 resolvein classBaseScope- Parameters:
 reference- model to look up in the scope- Returns:
 - model instance, or 
nullif model with specified reference is not visible in the scope 
 
 - 
 
 -