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


Java XtextResourceSet.getResources方法代码示例

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


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

示例1: testResourcesAreInMap_03

import org.eclipse.xtext.resource.XtextResourceSet; //导入方法依赖的package包/类
@Test
public void testResourcesAreInMap_03() {
  final XtextResourceSet rs = this.createEmptyResourceSet();
  Assert.assertEquals(0, rs.getURIResourceMap().size());
  final XtextResource resource = new XtextResource();
  EList<Resource> _resources = rs.getResources();
  _resources.add(resource);
  Assert.assertEquals(1, rs.getURIResourceMap().size());
  Assert.assertEquals(resource, rs.getURIResourceMap().get(null));
  resource.setURI(URI.createFileURI(new File("foo").getAbsolutePath()));
  Assert.assertEquals(1, rs.getURIResourceMap().size());
  Assert.assertFalse(rs.getURIResourceMap().containsKey(null));
  Assert.assertEquals(resource, rs.getURIResourceMap().get(resource.getURI()));
  Assert.assertEquals(resource, rs.getURIResourceMap().get(rs.getURIConverter().normalize(resource.getURI())));
  resource.setURI(URI.createFileURI(new File("bar").getAbsolutePath()));
  Assert.assertEquals(1, rs.getURIResourceMap().size());
  Assert.assertFalse(rs.getURIResourceMap().containsKey(null));
  Assert.assertEquals(resource, rs.getURIResourceMap().get(resource.getURI()));
  Assert.assertEquals(resource, rs.getURIResourceMap().get(rs.getURIConverter().normalize(resource.getURI())));
  resource.setURI(null);
  Assert.assertEquals(1, rs.getURIResourceMap().size());
  Assert.assertEquals(resource, rs.getURIResourceMap().get(null));
  rs.getResources().remove(resource);
  Assert.assertTrue(resource.eAdapters().isEmpty());
  Assert.assertEquals(0, rs.getURIResourceMap().size());
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:27,代码来源:AbstractXtextResourceSetTest.java

示例2: testResourcesAreInMap

import org.eclipse.xtext.resource.XtextResourceSet; //导入方法依赖的package包/类
@Test
public void testResourcesAreInMap() {
  final XtextResourceSet rs = this.createEmptyResourceSet();
  Assert.assertEquals(0, rs.getURIResourceMap().size());
  final XtextResource resource = new XtextResource();
  resource.setURI(URI.createFileURI(new File("foo").getAbsolutePath()));
  EList<Resource> _resources = rs.getResources();
  _resources.add(resource);
  Assert.assertEquals(1, rs.getURIResourceMap().size());
  rs.getResources().remove(resource);
  Assert.assertTrue(resource.eAdapters().isEmpty());
  Assert.assertEquals(0, rs.getURIResourceMap().size());
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:14,代码来源:AbstractXtextResourceSetTest.java

示例3: testResourcesAreInMap_02

import org.eclipse.xtext.resource.XtextResourceSet; //导入方法依赖的package包/类
@Test
public void testResourcesAreInMap_02() {
  final XtextResourceSet rs = this.createEmptyResourceSet();
  Assert.assertEquals(0, rs.getURIResourceMap().size());
  final XtextResource resource = new XtextResource();
  resource.setURI(URI.createFileURI(new File("foo").getAbsolutePath()));
  EList<Resource> _resources = rs.getResources();
  ArrayList<Resource> _newArrayList = CollectionLiterals.<Resource>newArrayList(resource);
  Iterables.<Resource>addAll(_resources, _newArrayList);
  Assert.assertEquals(1, rs.getURIResourceMap().size());
  rs.getResources().remove(resource);
  Assert.assertTrue(resource.eAdapters().isEmpty());
  Assert.assertEquals(0, rs.getURIResourceMap().size());
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:15,代码来源:AbstractXtextResourceSetTest.java

示例4: testResourcesAreCleared_01

import org.eclipse.xtext.resource.XtextResourceSet; //导入方法依赖的package包/类
@Test
public void testResourcesAreCleared_01() {
  final XtextResourceSet rs = this.createEmptyResourceSet();
  Assert.assertEquals(0, rs.getURIResourceMap().size());
  final XtextResource resource = new XtextResource();
  resource.setURI(URI.createFileURI(new File("foo").getAbsolutePath()));
  EList<Resource> _resources = rs.getResources();
  ArrayList<Resource> _newArrayList = CollectionLiterals.<Resource>newArrayList(resource);
  Iterables.<Resource>addAll(_resources, _newArrayList);
  Assert.assertEquals(1, rs.getURIResourceMap().size());
  rs.getResources().clear();
  Assert.assertTrue(resource.eAdapters().isEmpty());
  Assert.assertEquals(0, rs.getURIResourceMap().size());
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:15,代码来源:AbstractXtextResourceSetTest.java

示例5: testResourcesAreClearedWithDeliverFalse_01

import org.eclipse.xtext.resource.XtextResourceSet; //导入方法依赖的package包/类
@Test
public void testResourcesAreClearedWithDeliverFalse_01() {
  final XtextResourceSet rs = this.createEmptyResourceSet();
  Assert.assertEquals(0, rs.getURIResourceMap().size());
  final XtextResource resource = new XtextResource();
  resource.setURI(URI.createFileURI(new File("foo").getAbsolutePath()));
  EList<Resource> _resources = rs.getResources();
  ArrayList<Resource> _newArrayList = CollectionLiterals.<Resource>newArrayList(resource);
  Iterables.<Resource>addAll(_resources, _newArrayList);
  Assert.assertEquals(1, rs.getURIResourceMap().size());
  rs.eSetDeliver(false);
  rs.getResources().clear();
  Assert.assertTrue(resource.eAdapters().isEmpty());
  Assert.assertEquals(0, rs.getURIResourceMap().size());
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:16,代码来源:AbstractXtextResourceSetTest.java

示例6: testResourcesAreInMapWithNormalizedURI_01

import org.eclipse.xtext.resource.XtextResourceSet; //导入方法依赖的package包/类
@Test
public void testResourcesAreInMapWithNormalizedURI_01() {
  final XtextResourceSet rs = this.createEmptyResourceSet();
  Assert.assertEquals(0, rs.getURIResourceMap().size());
  final XtextResource resource = new XtextResource();
  resource.setURI(URI.createURI("/a/../foo"));
  EList<Resource> _resources = rs.getResources();
  _resources.add(resource);
  Assert.assertEquals(2, rs.getURIResourceMap().size());
  rs.getResources().remove(resource);
  Assert.assertTrue(resource.eAdapters().isEmpty());
  Assert.assertEquals(0, rs.getURIResourceMap().size());
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:14,代码来源:AbstractXtextResourceSetTest.java

示例7: testResourcesAreInMapWithNormalizedURI_02

import org.eclipse.xtext.resource.XtextResourceSet; //导入方法依赖的package包/类
@Test
public void testResourcesAreInMapWithNormalizedURI_02() {
  final XtextResourceSet rs = this.createEmptyResourceSet();
  Assert.assertEquals(0, rs.getURIResourceMap().size());
  final XtextResource resource = new XtextResource();
  resource.setURI(URI.createURI("/a/../foo"));
  EList<Resource> _resources = rs.getResources();
  ArrayList<Resource> _newArrayList = CollectionLiterals.<Resource>newArrayList(resource);
  Iterables.<Resource>addAll(_resources, _newArrayList);
  Assert.assertEquals(2, rs.getURIResourceMap().size());
  rs.getResources().remove(resource);
  Assert.assertTrue(resource.eAdapters().isEmpty());
  Assert.assertEquals(0, rs.getURIResourceMap().size());
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:15,代码来源:AbstractXtextResourceSetTest.java

示例8: testResourcesAreInMapWithNormalizedURI_03

import org.eclipse.xtext.resource.XtextResourceSet; //导入方法依赖的package包/类
@Test
public void testResourcesAreInMapWithNormalizedURI_03() {
  final XtextResourceSet rs = this.createEmptyResourceSet();
  Assert.assertEquals(0, rs.getURIResourceMap().size());
  final XtextResource resource = new XtextResource();
  EList<Resource> _resources = rs.getResources();
  _resources.add(resource);
  Assert.assertEquals(1, rs.getURIResourceMap().size());
  Assert.assertEquals(resource, rs.getURIResourceMap().get(null));
  Assert.assertEquals(0, rs.getNormalizationMap().size());
  resource.setURI(URI.createURI("/a/../foo"));
  Assert.assertEquals(2, rs.getURIResourceMap().size());
  Assert.assertFalse(rs.getURIResourceMap().containsKey(null));
  Assert.assertEquals(resource, rs.getURIResourceMap().get(resource.getURI()));
  Assert.assertEquals(resource, rs.getURIResourceMap().get(rs.getURIConverter().normalize(resource.getURI())));
  Assert.assertEquals(1, rs.getNormalizationMap().size());
  Assert.assertEquals(rs.getURIConverter().normalize(resource.getURI()), rs.getNormalizationMap().get(resource.getURI()));
  resource.setURI(URI.createURI("/a/../bar"));
  Assert.assertEquals(2, rs.getURIResourceMap().size());
  Assert.assertFalse(rs.getURIResourceMap().containsKey(null));
  Assert.assertEquals(resource, rs.getURIResourceMap().get(resource.getURI()));
  Assert.assertEquals(resource, rs.getURIResourceMap().get(rs.getURIConverter().normalize(resource.getURI())));
  Assert.assertEquals(1, rs.getNormalizationMap().size());
  Assert.assertEquals(rs.getURIConverter().normalize(resource.getURI()), rs.getNormalizationMap().get(resource.getURI()));
  resource.setURI(null);
  Assert.assertEquals(1, rs.getURIResourceMap().size());
  Assert.assertEquals(resource, rs.getURIResourceMap().get(null));
  Assert.assertEquals(0, rs.getNormalizationMap().size());
  rs.getResources().remove(resource);
  Assert.assertTrue(resource.eAdapters().isEmpty());
  Assert.assertEquals(0, rs.getURIResourceMap().size());
  Assert.assertEquals(0, rs.getNormalizationMap().size());
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:34,代码来源:AbstractXtextResourceSetTest.java

示例9: testResourcesAreClearedWithNormalizedURI_01

import org.eclipse.xtext.resource.XtextResourceSet; //导入方法依赖的package包/类
@Test
public void testResourcesAreClearedWithNormalizedURI_01() {
  final XtextResourceSet rs = this.createEmptyResourceSet();
  Assert.assertEquals(0, rs.getURIResourceMap().size());
  final XtextResource resource = new XtextResource();
  resource.setURI(URI.createURI("/a/../foo"));
  EList<Resource> _resources = rs.getResources();
  ArrayList<Resource> _newArrayList = CollectionLiterals.<Resource>newArrayList(resource);
  Iterables.<Resource>addAll(_resources, _newArrayList);
  Assert.assertEquals(2, rs.getURIResourceMap().size());
  rs.getResources().clear();
  Assert.assertTrue(resource.eAdapters().isEmpty());
  Assert.assertEquals(0, rs.getURIResourceMap().size());
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:15,代码来源:AbstractXtextResourceSetTest.java

示例10: testResourcesAreClearedWithDeliverFalseWithNormalizedURI_01

import org.eclipse.xtext.resource.XtextResourceSet; //导入方法依赖的package包/类
@Test
public void testResourcesAreClearedWithDeliverFalseWithNormalizedURI_01() {
  final XtextResourceSet rs = this.createEmptyResourceSet();
  Assert.assertEquals(0, rs.getURIResourceMap().size());
  final XtextResource resource = new XtextResource();
  resource.setURI(URI.createURI("//a/../foo"));
  EList<Resource> _resources = rs.getResources();
  ArrayList<Resource> _newArrayList = CollectionLiterals.<Resource>newArrayList(resource);
  Iterables.<Resource>addAll(_resources, _newArrayList);
  Assert.assertEquals(2, rs.getURIResourceMap().size());
  rs.eSetDeliver(false);
  rs.getResources().clear();
  Assert.assertTrue(resource.eAdapters().isEmpty());
  Assert.assertEquals(0, rs.getURIResourceMap().size());
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:16,代码来源:AbstractXtextResourceSetTest.java

示例11: assertResourceSet

import org.eclipse.xtext.resource.XtextResourceSet; //导入方法依赖的package包/类
/**
 * Assert that the resource set contains a specific number of resources, and that all resources in the list are also in the map.
 *
 * @param rs
 *          resource set to check.
 * @param expected
 *          number of resources.
 * @param inMap
 *          expected number of resources in the resource map
 */
private void assertResourceSet(final XtextResourceSet rs, final int expected, final int inMap) {
  assertTrue("Test wrong: must expect more than zero resources", expected > 0 && inMap > 0);
  assertEquals("ResourceSet should not grow", expected, rs.getResources().size());
  assertEquals("ResourceSet map size", inMap, rs.getURIResourceMap().size());
  for (Resource r : rs.getResources()) {
    URI uri = r.getURI();
    assertTrue(uri.toString() + " not found in ResourceSet map", rs.getURIResourceMap().containsKey(uri));
  }
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:20,代码来源:BugAig1314.java


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