本文整理汇总了Java中org.eclipse.xtext.util.IResourceScopeCache类的典型用法代码示例。如果您正苦于以下问题:Java IResourceScopeCache类的具体用法?Java IResourceScopeCache怎么用?Java IResourceScopeCache使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IResourceScopeCache类属于org.eclipse.xtext.util包,在下文中一共展示了IResourceScopeCache类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: updateInternalState
import org.eclipse.xtext.util.IResourceScopeCache; //导入依赖的package包/类
/**
* Overridden to make sure that we add the root AST element sneakily to the resource list to make sure that no
* accidental proxy resolution happens and that we do not increment the modification counter of the contents list.
*/
@Override
protected void updateInternalState(IParseResult newParseResult) {
setParseResult(newParseResult);
EObject newRootAstElement = newParseResult.getRootASTElement();
if (newRootAstElement != null && !getContents().contains(newRootAstElement)) {
// do not increment the modification counter here
sneakyAddToContent(newRootAstElement);
}
reattachModificationTracker(newRootAstElement);
clearErrorsAndWarnings();
addSyntaxErrors();
doLinking();
// make sure that the cache adapter is installed on this resource
IResourceScopeCache cache = getCache();
if (cache instanceof OnChangeEvictingCache) {
((OnChangeEvictingCache) cache).getOrCreate(this);
}
}
开发者ID:eclipse,项目名称:n4js,代码行数:24,代码来源:N4JSResource.java
示例2: setUp
import org.eclipse.xtext.util.IResourceScopeCache; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
resourceSet = new ResourceSetImpl();
IQualifiedNameProvider qualifiedNameProvider = new IQualifiedNameProvider.AbstractImpl() {
@Override
public QualifiedName getFullyQualifiedName(EObject obj) {
return QualifiedName.create(((ENamedElement) obj).getName());
}
@Override
public QualifiedName apply(EObject from) {
return QualifiedName.create(((ENamedElement) from).getName());
}
};
resourceDescriptionManager = new DefaultResourceDescriptionManager();
resourceDescriptionManager.setCache(IResourceScopeCache.NullImpl.INSTANCE);
DefaultResourceDescriptionStrategy strategy = new DefaultResourceDescriptionStrategy();
strategy.setQualifiedNameProvider(qualifiedNameProvider);
resourceDescriptionManager.setStrategy(strategy);
resDescs = new ResourceSetBasedResourceDescriptions();
resDescs.setContext(resourceSet);
resDescs.setRegistry(this);
container = new ResourceDescriptionsBasedContainer(resDescs);
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:27,代码来源:ResourceSetBasedResourceDescriptionsTest.java
示例3: insertProxyModel
import org.eclipse.xtext.util.IResourceScopeCache; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public void insertProxyModel() {
// Node model can be accessed by:
// 1. checking the adapters of an EObject
ICompositeNode rootNode = null;
TreeIterator<EObject> iterator = EcoreUtil.getAllProperContents(resource, false);
while (iterator.hasNext()) {
EObject eObject = iterator.next();
LazyLoadingCompositeNode node = new LazyLoadingCompositeNode();
eObject.eAdapters().add(node);
if (rootNode == null) {
rootNode = node;
}
}
// 2. fetching the ParseResult instance of the Resource
EObject emfRootObject = resource.getContents().isEmpty() ? null : resource.getContents().get(0);
resource.setParseResult(new ParseResult(emfRootObject, rootNode, false));
// Add cache now, otherwise it will trigger model inference later.
IResourceScopeCache cache = resource.getCache();
if (cache instanceof OnChangeEvictingCache) {
((OnChangeEvictingCache) cache).getOrCreate(resource);
}
}
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:27,代码来源:NodeModelHandler.java
示例4: N4JSResourceDescription
import org.eclipse.xtext.util.IResourceScopeCache; //导入依赖的package包/类
/**
* Creates a new description for the given resource.
*/
public N4JSResourceDescription(N4JSCrossReferenceComputer crossReferenceComputer,
TypeHelper typeHelper,
IQualifiedNameProvider qualifiedNameProvider,
Resource resource,
N4JSResourceDescriptionStrategy strategy,
IResourceScopeCache cache) {
super(resource, strategy, cache);
this.crossReferenceComputer = crossReferenceComputer;
this.qualifiedNameProvider = qualifiedNameProvider;
this.typeHelper = typeHelper;
this.strategy = strategy;
}
开发者ID:eclipse,项目名称:n4js,代码行数:16,代码来源:N4JSResourceDescription.java
示例5: updateInternalState
import org.eclipse.xtext.util.IResourceScopeCache; //导入依赖的package包/类
/**
* Overridden to make sure that the cache is initialized during {@link #isLoading() loading}.
*/
@Override
protected void updateInternalState(IParseResult newParseResult) {
super.updateInternalState(newParseResult);
// make sure that the cache adapter is installed on this resource
IResourceScopeCache cache = getCache();
if (cache instanceof OnChangeEvictingCache) {
((OnChangeEvictingCache) cache).getOrCreate(this);
}
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:13,代码来源:DerivedStateAwareResource.java
示例6: DefaultResourceDescription
import org.eclipse.xtext.util.IResourceScopeCache; //导入依赖的package包/类
public DefaultResourceDescription(Resource resource, IDefaultResourceDescriptionStrategy strategy,
IResourceScopeCache cache) {
this.resource = resource;
this.strategy = strategy;
this.cache = cache;
this.uri = getNormalizedURI(resource);
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:8,代码来源:DefaultResourceDescription.java
示例7: recursiveLookUp
import org.eclipse.xtext.util.IResourceScopeCache; //导入依赖的package包/类
/**
* Test that recursive calls to {@link ResourceDescription2#getLookUp()} by {@link ResourceDescription2#computeExportedObjects()} do not cause
* stack-overflow.
*/
@Test
public void recursiveLookUp() {
Resource resource = org.mockito.Mockito.mock(Resource.class);
BasicEList<Adapter> emptyEList = new BasicEList<Adapter>();
org.mockito.Mockito.when(resource.eAdapters()).thenReturn(emptyEList);
IResourceScopeCache cache = new OnChangeEvictingCache();
new ResourceDescription2(resource, null, cache) {
@Override
protected List<IEObjectDescription> computeExportedObjects() {
return Lists.newArrayList(getLookUp().getExportedObjects());
}
}.getExportedObjects();
}
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:18,代码来源:BugAig1084.java
示例8: GamlResourceDescription
import org.eclipse.xtext.util.IResourceScopeCache; //导入依赖的package包/类
@Inject
public GamlResourceDescription(final Resource resource, final IDefaultResourceDescriptionStrategy strategy,
final IResourceScopeCache cache, final BuiltinGlobalScopeProvider provider) {
super(resource, strategy, cache);
this.provider = provider;
}
开发者ID:gama-platform,项目名称:gama,代码行数:8,代码来源:GamlResourceDescription.java
示例9: setCache
import org.eclipse.xtext.util.IResourceScopeCache; //导入依赖的package包/类
public void setCache(IResourceScopeCache cache) {
this.cache = cache;
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:4,代码来源:DefaultResourceDescriptionManager.java
示例10: getCache
import org.eclipse.xtext.util.IResourceScopeCache; //导入依赖的package包/类
public IResourceScopeCache getCache() {
return cache;
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:4,代码来源:DefaultResourceDescriptionManager.java
示例11: setUp
import org.eclipse.xtext.util.IResourceScopeCache; //导入依赖的package包/类
@Override
public void setUp() throws Exception {
super.setUp();
with(ReferenceGrammarTestLanguageStandaloneSetup.class);
IQualifiedNameConverter nameConverter = new IQualifiedNameConverter.DefaultImpl();
IQualifiedNameProvider nameProvider = new DefaultDeclarativeQualifiedNameProvider();
ImportUriGlobalScopeProvider globalScopeProvider = new ImportUriGlobalScopeProvider();
globalScopeProvider.setImportResolver(new ImportUriResolver());
globalScopeProvider.setCache(IResourceScopeCache.NullImpl.INSTANCE);
final ResourceDescriptionsProvider provider = new ResourceDescriptionsProvider();
provider.setResourceDescriptions(new Provider<IResourceDescriptions>() {
@Override
public IResourceDescriptions get() {
return new IResourceDescriptions.NullImpl();
}
});
globalScopeProvider.setResourceDescriptionsProvider(provider);
globalScopeProvider.setLoadOnDemandDescriptions(new Provider<LoadOnDemandResourceDescriptions>() {
@Override
public LoadOnDemandResourceDescriptions get() {
return PartialLinkingTest.this.get(LoadOnDemandResourceDescriptions.class);
}
});
CaseInsensitivityHelper caseInsensitivityHelper = new CaseInsensitivityHelper();
globalScopeProvider.setCaseInsensitivityHelper(caseInsensitivityHelper);
scopeProvider = new ImportedNamespaceAwareLocalScopeProvider(globalScopeProvider, nameProvider, nameConverter, caseInsensitivityHelper);
modelAsText =
"spielplatz 1 {\n" +
" kind( Bommel1 1)\n" +
" kind( Bommel2 2)\n" +
" kind( Bommel3 3)\n" +
" erwachsener( Bob 4)\n" +
" erwachsener( Joe 5)\n" +
" familie( Familienname Bob Joe Bommel2 )\n" +
"}";
resource = getResourceFromString(modelAsText);
assertTrue(resource.getErrors().toString(), resource.getErrors().isEmpty());
model = resource.getParseResult().getRootASTElement();
final Iterator<EObject> iter = model.eAllContents();
while (iter.hasNext() && context == null) {
final EObject candidate = iter.next();
final String className = candidate.eClass().getName();
if (className.endsWith("Familie"))
context = candidate;
}
reference = (EReference) context.eClass().getEStructuralFeature("kinder");
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:48,代码来源:PartialLinkingTest.java
示例12: ResourceDescription2
import org.eclipse.xtext.util.IResourceScopeCache; //导入依赖的package包/类
public ResourceDescription2(final Resource resource, final IDefaultResourceDescriptionStrategy strategy, final IResourceScopeCache cache) {
super(resource, strategy, cache);
this.strategy = strategy;
}
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:5,代码来源:ResourceDescription2.java
示例13: getCache
import org.eclipse.xtext.util.IResourceScopeCache; //导入依赖的package包/类
/**
* Returns the scope cache for this resource.
*
* @return The IResourceScopeCache object, never {@code null}
*/
IResourceScopeCache getCache();
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:7,代码来源:ILazyLinkingResource2.java
注:本文中的org.eclipse.xtext.util.IResourceScopeCache类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论