• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java DefaultResourceDescription类的典型用法和代码示例

java 2次浏览

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

DefaultResourceDescription类属于org.eclipse.xtext.resource.impl包,在下文中一共展示了DefaultResourceDescription类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getResourceDescription

点赞 3

import org.eclipse.xtext.resource.impl.DefaultResourceDescription; //导入依赖的package包/类
@Override
public IResourceDescription getResourceDescription(final Resource resource) {
  if ((resource instanceof JavaResource)) {
    final boolean initialized = (((JavaResource)resource).isInitialized() || ((JavaResource)resource).isInitializing());
    try {
      if ((!initialized)) {
        ((JavaResource)resource).eSetDeliver(false);
        ((JavaResource)resource).installStubs();
      }
      final DefaultResourceDescription result = new DefaultResourceDescription(resource, this.descriptionStrategy, this.cache);
      if ((!initialized)) {
        final Consumer<IEObjectDescription> _function = (IEObjectDescription it) -> {
          it.getEObjectURI();
        };
        result.getExportedObjects().forEach(_function);
      }
      return result;
    } finally {
      if ((!initialized)) {
        ((JavaResource)resource).discardDerivedState();
        ((JavaResource)resource).eSetDeliver(true);
      }
    }
  }
  throw new IllegalArgumentException("Can only handle JavaResources");
}
 

开发者ID:eclipse,
项目名称:xtext-extras,
代码行数:27,
代码来源:JavaResourceDescriptionManager.java

示例2: setUp

点赞 3

import org.eclipse.xtext.resource.impl.DefaultResourceDescription; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
	EObject copy = EcoreUtil.copy(EcorePackage.eINSTANCE);
	resource = new ResourceImpl();
	resource.getContents().add(copy);
	IQualifiedNameProvider nameProvider = new IQualifiedNameProvider.AbstractImpl() {
		@Override
		public QualifiedName getFullyQualifiedName(EObject obj) {
			if (obj instanceof ENamedElement)
				return QualifiedName.create(((ENamedElement) obj).getName());
			return null;
		}
	};
	DefaultResourceDescriptionStrategy descriptionStrategy = new DefaultResourceDescriptionStrategy();
	descriptionStrategy.setQualifiedNameProvider(nameProvider);
	resourceDescription = new DefaultResourceDescription(resource, descriptionStrategy) {
		@Override
		public Iterable<QualifiedName> getImportedNames() {
			return importedNames;
		}
	};
	manager = new DefaultResourceDescriptionManager();
	importedNames = Collections.emptySet();
}
 

开发者ID:eclipse,
项目名称:xtext-core,
代码行数:25,
代码来源:DefaultResourceDescriptionManagerTest.java

示例3: setUp

点赞 2

import org.eclipse.xtext.resource.impl.DefaultResourceDescription; //导入依赖的package包/类
@Override
public void setUp() throws Exception {
	super.setUp();
	with(new IndexTestLanguageStandaloneSetup());

	globalScopeProvider = new ResourceSetGlobalScopeProvider();
	nameProvider = new DefaultDeclarativeQualifiedNameProvider();
	nameConverter = new IQualifiedNameConverter.DefaultImpl();
	final DefaultResourceDescriptionStrategy strategy = new DefaultResourceDescriptionStrategy();
	strategy.setQualifiedNameProvider(nameProvider);
	final DefaultResourceDescriptionManager resourceDescMnr = new DefaultResourceDescriptionManager() {
		@Override
		public IResourceDescription getResourceDescription(Resource resource) {
			DefaultResourceDescription resourceDescription = new DefaultResourceDescription(resource,
					strategy);
			return resourceDescription;
		}
		
	};
	final DefaultResourceServiceProvider provider = new DefaultResourceServiceProvider() {
		@Override
		public Manager getResourceDescriptionManager() {
			return resourceDescMnr;
		}
	};
	globalScopeProvider.setGlobalResourceDecriptionProvider(new GlobalResourceDescriptionProvider(new ResourceServiceProviderRegistryImpl() {
		@Override
		public IResourceServiceProvider getResourceServiceProvider(URI uri, String contentType) {
			return provider;
		}
	}));
	CaseInsensitivityHelper caseInsensitivityHelper = new CaseInsensitivityHelper();
	globalScopeProvider.setCaseInsensitivityHelper(caseInsensitivityHelper);
	scopeProvider = new ImportedNamespaceAwareLocalScopeProvider(globalScopeProvider, nameProvider, nameConverter, caseInsensitivityHelper);
}
 

开发者ID:eclipse,
项目名称:xtext-core,
代码行数:36,
代码来源:ImportedNamespaceAwareLocalScopeProviderTest.java

示例4: getContainersForHandlesAndResource

点赞 2

import org.eclipse.xtext.resource.impl.DefaultResourceDescription; //导入依赖的package包/类
/**
 * Returns the containers for the given handles, where one of the containers will also include {@code desc} when appropriate.
 * 
 * @param handles
 *          handles to get containers for, must not be {@code null}
 * @param desc
 *          description to add, must not be {@code null}
 * @param resourceDescriptions
 *          resource descriptions, must not be {@code null}
 * @return list of containers, never {@code null}
 */
protected List<IContainer> getContainersForHandlesAndResource(final List<String> handles, final IResourceDescription desc, final IResourceDescriptions resourceDescriptions) {
  List<IContainer> result = getVisibleContainers(handles, resourceDescriptions);
  if (!result.isEmpty()) {
    URI descURI = desc.getURI();
    for (int i = 0; i < result.size(); i++) {
      if (result.get(i).getResourceDescription(descURI) != null) {
        return result;
      }
    }
    // Do *not* add the context resource description itself if we're in the first phase of a build: 'desc' itself
    // may not be in any consistent state, and adding it to the containers may result in recursive invocations of
    // getEObjectDescriptions(), leading to a stack overflow since it may in turn invoke getVisibleContainers() again.
    if (desc instanceof DefaultResourceDescription) {
      DefaultResourceDescription d = (DefaultResourceDescription) desc;
      if (BuildPhases.isIndexing(d.getResource())) {
        return result;
      }
    }
    // the IResourceDescription was found nowhere, add it to the first one that matches the description's domain.
    IDomain descDomain = mapper.map(descURI);
    IContainer wrappedContainer = null;
    int index = 0;
    for (int i = 0; i < result.size(); i++) {
      IContainer container = result.get(i);
      IDomain containerDomain = mapper.map(container);
      if (containerDomain != null && containerDomain.equals(descDomain)) {
        wrappedContainer = new DescriptionAddingContainer(desc, container);
        result.set(index, wrappedContainer);
        return result;
      }
      index++;
    }
    // If we get here, we found no container with a matching domain. Add to the first, but use a DescriptionAddingContainer that
    // will add the description at the end.
    wrappedContainer = new DescriptionAtEndAddingContainer(desc, result.get(0));
    result.set(0, wrappedContainer);
  }
  return result;
}
 

开发者ID:dsldevkit,
项目名称:dsl-devkit,
代码行数:51,
代码来源:CachingStateBasedContainerManager.java

示例5: getResourceDescription

点赞 2

import org.eclipse.xtext.resource.impl.DefaultResourceDescription; //导入依赖的package包/类
@Override
public IResourceDescription getResourceDescription(Resource resource) {
	return new DefaultResourceDescription(resource, resourceDescriptionStrategy, cache);
}
 

开发者ID:eclipse,
项目名称:xtext-core,
代码行数:5,
代码来源:GenericResourceDescriptionManager.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)