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


Java IResourceDescription.getExportedObjects方法代码示例

本文整理汇总了Java中org.eclipse.xtext.resource.IResourceDescription.getExportedObjects方法的典型用法代码示例。如果您正苦于以下问题:Java IResourceDescription.getExportedObjects方法的具体用法?Java IResourceDescription.getExportedObjects怎么用?Java IResourceDescription.getExportedObjects使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.xtext.resource.IResourceDescription的用法示例。


在下文中一共展示了IResourceDescription.getExportedObjects方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: registerDescription

import org.eclipse.xtext.resource.IResourceDescription; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected void registerDescription(final IResourceDescription description,
		final Map<QualifiedName, Object> target) {

	for (final IEObjectDescription object : description.getExportedObjects()) {
		final QualifiedName lowerCase = object.getName().toLowerCase();
		final Object existing = target.put(lowerCase, description);
		if (existing != null && existing != description) {
			Set<IResourceDescription> set = null;
			if (existing instanceof IResourceDescription) {
				// The linked hash set is the difference comparing to the super class.
				set = Sets.newLinkedHashSetWithExpectedSize(2);
				set.add((IResourceDescription) existing);
			} else {
				set = (Set<IResourceDescription>) existing;
			}
			set.add(description);
			target.put(lowerCase, set);
		}
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:23,代码来源:OrderedResourceDescriptionsData.java

示例2: getJavaStubSource

import org.eclipse.xtext.resource.IResourceDescription; //导入方法依赖的package包/类
public String getJavaStubSource(IEObjectDescription description, IResourceDescription resourceDescription) {
	if(isNestedType(description) || !isJvmDeclaredType(description)) {
		return null;
	}
	Multimap<QualifiedName, IEObjectDescription> owner2nested = LinkedHashMultimap.create();
	for(IEObjectDescription other: resourceDescription.getExportedObjects()) {
		if(isJvmDeclaredType(other) && isNestedType(other))
			owner2nested.put(getOwnerClassName(other.getQualifiedName()), other);
	}
	StringBuilder classSignatureBuilder = new StringBuilder();
	QualifiedName qualifiedName = description.getQualifiedName();
	if (qualifiedName.getSegments().size() > 1) {
		String string = qualifiedName.toString();
		classSignatureBuilder.append("package " + string.substring(0, string.lastIndexOf('.')) + ";");
	}
	appendType(description, owner2nested, classSignatureBuilder);
	return classSignatureBuilder.toString();
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:19,代码来源:EObjectDescriptionBasedStubGenerator.java

示例3: testPerformance

import org.eclipse.xtext.resource.IResourceDescription; //导入方法依赖的package包/类
@Test public void testPerformance() throws Exception {
		GenericResourceDescriptionManager manager = getEmfResourceDescriptionsManager();
		Collection<String> uris = ImmutableList.copyOf(EPackage.Registry.INSTANCE.keySet());
		for(String uri: uris) {
			EPackage pack = EPackage.Registry.INSTANCE.getEPackage(uri);
			IResourceDescription description = manager.getResourceDescription(pack.eResource());
			assertNotNull(description);
			for(int i = 0; i < 10; i++) {
				Iterator<EObject> iter = EcoreUtil.getAllProperContents(pack, true);
				while(iter.hasNext()) {
					EObject next = iter.next();
					if (next instanceof ENamedElement) {
						String name = ((ENamedElement) next).getName();
//						Iterable<IEObjectDescription> objects = 
						description.getExportedObjects(EcorePackage.Literals.EOBJECT, QualifiedName.create(name), false);
//						assertFalse(name + " - " + uri + " - " + next, Iterables.isEmpty(objects));
					}
				}
			}
		}
	}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:22,代码来源:EcoreResourceDescriptionManagerTest.java

示例4: removeDescription

import org.eclipse.xtext.resource.IResourceDescription; //导入方法依赖的package包/类
public void removeDescription(URI uri) {
	IResourceDescription oldDescription = resourceDescriptionMap.remove(uri);
	if (oldDescription != null) {
		for(IEObjectDescription object: oldDescription.getExportedObjects()) {
			QualifiedName objectName = object.getName().toLowerCase();
			Object existing = lookupMap.get(objectName);
			if (existing == oldDescription) {
				lookupMap.remove(objectName);
			} else if (existing instanceof Set<?>) {
				Set<?> casted = (Set<?>) existing;
				if (casted.remove(oldDescription)) {
					if (casted.size() == 1) {
						lookupMap.put(objectName, casted.iterator().next());
					} else if (casted.isEmpty()) {
						lookupMap.remove(objectName);
					}
				}
			}
		}
	}
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:22,代码来源:ResourceDescriptionsData.java

示例5: registerDescription

import org.eclipse.xtext.resource.IResourceDescription; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
protected void registerDescription(IResourceDescription description, Map<QualifiedName, Object> target) {
	for(IEObjectDescription object: description.getExportedObjects()) {
		QualifiedName lowerCase = object.getName().toLowerCase();
		Object existing = target.put(lowerCase, description);
		if (existing != null && existing != description) {
			Set<IResourceDescription> set = null;
			if (existing instanceof IResourceDescription) {
				set = Sets.newLinkedHashSetWithExpectedSize(2);
				set.add((IResourceDescription)existing);
			} else {
				set = (Set<IResourceDescription>) existing;
			}
			set.add(description);
			target.put(lowerCase, set);
		}
	}
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:19,代码来源:ResourceDescriptionsData.java

示例6: getSymbols

import org.eclipse.xtext.resource.IResourceDescription; //导入方法依赖的package包/类
public List<? extends SymbolInformation> getSymbols(final IResourceDescription resourceDescription, final String query, final IReferenceFinder.IResourceAccess resourceAccess, final CancelIndicator cancelIndicator) {
  final LinkedList<SymbolInformation> symbols = CollectionLiterals.<SymbolInformation>newLinkedList();
  Iterable<IEObjectDescription> _exportedObjects = resourceDescription.getExportedObjects();
  for (final IEObjectDescription description : _exportedObjects) {
    {
      this.operationCanceledManager.checkCanceled(cancelIndicator);
      boolean _filter = this.filter(description, query);
      if (_filter) {
        final Procedure1<SymbolInformation> _function = (SymbolInformation symbol) -> {
          symbols.add(symbol);
        };
        this.createSymbol(description, resourceAccess, _function);
      }
    }
  }
  return symbols;
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:18,代码来源:DocumentSymbolService.java

示例7: addExportedNames

import org.eclipse.xtext.resource.IResourceDescription; //导入方法依赖的package包/类
@Override
protected void addExportedNames(Set<QualifiedName> names, IResourceDescription resourceDescriptor) {
	if (resourceDescriptor == null)
		return;
	Iterable<IEObjectDescription> iterable = resourceDescriptor.getExportedObjects();
	for (IEObjectDescription ieObjectDescription : iterable) {
		names.add(ieObjectDescription.getName());
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:10,代码来源:N4JSResourceDescriptionManager.java

示例8: isAffected

import org.eclipse.xtext.resource.IResourceDescription; //导入方法依赖的package包/类
/**
 * Overrides super implementation to replace case insensitive comparison logic by case sensitive comparison of
 * names.
 * <p>
 * It returns true, if there is a dependency (i.e. name imported by a candidate) to any name exported by the
 * description from a delta. That is, it computes if a candidate (with given importedNames) is affected by a change
 * represented by the description from the delta.
 */
@Override
protected boolean isAffected(Collection<QualifiedName> namesImportedByCandidate,
		IResourceDescription descriptionFromDelta) {
	if (descriptionFromDelta != null) {
		for (IEObjectDescription desc : descriptionFromDelta.getExportedObjects())
			if (namesImportedByCandidate.contains(desc.getName()))
				return true;
	}
	return false;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:19,代码来源:N4JSResourceDescriptionManager.java

示例9: isAffected

import org.eclipse.xtext.resource.IResourceDescription; //导入方法依赖的package包/类
protected boolean isAffected(final Collection<QualifiedName> importedNames, final IResourceDescription description) {
  if ((description != null)) {
    Iterable<IEObjectDescription> _exportedObjects = description.getExportedObjects();
    for (final IEObjectDescription desc : _exportedObjects) {
      boolean _contains = importedNames.contains(desc.getName().toLowerCase());
      if (_contains) {
        return true;
      }
    }
  }
  return false;
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:13,代码来源:JavaResourceDescriptionManager.java

示例10: doGenerateStubs

import org.eclipse.xtext.resource.IResourceDescription; //导入方法依赖的package包/类
@Override
public void doGenerateStubs(IFileSystemAccess access, IResourceDescription description) {
	for (IEObjectDescription objectDesc : description.getExportedObjects()) {
		String javaStubSource = getJavaStubSource(objectDesc, description);
		if(javaStubSource != null) {
			String javaFileName = getJavaFileName(objectDesc);
			access.generateFile(javaFileName, javaStubSource);
		}
	}
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:11,代码来源:EObjectDescriptionBasedStubGenerator.java

示例11: createIndex

import org.eclipse.xtext.resource.IResourceDescription; //导入方法依赖的package包/类
protected Map<QualifiedName, IEObjectDescription> createIndex(Resource ecoreResoure) {
	GenericResourceDescriptionManager underTest = getEmfResourceDescriptionsManager();
	IResourceDescription description = underTest.getResourceDescription(ecoreResoure);
	
	Map<QualifiedName,IEObjectDescription> index = Maps.newHashMap();
	for (IEObjectDescription ieObjectDescription : description.getExportedObjects()) {
		index.put(ieObjectDescription.getName(), ieObjectDescription);
	}
	return index;
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:11,代码来源:EcoreResourceDescriptionManagerTest.java

示例12: doCheckUniqueNames

import org.eclipse.xtext.resource.IResourceDescription; //导入方法依赖的package包/类
public void doCheckUniqueNames(Resource resource, CancelIndicator cancelIndicator) {
	final IResourceServiceProvider resourceServiceProvider = resourceServiceProviderRegistry.getResourceServiceProvider(resource.getURI());
	if (resourceServiceProvider==null)
		return;
	IResourceDescription.Manager manager = resourceServiceProvider.getResourceDescriptionManager();
	if (manager != null) {
		IResourceDescription description = manager.getResourceDescription(resource);
		if (description != null) {
			Iterable<IEObjectDescription> descriptions = description.getExportedObjects();
			helper.checkUniqueNames(descriptions, cancelIndicator, this);
		}
	}
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:14,代码来源:NamesAreUniqueValidator.java

示例13: addExportedNames

import org.eclipse.xtext.resource.IResourceDescription; //导入方法依赖的package包/类
protected void addExportedNames(Set<QualifiedName> names, IResourceDescription resourceDescriptor) {
	if (resourceDescriptor==null)
		return;
	Iterable<IEObjectDescription> iterable = resourceDescriptor.getExportedObjects();
	for (IEObjectDescription ieObjectDescription : iterable) {
		names.add(ieObjectDescription.getName().toLowerCase());
	}
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:9,代码来源:DefaultResourceDescriptionManager.java

示例14: isAffected

import org.eclipse.xtext.resource.IResourceDescription; //导入方法依赖的package包/类
protected boolean isAffected(Collection<QualifiedName> importedNames, IResourceDescription description) {
	if (description != null) {
	    for (IEObjectDescription desc : description.getExportedObjects())
	        if (importedNames.contains(desc.getName().toLowerCase()))
	            return true;
	}
	return false;
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:9,代码来源:DefaultResourceDescriptionManager.java

示例15: findEObjectsOfType

import org.eclipse.xtext.resource.IResourceDescription; //导入方法依赖的package包/类
protected List<EObject> findEObjectsOfType(Set<EClass> eClasses, IResourceDescriptions resourceDescriptions,
		ResourceSet resourceSet) {
	List<EObject> elements = Lists.newArrayList();
	Iterable<IResourceDescription> descriptions = resourceDescriptions.getAllResourceDescriptions();
	for (IResourceDescription resDesc : descriptions) {
		Iterable<IEObjectDescription> objects = resDesc.getExportedObjects();
		for (IEObjectDescription description : objects) {
			if (matches(eClasses, description))
				elements.add(resourceSet.getEObject(description.getEObjectURI(), true));
		}
	}
	return elements;
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:14,代码来源:SlotEntry.java


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