本文整理汇总了Java中org.eclipse.xtext.resource.IResourceDescriptions类的典型用法代码示例。如果您正苦于以下问题:Java IResourceDescriptions类的具体用法?Java IResourceDescriptions怎么用?Java IResourceDescriptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IResourceDescriptions类属于org.eclipse.xtext.resource包,在下文中一共展示了IResourceDescriptions类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: isAffected
import org.eclipse.xtext.resource.IResourceDescriptions; //导入依赖的package包/类
/**
* {@inheritDoc}
*
* This marks {@code n4js} as affected if the manifest of the project changes. In turn, they will be revalidated and
* taken into consideration for the code generation step.
*/
@Override
public boolean isAffected(Collection<IResourceDescription.Delta> deltas, IResourceDescription candidate,
IResourceDescriptions context) {
boolean result = basicIsAffected(deltas, candidate);
if (!result) {
for (IResourceDescription.Delta delta : deltas) {
URI uri = delta.getUri();
if (IN4JSProject.N4MF_MANIFEST.equalsIgnoreCase(uri.lastSegment())) {
URI prefixURI = uri.trimSegments(1).appendSegment("");
if (candidate.getURI().replacePrefix(prefixURI, prefixURI) != null) {
return true;
}
}
}
}
return result;
}
开发者ID:eclipse,项目名称:n4js,代码行数:24,代码来源:N4JSResourceDescriptionManager.java
示例2: createContainer
import org.eclipse.xtext.resource.IResourceDescriptions; //导入依赖的package包/类
@Override
protected synchronized IContainer createContainer(final String handle, final IResourceDescriptions resourceDescriptions) {
final IResourceDescriptions descriptionsKey = resourceDescriptions instanceof CurrentDescriptions2.ResourceSetAware
? ((CurrentDescriptions2.ResourceSetAware) resourceDescriptions).getDelegate()
: resourceDescriptions;
Map<String, WeakReference<IContainer>> containersMap = descriptionsContainersCache.get(descriptionsKey);
if (containersMap == null) {
containersMap = new HashMap<String, WeakReference<IContainer>>();
descriptionsContainersCache.put(descriptionsKey, containersMap);
}
WeakReference<IContainer> containerRef = containersMap.get(handle);
IContainer container = containerRef != null ? containerRef.get() : null;
if (container == null) {
final IContainerState containerState = new ContainerState(handle, getStateProvider().get(descriptionsKey));
container = new StateBasedContainerWithHandle(descriptionsKey, containerState, handle);
new CacheInvalidator(descriptionsKey, handle, containerState);
containerRef = new WeakReference<IContainer>(container);
containersMap.put(handle, containerRef);
}
return container;
}
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:25,代码来源:CachingStateBasedContainerManager.java
示例3: getGuiceBindingsUi
import org.eclipse.xtext.resource.IResourceDescriptions; //导入依赖的package包/类
@Override
public Set<Binding> getGuiceBindingsUi(Grammar grammar) {
return new BindFactory()
.addConfiguredBinding(
IResourceDescriptions.class.getName() + "BuilderScope",
"binder.bind(" + IResourceDescriptions.class.getName() + ".class"
+ ").annotatedWith(com.google.inject.name.Names.named("
+ ResourceDescriptionsProvider.class.getName() + ".NAMED_BUILDER_SCOPE)).to("
+ "org.eclipse.xtext.builder.clustering.CurrentDescriptions.ResourceSetAware.class)")
.addTypeToType("org.eclipse.xtext.ui.editor.IXtextEditorCallback", "org.eclipse.xtext.builder.nature.NatureAddingEditorCallback")
.addTypeToType("org.eclipse.xtext.generator.IContextualOutputConfigurationProvider", "org.eclipse.xtext.builder.EclipseOutputConfigurationProvider")
.addConfiguredBinding(
IResourceDescriptions.class.getName() + "Persisted",
"binder.bind("+ IResourceDescriptions.class.getName() + ".class"
+ ").annotatedWith(com.google.inject.name.Names.named("
+ "org.eclipse.xtext.resource.impl.ResourceDescriptionsProvider.PERSISTED_DESCRIPTIONS)).to("
+ "org.eclipse.xtext.builder.builderState.IBuilderState.class)")
.addTypeToType("org.eclipse.xtext.ui.editor.DocumentBasedDirtyResource", "org.eclipse.xtext.builder.impl.PersistentDataAwareDirtyResource")
.getBindings();
}
开发者ID:eclipse,项目名称:xtext-extras,代码行数:21,代码来源:BuilderIntegrationFragment.java
示例4: getIndexedJvmType
import org.eclipse.xtext.resource.IResourceDescriptions; //导入依赖的package包/类
public EObject getIndexedJvmType(QualifiedName qualifiedName, String fragment, ResourceSet resourceSet, boolean throwShadowedException) throws UnknownNestedTypeException {
if (resourceSet != null) {
IResourceDescriptions descriptions = resourceDescriptionsProvider.getResourceDescriptions(resourceSet);
Iterable<IEObjectDescription> candidates = descriptions.getExportedObjects(TypesPackage.Literals.JVM_TYPE, qualifiedName, false);
Iterator<IEObjectDescription> iterator = candidates.iterator();
if (iterator.hasNext()) {
EObject result = findAccessibleType(fragment, resourceSet, iterator);
if (result != null) {
return result;
}
}
if (throwShadowedException && descriptions instanceof IShadowedResourceDescriptions) {
if (((IShadowedResourceDescriptions) descriptions).isShadowed(TypesPackage.Literals.JVM_TYPE, qualifiedName, false)) {
throw new ShadowedTypeException("The type '"+qualifiedName+"' is locally shadowed.");
}
}
}
return null;
}
开发者ID:eclipse,项目名称:xtext-extras,代码行数:20,代码来源:IndexedJvmTypeAccess.java
示例5: testContainerAddRemove
import org.eclipse.xtext.resource.IResourceDescriptions; //导入依赖的package包/类
@Test
public void testContainerAddRemove() throws Exception {
ResourceSet resourceSet = new XtextResourceSet();
Resource res = parse("local", resourceSet).eResource();
parse("other", resourceSet);
IResourceDescription resourceDescription = descriptionManager.getResourceDescription(res);
IResourceDescriptions resourceDescriptions = descriptionsProvider.getResourceDescriptions(res);
List<IContainer> containers = containerManager.getVisibleContainers(resourceDescription, resourceDescriptions);
assertEquals(1, containers.size());
IContainer container = containers.get(0);
assertEquals("local, other", format(container.getExportedObjects()));
Resource foo = parse("foo", resourceSet).eResource();
assertEquals("foo, local, other", format(container.getExportedObjects()));
resourceSet.getResources().remove(foo);
assertEquals("local, other", format(container.getExportedObjects()));
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:20,代码来源:AbstractLiveContainerTest.java
示例6: getSymbols
import org.eclipse.xtext.resource.IResourceDescriptions; //导入依赖的package包/类
public List<? extends SymbolInformation> getSymbols(final String query, final IReferenceFinder.IResourceAccess resourceAccess, final IResourceDescriptions indexData, final CancelIndicator cancelIndicator) {
final LinkedList<SymbolInformation> result = CollectionLiterals.<SymbolInformation>newLinkedList();
Iterable<IResourceDescription> _allResourceDescriptions = indexData.getAllResourceDescriptions();
for (final IResourceDescription resourceDescription : _allResourceDescriptions) {
{
this.operationCanceledManager.checkCanceled(cancelIndicator);
final IResourceServiceProvider resourceServiceProvider = this._registry.getResourceServiceProvider(resourceDescription.getURI());
DocumentSymbolService _get = null;
if (resourceServiceProvider!=null) {
_get=resourceServiceProvider.<DocumentSymbolService>get(DocumentSymbolService.class);
}
final DocumentSymbolService documentSymbolService = _get;
if ((documentSymbolService != null)) {
List<? extends SymbolInformation> _symbols = documentSymbolService.getSymbols(resourceDescription, query, resourceAccess, cancelIndicator);
Iterables.<SymbolInformation>addAll(result, _symbols);
}
}
}
return result;
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:21,代码来源:WorkspaceSymbolService.java
示例7: getContainer
import org.eclipse.xtext.resource.IResourceDescriptions; //导入依赖的package包/类
@Override
public IContainer getContainer(IResourceDescription desc, IResourceDescriptions resourceDescriptions) {
if (delegate.shouldUseProjectDescriptionBasedContainers(resourceDescriptions)) {
return delegate.getContainer(desc, resourceDescriptions);
}
String root = internalGetContainerHandle(desc, resourceDescriptions);
if (root == null) {
if (log.isDebugEnabled())
log.debug("Cannot find IContainer for: " + desc.getURI());
return IContainer.NULL_CONTAINER;
}
IContainer result = createContainer(root, resourceDescriptions);
if (!result.hasResourceDescription(desc.getURI())) {
// desc has not been saved -> merge containers
result = new DescriptionAddingContainer(desc, result);
}
return result;
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:19,代码来源:StateBasedContainerManager.java
示例8: getVisibleContainers
import org.eclipse.xtext.resource.IResourceDescriptions; //导入依赖的package包/类
@Override
public List<IContainer> getVisibleContainers(IResourceDescription desc, IResourceDescriptions resourceDescriptions) {
if (delegate.shouldUseProjectDescriptionBasedContainers(resourceDescriptions)) {
return delegate.getVisibleContainers(desc, resourceDescriptions);
}
String root = internalGetContainerHandle(desc, resourceDescriptions);
if (root == null) {
if (log.isDebugEnabled())
log.debug("Cannot find IContainer for: " + desc.getURI());
return Collections.emptyList();
}
List<String> handles = getState(resourceDescriptions).getVisibleContainerHandles(root);
List<IContainer> result = getVisibleContainers(handles, resourceDescriptions);
if (!result.isEmpty()) {
IContainer first = result.get(0);
if (!first.hasResourceDescription(desc.getURI())) {
first = new DescriptionAddingContainer(desc, first);
result.set(0, first);
}
}
return result;
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:23,代码来源:StateBasedContainerManager.java
示例9: getContainer
import org.eclipse.xtext.resource.IResourceDescriptions; //导入依赖的package包/类
@Override
public IContainer getContainer(IResourceDescription desc, IResourceDescriptions resourceDescriptions) {
if (delegate.shouldUseProjectDescriptionBasedContainers(resourceDescriptions)) {
return delegate.getContainer(desc, resourceDescriptions);
}
ResourceDescriptionsBasedContainer result = new ResourceDescriptionsBasedContainer(resourceDescriptions) {
// this used to be the default implementation, which is wrong.
// we fixed the orginal and moved the wrong impl here since old clients might see much worse performance with the new impl.
@Override
public boolean hasResourceDescription(URI uri) {
return true;
}
};
result.setUriToDescriptionCacheEnabled(false);
return result;
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:17,代码来源:SimpleResourceDescriptionsBasedContainerManager.java
示例10: CacheInvalidator
import org.eclipse.xtext.resource.IResourceDescriptions; //导入依赖的package包/类
CacheInvalidator(final IResourceDescriptions resourceDescriptions, final String handle, final IContainerState containerState) {
this.resourceDescriptions = resourceDescriptions;
this.handle = handle;
this.containerState = containerState;
if (resourceDescriptions instanceof IResourceDescription.Event.Source) {
((IResourceDescription.Event.Source) resourceDescriptions).addListener(this);
}
}
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:9,代码来源:CachingStateBasedContainerManager.java
示例11: doFindReferencesWith
import org.eclipse.xtext.resource.IResourceDescriptions; //导入依赖的package包/类
protected void doFindReferencesWith(final IReferenceFinder referenceFinder, final TargetURIs targetURIs, final URI candidate,
IResourceAccess resourceAccess, IResourceDescriptions descriptions, final Acceptor acceptor,
final IProgressMonitor monitor) {
IResourceDescription resourceDescription = null;
if (!targetURIs.getTargetResourceURIs().contains(candidate) && (resourceDescription = descriptions.getResourceDescription(candidate)) != null) {
referenceFinder.findReferences(targetURIs, resourceDescription, resourceAccess, acceptor, monitor);
} else if (resourceAccess != null) {
resourceAccess.readOnly(candidate, new IUnitOfWork.Void<ResourceSet>() {
@Override
public void process(final ResourceSet state) throws Exception {
Resource resource = state.getResource(candidate, false);
if (resource != null) {
referenceFinder.findReferences(targetURIs, resource, acceptor, monitor);
}
}
});
}
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:19,代码来源:ReferenceFinder.java
示例12: getVisibleContainers
import org.eclipse.xtext.resource.IResourceDescriptions; //导入依赖的package包/类
protected List<IContainer> getVisibleContainers(Resource resource) {
IResourceDescription description = descriptionManager.getResourceDescription(resource);
IResourceDescriptions resourceDescriptions = getResourceDescriptions(resource);
String cacheKey = getCacheKey("VisibleContainers", resource.getResourceSet());
OnChangeEvictingCache.CacheAdapter cache = new OnChangeEvictingCache().getOrCreate(resource);
List<IContainer> result = null;
result = cache.get(cacheKey);
if (result == null) {
result = containerManager.getVisibleContainers(description, resourceDescriptions);
// SZ: I'ld like this dependency to be moved to the implementation of the
// container manager, but it is not aware of a CacheAdapter
if (resourceDescriptions instanceof IResourceDescription.Event.Source) {
IResourceDescription.Event.Source eventSource = (Source) resourceDescriptions;
DelegatingEventSource delegatingEventSource = new DelegatingEventSource(eventSource);
delegatingEventSource.addListeners(Lists.newArrayList(Iterables.filter(result, IResourceDescription.Event.Listener.class)));
delegatingEventSource.initialize();
cache.addCacheListener(delegatingEventSource);
}
cache.set(cacheKey, result);
}
return result;
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:23,代码来源:DefaultGlobalScopeProvider.java
示例13: createContainer
import org.eclipse.xtext.resource.IResourceDescriptions; //导入依赖的package包/类
protected IContainer createContainer(final IResourceDescriptions resourceDescriptions, final ChunkedResourceDescriptions chunkedResourceDescriptions, final String projectName) {
IContainer _xifexpression = null;
if ((resourceDescriptions instanceof LiveShadowedChunkedResourceDescriptions)) {
_xifexpression = new LiveShadowedChunkedContainer(((LiveShadowedChunkedResourceDescriptions)resourceDescriptions), projectName);
} else {
ResourceDescriptionsData _elvis = null;
ResourceDescriptionsData _container = chunkedResourceDescriptions.getContainer(projectName);
if (_container != null) {
_elvis = _container;
} else {
Set<IResourceDescription> _emptySet = CollectionLiterals.<IResourceDescription>emptySet();
ResourceDescriptionsData _resourceDescriptionsData = new ResourceDescriptionsData(_emptySet);
_elvis = _resourceDescriptionsData;
}
_xifexpression = new ResourceDescriptionsBasedContainer(_elvis);
}
return _xifexpression;
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:19,代码来源:ProjectDescriptionBasedContainerManager.java
示例14: getPortableURIFragment
import org.eclipse.xtext.resource.IResourceDescriptions; //导入依赖的package包/类
/**
* @return a portable URI fragment, or <code>null</code> if the give EObject isn't itself or is not contained in an exported EObjectDescription
*/
protected String getPortableURIFragment(final EObject obj) {
final IResourceDescriptions descriptions = this.resourceDescriptionsProvider.getResourceDescriptions(obj.eResource());
final IResourceDescription desc = descriptions.getResourceDescription(obj.eResource().getURI());
if ((desc == null)) {
return null;
}
final Function1<IEObjectDescription, Boolean> _function = (IEObjectDescription it) -> {
boolean _xblockexpression = false;
{
final EObject possibleContainer = EcoreUtil.resolve(it.getEObjectOrProxy(), obj.eResource());
_xblockexpression = (Objects.equal(obj, possibleContainer) || EcoreUtil.isAncestor(obj, possibleContainer));
}
return Boolean.valueOf(_xblockexpression);
};
final IEObjectDescription containerDesc = IterableExtensions.<IEObjectDescription>findFirst(desc.getExportedObjects(), _function);
if ((containerDesc != null)) {
final PortableURIs.PortableFragmentDescription fragmentDescription = this.createPortableFragmentDescription(containerDesc, obj);
return this.toFragmentString(fragmentDescription);
}
return null;
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:25,代码来源:PortableURIs.java
示例15: setContext
import org.eclipse.xtext.resource.IResourceDescriptions; //导入依赖的package包/类
@Override
public void setContext(final Notifier ctx) {
IResourceDescriptions _localDescriptions = this.getLocalDescriptions();
final Procedure1<ResourceSetBasedResourceDescriptions> _function = (ResourceSetBasedResourceDescriptions it) -> {
it.setContext(ctx);
it.setData(null);
};
ObjectExtensions.<ResourceSetBasedResourceDescriptions>operator_doubleArrow(((ResourceSetBasedResourceDescriptions) _localDescriptions), _function);
final ResourceSet resourceSet = EcoreUtil2.getResourceSet(ctx);
this.setGlobalDescriptions(ChunkedResourceDescriptions.findInEmfObject(resourceSet));
IProjectConfig _projectConfig = null;
if (this.projectConfigProvider!=null) {
_projectConfig=this.projectConfigProvider.getProjectConfig(resourceSet);
}
IWorkspaceConfig _workspaceConfig = null;
if (_projectConfig!=null) {
_workspaceConfig=_projectConfig.getWorkspaceConfig();
}
this.workspaceConfig = _workspaceConfig;
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:21,代码来源:LiveShadowedChunkedResourceDescriptions.java
示例16: assertXtextIndexIsValidInternal
import org.eclipse.xtext.resource.IResourceDescriptions; //导入依赖的package包/类
private void assertXtextIndexIsValidInternal() {
final IResourceDescriptions index = getXtextIndex();
final StringBuilder sb = new StringBuilder();
for (IResourceDescription desc : index.getAllResourceDescriptions()) {
if (desc instanceof ResourceDescriptionWithoutModuleUserData) {
sb.append("\n");
sb.append(IResourceDescription.class.getSimpleName());
sb.append(" in index must not be an instance of ");
sb.append(ResourceDescriptionWithoutModuleUserData.class.getSimpleName());
sb.append(" but it was. URI: ");
sb.append(desc.getURI());
}
}
assertTrue(sb.toString(), 0 == sb.length());
}
开发者ID:eclipse,项目名称:n4js,代码行数:16,代码来源:AbstractBuilderTest.java
示例17: toString
import org.eclipse.xtext.resource.IResourceDescriptions; //导入依赖的package包/类
/***/
public static String toString(IResourceDescriptions index) {
StringBuffer buff = new StringBuffer();
for (IResourceDescription desc : index.getAllResourceDescriptions()) {
buff.append(EmfFormatter.objToStr(desc, new EStructuralFeature[0]));
}
return buff.toString();
}
开发者ID:eclipse,项目名称:n4js,代码行数:9,代码来源:BuilderUtil.java
示例18: indexContainsElement
import org.eclipse.xtext.resource.IResourceDescriptions; //导入依赖的package包/类
/***/
public static boolean indexContainsElement(final String fileUri, final String eObjectName) {
IResourceDescriptions descriptions = getBuilderState();
URI uri = URI.createURI("platform:/resource" + fileUri);
IResourceDescription description = descriptions.getResourceDescription(uri);
if (description != null) {
return description
.getExportedObjects(EcorePackage.Literals.EOBJECT, QualifiedName.create(eObjectName), false)
.iterator().hasNext();
}
return false;
}
开发者ID:eclipse,项目名称:n4js,代码行数:13,代码来源:BuilderUtil.java
示例19: loadModules
import org.eclipse.xtext.resource.IResourceDescriptions; //导入依赖的package包/类
private Map<URI, TModule> loadModules(final Iterable<URI> moduleUris, final IResourceDescriptions index,
final ResourceSet resSet) {
final Map<URI, TModule> uri2Modules = newHashMap();
for (final URI moduleUri : moduleUris) {
final IResourceDescription resDesc = index.getResourceDescription(moduleUri);
uri2Modules.put(moduleUri, n4jsCore.loadModuleFromIndex(resSet, resDesc, false));
}
return uri2Modules;
}
开发者ID:eclipse,项目名称:n4js,代码行数:11,代码来源:TestDiscoveryHelper.java
示例20: createComparison
import org.eclipse.xtext.resource.IResourceDescriptions; //导入依赖的package包/类
/**
* First step in comparing API and implementation projects. This method will collect all API projects, the types
* declared there and their members and relate them to the corresponding types and members in all available
* implementation projects.
* <p>
* The second step of comparison is to compare an individual type/member to a corresponding type/member of a
* particular implementation via method {@link #compareApiImpl(ProjectComparisonEntry, int)}.
* <p>
* Usually, this second step is performed lazily when method <code>#compareApiImpl()</code> is invoked; however, by
* setting <code>fullCompare</code> to <code>true</code>, this is performed up-front here causing all results to be
* stored in a cache in the entries, and then subsequent calls to <code>#compareApiImpl()</code> will just read from
* that cache.
* <p>
* Returns <code>null</code> in case of error and adds human-readable error messages to the given list.
*/
public ProjectComparison createComparison(boolean fullCompare, List<String> addErrorMessagesHere) {
final ResourceSet resourceSet = n4jsCore.createResourceSet(Optional.absent());
final IResourceDescriptions index = n4jsCore.getXtextIndex(resourceSet);
final ApiImplMapping mapping = ApiImplMapping.of(n4jsCore);
if (mapping.hasErrors()) {
if (addErrorMessagesHere != null)
addErrorMessagesHere.addAll(mapping.getErrorMessages());
return null;
}
final List<String> allImplIds = mapping.getAllImplIds();
final int implCount = allImplIds.size();
final ProjectComparison root = new ProjectComparison(allImplIds.toArray(new String[implCount]));
for (String currApiId : mapping.getApiIds()) {
final IN4JSProject currApi = mapping.getApi(currApiId);
final IN4JSProject[] currImpls = new IN4JSProject[implCount];
for (int idx = 0; idx < implCount; idx++) {
final String currImplId = allImplIds.get(idx);
currImpls[idx] = mapping.getImpl(currApiId, currImplId);
}
createEntries(root, currApi, currImpls, resourceSet, index);
}
// compare all implementations in all entries and store in cache (if requested)
if (fullCompare) {
root.getAllEntries().forEach(currE -> {
for (int implIdx = 0; implIdx < implCount; implIdx++)
compareApiImpl(currE, implIdx);
});
}
return root;
}
开发者ID:eclipse,项目名称:n4js,代码行数:52,代码来源:ProjectCompareHelper.java
注:本文中的org.eclipse.xtext.resource.IResourceDescriptions类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论