protected ISelectable getAllDescriptions(final Resource resource) { return cache.get("internalGetAllDescriptions", resource, new Provider<ISelectable>() { @Override public ISelectable get() { return internalGetAllDescriptions(resource); } }); }
public IResourceDescription getResourceDescription(final Resource resource) { return cache.get(CACHE_KEY, resource, new Provider<IResourceDescription>() { public IResourceDescription get() { return internalGetResourceDescription(resource, strategy); } }); }
protected ISelectable getAllDescriptions(final Resource resource) { return cache.get("internalGetAllDescriptions", resource, new Provider<ISelectable>() { @Override public ISelectable get() { return internalGetAllDescriptions(resource); } }); }
protected ISelectable getAllDescriptions(final Resource resource) { return cache.get("internalGetAllDescriptions", resource, new Provider<ISelectable>() { public ISelectable get() { return internalGetAllDescriptions(resource); } }); }
protected LinkedHashSet<URI> getImportedUris(final Resource resource) { return cache.get(ImportUriGlobalScopeProvider.class.getName(), resource, new Provider<LinkedHashSet<URI>>() { @Override public LinkedHashSet<URI> get() { TreeIterator<EObject> iterator = resource.getAllContents(); final LinkedHashSet<URI> uniqueImportURIs = new LinkedHashSet<URI>(10); while (iterator.hasNext()) { EObject object = iterator.next(); if (object instanceof ImportDeclaration) { ImportDeclaration importDeclaration = (ImportDeclaration) object; processImportDeclaration(importDeclaration, resource, uniqueImportURIs); } } return uniqueImportURIs; } }); }
protected LinkedHashSet<URI> getImportedUris(final Resource resource) { return cache.get(ImportUriGlobalScopeProvider.class.getName(), resource, new Provider<LinkedHashSet<URI>>(){ public LinkedHashSet<URI> get() { TreeIterator<EObject> iterator = resource.getAllContents(); final LinkedHashSet<URI> uniqueImportURIs = new LinkedHashSet<URI>(10); while (iterator.hasNext()) { EObject object = iterator.next(); String uri = importResolver.apply(object); if (uri != null) { URI importUri = URI.createURI(uri); uniqueImportURIs.add(importUri); } } Iterator<URI> uriIter = uniqueImportURIs.iterator(); while(uriIter.hasNext()) { if (!EcoreUtil2.isValidUri(resource, uriIter.next())) uriIter.remove(); } return uniqueImportURIs; } }); }
@Override protected EObjectDescriptionLookUp getLookUp() { return cache.get(EOBJECT_LOOKUP_CACHE_KEY, getResource(), new Provider<EObjectDescriptionLookUp>() { public EObjectDescriptionLookUp get() { if(lookup != null) lookup.setExportedObjects(computeExportedObjects()); else lookup = new EObjectDescriptionLookUp(computeExportedObjects()); return lookup; } }); }
@Override public String getURIFragment(final EObject object) { return cache.get(Tuples.pair(object, "fragment"), this, new Provider<String>() { public String get() { if (fragmentProvider != null) { String result = fragmentProvider.getFragment(object, fragmentProviderFallback); return result; } String result = XtextResource.super.getURIFragment(object); return result; } }); }
@Override public JvmTypeReference getVariableType(final Variable variable) { return cache.get(variable, variable.eResource(), new Provider<JvmTypeReference>(){ @Override public JvmTypeReference get() { return doGetVariableType(variable); } }); }
public Iterable<IReferenceDescription> getReferenceDescriptions() { return cache.get(REFERENCE_DESCRIPTIONS_CACHE_KEY, getResource(), new Provider<List<IReferenceDescription>>(){ public List<IReferenceDescription> get() { return computeReferenceDescriptions(); }}); }
/** * @since 2.4 */ protected Set<String> getUnresolvableURIFragments() { Set<String> unresolveableProxies = getCache().get(UNRESOLVEABLE_PROXIES_KEY, this, new Provider<Set<String>>() { public Set<String> get() { return Sets.newHashSet(); } }); return unresolveableProxies; } }
protected List<ImportNormalizer> getImportedNamespaceResolvers(final EObject context, final boolean ignoreCase) { return cache.get(Tuples.create(context, ignoreCase, "imports"), context.eResource(), new Provider<List<ImportNormalizer>>() { public List<ImportNormalizer> get() { return internalGetImportedNamespaceResolvers(context, ignoreCase); } }); }
protected List<ImportNormalizer> getImportedNamespaceResolvers(final EObject context, final boolean ignoreCase) { return cache.get(Tuples.create(context, ignoreCase, "imports"), context.eResource(), new Provider<List<ImportNormalizer>>() { @Override public List<ImportNormalizer> get() { return internalGetImportedNamespaceResolvers(context, ignoreCase); } }); }
protected List<ImportNormalizer> getImportedNamespaceResolvers(final EObject context, final boolean ignoreCase) { return cache.get(Tuples.create(context, ignoreCase, "imports"), context.eResource(), new Provider<List<ImportNormalizer>>() { @Override public List<ImportNormalizer> get() { return internalGetImportedNamespaceResolvers(context, ignoreCase); } }); }
public QualifiedName getFullyQualifiedName(final EObject obj) { return cache.get(Tuples.pair(obj, "fqn"), obj.eResource(), new Provider<QualifiedName>(){ public QualifiedName get() { EObject temp = obj; QualifiedName qualifiedNameFromDispatcher = qualifiedName.invoke(temp); if (qualifiedNameFromDispatcher!=null) return qualifiedNameFromDispatcher; String name = getResolver().apply(temp); if (Strings.isEmpty(name)) return null; QualifiedName qualifiedNameFromConverter = converter.toQualifiedName(name); while (temp.eContainer() != null) { temp = temp.eContainer(); QualifiedName parentsQualifiedName = getFullyQualifiedName(temp); if (parentsQualifiedName != null) return parentsQualifiedName.append(qualifiedNameFromConverter); } return qualifiedNameFromConverter; } }); }
public QualifiedName getFullyQualifiedName(final EObject obj) { return cache.get(Tuples.pair(obj, "fqn"), obj.eResource(), new Provider<QualifiedName>(){ public QualifiedName get() { EObject temp = obj; QualifiedName qualifiedNameFromDispatcher = qualifiedName.invoke(temp); if (qualifiedNameFromDispatcher!=null) return qualifiedNameFromDispatcher; String name = getResolver(obj).apply(temp); if (Strings.isEmpty(name)) return null; QualifiedName qualifiedNameFromConverter = getConverter().toQualifiedName(name); while (temp.eContainer() != null) { temp = temp.eContainer(); QualifiedName parentsQualifiedName = getFullyQualifiedName(temp); if (parentsQualifiedName != null) return parentsQualifiedName.append(qualifiedNameFromConverter); } return qualifiedNameFromConverter; } }); }
protected <T> T internalGet(String methodName, Provider<T> provider, Object... elements) { return cache.<T> get( Pair.<String, Object> of(methodName, cacheUtils.getKeys(elements)), cacheUtils.getResource(elements), provider); }
@Override public QualifiedName getFullyQualifiedName(final EObject obj) { return cache.get(Tuples.pair(obj, getCacheKey()), obj.eResource(), new Provider<QualifiedName>() { @Override public QualifiedName get() { EObject temp = obj; String name = nameDispatcher.invoke(temp); if (Strings.isEmpty(name)) return null; QualifiedName qualifiedName = QualifiedName.create(name); if(!isRecurseParent(obj)) return qualifiedName; QualifiedName parentsQualifiedName = getFullyQualifiedName(obj.eContainer()); if (parentsQualifiedName == null) return null; else return parentsQualifiedName.append(qualifiedName); } }); }
public IScope getScope(final EObject context, final EReference reference) { ISelectable resourceContent = cache.get(Tuples.pair(SimpleLocalScopeProvider.class.getName(), reference), context.eResource(), new Provider<ISelectable>() { public ISelectable get() { return getAllDescriptions(context.eResource()); } }); IScope globalScope = getGlobalScope(context.eResource(), reference); return createScope(globalScope, resourceContent, reference.getEReferenceType(), isIgnoreCase(reference)); }
public String getHash(final JvmDeclaredType type) { if(type.eResource() instanceof TypeResource) { IMirror mirror = ((TypeResource)type.eResource()).getMirror(); if(mirror instanceof IMirrorExtension && ((IMirrorExtension) mirror).isSealed()) return type.getIdentifier(); } return cache.get(Tuples.create(HASH_CACHE_KEY, type), type.eResource(), new Provider<String>() { @Override public String get() { return signatureBuilderProvider.get().appendSignature(type).hash(); } }); }