當前位置: 首頁>>代碼示例>>Java>>正文


Java ResourceSetImpl.setURIConverter方法代碼示例

本文整理匯總了Java中org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.setURIConverter方法的典型用法代碼示例。如果您正苦於以下問題:Java ResourceSetImpl.setURIConverter方法的具體用法?Java ResourceSetImpl.setURIConverter怎麽用?Java ResourceSetImpl.setURIConverter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.emf.ecore.resource.impl.ResourceSetImpl的用法示例。


在下文中一共展示了ResourceSetImpl.setURIConverter方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testBug261630_duplicateImports

import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; //導入方法依賴的package包/類
/**
 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=261630
 */
@Test public void testBug261630_duplicateImports() throws Exception {
	SyntheticModelAwareURIConverter models = new SyntheticModelAwareURIConverter();
	ResourceSetImpl rs = new ResourceSetImpl();
	rs.setURIConverter(models);

	models.addModel("foo.importuritestlanguage", "import 'bar.importuritestlanguage' import 'bar.importuritestlanguage' import 'bar.importuritestlanguage' type foo extends bar type bar extends bar2");
	models.addModel("bar.importuritestlanguage", "type bar type bar2 extends bar");

	Resource resource = rs.getResource(URI.createURI("foo.importuritestlanguage"), true);
	Main main = (Main) resource.getContents().get(0);
	assertEquals("bar", main.getTypes().get(0).getExtends().getName());
	assertEquals("bar2", main.getTypes().get(0).getExtends().getExtends().getName());
	assertEquals("bar", main.getTypes().get(0).getExtends().getExtends().getExtends().getName());
	assertNull(main.getTypes().get(0).getExtends().getExtends().getExtends().getExtends());
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:19,代碼來源:SimpleNameScopeProviderTest.java

示例2: testGetAllContents

import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; //導入方法依賴的package包/類
@Test public void testGetAllContents() throws Exception {
	SyntheticModelAwareURIConverter models = new SyntheticModelAwareURIConverter();
	ResourceSetImpl rs = new ResourceSetImpl();
	rs.setURIConverter(models);

	models.addModel("foo.importuritestlanguage", "import 'bar.importuritestlanguage' type Foo");
	models.addModel("bar.importuritestlanguage", "type A type B type C");

	Resource resource = rs.getResource(URI.createURI("foo.importuritestlanguage"), true);
	
	IScope scope = getScopeProvider().getScope(((Main)resource.getContents().get(0)).getTypes().get(0), ImportedURIPackage.Literals.TYPE__EXTENDS);
	HashSet<IEObjectDescription> set = Sets.newHashSet(scope.getAllElements());
	assertEquals(4,set.size());
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:15,代碼來源:SimpleNameScopeProviderTest.java

示例3: testSimple

import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; //導入方法依賴的package包/類
@Test public void testSimple() throws Exception {
	SyntheticModelAwareURIConverter models = new SyntheticModelAwareURIConverter();
	ResourceSetImpl rs = new ResourceSetImpl();
	rs.setURIConverter(models);

	models.addModel("foo.importuritestlanguage", "import 'bar.importuritestlanguage' type foo extends bar");
	models.addModel("bar.importuritestlanguage", "type bar");

	Resource resource = rs.getResource(URI.createURI("foo.importuritestlanguage"), true);
	Main main = (Main) resource.getContents().get(0);
	assertEquals("bar", main.getTypes().get(0).getExtends().getName());
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:13,代碼來源:SimpleNameScopeProviderTest.java

示例4: testRelativeScope

import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; //導入方法依賴的package包/類
@Test public void testRelativeScope() throws Exception {
	SyntheticModelAwareURIConverter models = new SyntheticModelAwareURIConverter();
	ResourceSetImpl rs = new ResourceSetImpl();
	rs.setURIConverter(models);

	models.addModel("testfile://my/folder/foo.importuritestlanguage", "import 'bar.importuritestlanguage' type foo extends bar type bar extends bar2");
	models.addModel("testfile://my/folder/bar.importuritestlanguage", "type bar type bar2 extends bar");

	Resource resource = rs.getResource(URI.createURI("testfile://my/folder/foo.importuritestlanguage"), true);
	Main main = (Main) resource.getContents().get(0);
	assertEquals("bar", main.getTypes().get(0).getExtends().getName());
	assertEquals("bar2", main.getTypes().get(0).getExtends().getExtends().getName());
	assertEquals("bar", main.getTypes().get(0).getExtends().getExtends().getExtends().getName());
	assertNull(main.getTypes().get(0).getExtends().getExtends().getExtends().getExtends());
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:16,代碼來源:SimpleNameScopeProviderTest.java

示例5: testRelativeScopeWithPath

import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; //導入方法依賴的package包/類
@Test public void testRelativeScopeWithPath() throws Exception {
	SyntheticModelAwareURIConverter models = new SyntheticModelAwareURIConverter();
	ResourceSetImpl rs = new ResourceSetImpl();
	rs.setURIConverter(models);
	models.addModel("testfile://my/folder/foo.importuritestlanguage", "import './../folder/bar.importuritestlanguage' type foo extends bar type bar extends bar2");

	models.addModel("testfile://my/folder/bar.importuritestlanguage", "type bar type bar2 extends bar");

	Resource resource = rs.getResource(URI.createURI("testfile://my/folder/foo.importuritestlanguage"), true);
	Main main = (Main) resource.getContents().get(0);
	assertEquals("bar", main.getTypes().get(0).getExtends().getName());
	assertEquals("bar2", main.getTypes().get(0).getExtends().getExtends().getName());
	assertEquals("bar", main.getTypes().get(0).getExtends().getExtends().getExtends().getName());
	assertNull(main.getTypes().get(0).getExtends().getExtends().getExtends().getExtends());
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:16,代碼來源:SimpleNameScopeProviderTest.java

示例6: testScopeFileName

import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; //導入方法依賴的package包/類
@Test public void testScopeFileName() throws Exception {
	SyntheticModelAwareURIConverter models = new SyntheticModelAwareURIConverter();
	ResourceSetImpl rs = new ResourceSetImpl();
	rs.setURIConverter(models);

	models.addModel("foo.importuritestlanguage", "import 'bar.importuritestlanguage' type foo extends bar type bar extends bar2");
	models.addModel("bar.importuritestlanguage", "type bar type bar2 extends bar");

	Resource resource = rs.getResource(URI.createURI("foo.importuritestlanguage"), true);
	Main main = (Main) resource.getContents().get(0);
	assertEquals("bar", main.getTypes().get(0).getExtends().getName());
	assertEquals("bar2", main.getTypes().get(0).getExtends().getExtends().getName());
	assertEquals("bar", main.getTypes().get(0).getExtends().getExtends().getExtends().getName());
	assertNull(main.getTypes().get(0).getExtends().getExtends().getExtends().getExtends());
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:16,代碼來源:SimpleNameScopeProviderTest.java

示例7: testUnresolvableImport

import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; //導入方法依賴的package包/類
@Test public void testUnresolvableImport() throws Exception {
	SyntheticModelAwareURIConverter models = new SyntheticModelAwareURIConverter();
	ResourceSetImpl rs = new ResourceSetImpl();
	rs.setURIConverter(models);

	models.addModel("testfile://my/folder/foo.importuritestlanguage",
			"import 'unknownfile.importuritestlanguage' type foo extends bar type bar extends bar2");

	Resource resource = rs.getResource(URI.createURI("testfile://my/folder/foo.importuritestlanguage"), true);
	assertNotNull(resource);
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:12,代碼來源:SimpleNameScopeProviderTest.java

示例8: testCircularImport

import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; //導入方法依賴的package包/類
@Test public void testCircularImport() throws Exception {
	SyntheticModelAwareURIConverter models = new SyntheticModelAwareURIConverter();
	ResourceSetImpl rs = new ResourceSetImpl();
	rs.setURIConverter(models);

	models.addModel("foo.importuritestlanguage", "import 'bar.importuritestlanguage' type foo extends bar");
	models.addModel("bar.importuritestlanguage", "import 'foo.importuritestlanguage' type bar extends foo");

	Resource resource = rs.getResource(URI.createURI("foo.importuritestlanguage"), true);
	Main main = (Main) resource.getContents().get(0);
	assertEquals("bar", main.getTypes().get(0).getExtends().getName());
	assertEquals("foo", main.getTypes().get(0).getExtends().getExtends().getName());
	assertSame(main.getTypes().get(0).getExtends().getExtends(), main.getTypes().get(0));
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:15,代碼來源:SimpleNameScopeProviderTest.java


注:本文中的org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.setURIConverter方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。