Java Code Examples for org.eclipse.xtext.resource.impl.ProjectDescription#findInEmfObject()

The following examples show how to use org.eclipse.xtext.resource.impl.ProjectDescription#findInEmfObject() . 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: N4JSOutputConfigurationProvider.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public Set<OutputConfiguration> getOutputConfigurations(ResourceSet context) {
	EList<Resource> resources = context.getResources();
	if (resources.isEmpty()) {
		ProjectDescription description = ProjectDescription.findInEmfObject(context);
		IN4JSProject project = n4jsCore.findProject(new N4JSProjectName(description.getName())).orNull();
		return getOutputConfigurationSet(project);
	}
	return getOutputConfigurations(resources.get(0));
}
 
Example 2
Source File: ProjectDescriptionBasedContainerManager.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public List<IContainer> getVisibleContainers(IResourceDescription desc,
		IResourceDescriptions resourceDescriptions) {
	ChunkedResourceDescriptions descriptions = getChunkedResourceDescriptions(resourceDescriptions);
	if (descriptions == null)
		throw new IllegalArgumentException("Expected " + ChunkedResourceDescriptions.class.getName());
	ProjectDescription projectDescription = ProjectDescription.findInEmfObject(descriptions.getResourceSet());
	List<IContainer> allContainers = new ArrayList<>();
	allContainers.add(createContainer(resourceDescriptions, descriptions, projectDescription.getName()));
	for (String name : projectDescription.getDependencies())
		allContainers.add(createContainer(resourceDescriptions, descriptions, name));
	return allContainers;
}
 
Example 3
Source File: ProjectDescriptionBasedContainerManager.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public boolean shouldUseProjectDescriptionBasedContainers(IResourceDescriptions resourceDescriptions) {
	ChunkedResourceDescriptions descriptions = getChunkedResourceDescriptions(resourceDescriptions);
	return (descriptions != null && descriptions.getResourceSet() != null
			&& ProjectDescription.findInEmfObject(descriptions.getResourceSet()) != null);
}