Java Code Examples for org.eclipse.xtext.naming.IQualifiedNameProvider#AbstractImpl
The following examples show how to use
org.eclipse.xtext.naming.IQualifiedNameProvider#AbstractImpl .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultResourceDescriptionManagerTest.java From xtext-core with Eclipse Public License 2.0 | 6 votes |
@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(); }
Example 2
Source File: ResourceSetBasedResourceDescriptionsTest.java From xtext-core with Eclipse Public License 2.0 | 6 votes |
@Before public void setUp() throws Exception { resourceSet = new ResourceSetImpl(); IQualifiedNameProvider qualifiedNameProvider = new IQualifiedNameProvider.AbstractImpl() { @Override public QualifiedName getFullyQualifiedName(EObject obj) { return QualifiedName.create(((ENamedElement) obj).getName()); } @Override public QualifiedName apply(EObject from) { return QualifiedName.create(((ENamedElement) from).getName()); } }; resourceDescriptionManager = new DefaultResourceDescriptionManager(); resourceDescriptionManager.setCache(IResourceScopeCache.NullImpl.INSTANCE); DefaultResourceDescriptionStrategy strategy = new DefaultResourceDescriptionStrategy(); strategy.setQualifiedNameProvider(qualifiedNameProvider); resourceDescriptionManager.setStrategy(strategy); resDescs = new ResourceSetBasedResourceDescriptions(); resDescs.setContext(resourceSet); resDescs.setRegistry(this); container = new ResourceDescriptionsBasedContainer(resDescs); }
Example 3
Source File: DefaultResourceDescriptionTest.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
@Before public void setUp() throws Exception { resource = new XMLResourceImpl(); resource.setURI(URI.createURI("foo:/test")); nameProvider = new IQualifiedNameProvider.AbstractImpl() { @Override public QualifiedName getFullyQualifiedName(EObject obj) { if (obj instanceof ENamedElement) return QualifiedName.create(((ENamedElement) obj).getName()); return null; } }; strategy = new DefaultResourceDescriptionStrategy(); strategy.setQualifiedNameProvider(nameProvider); description = new DefaultResourceDescription(resource, strategy); EcoreFactory f = EcoreFactory.eINSTANCE; pack = f.createEPackage(); pack.setName("MyPackage"); eClass = f.createEClass(); eClass.setName("MyEClass"); dtype = f.createEDataType(); dtype.setName("MyDatatype"); pack.getEClassifiers().add(eClass); pack.getEClassifiers().add(dtype); resource.getContents().add(pack); }