当前位置: 首页>>代码示例>>Java>>正文


Java IResourceDescriptions类代码示例

本文整理汇总了Java中org.eclipse.xtext.resource.IResourceDescriptions的典型用法代码示例。如果您正苦于以下问题:Java IResourceDescriptions类的具体用法?Java IResourceDescriptions怎么用?Java IResourceDescriptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IResourceDescriptions类属于org.eclipse.xtext.resource包,在下文中一共展示了IResourceDescriptions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的org.eclipse.xtext.resource.IResourceDescriptions类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。