use of org.eclipse.xtext.LanguageInfo in project xtext-eclipse by eclipse.
the class DirtyStateEditorSupportTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
document = this;
resourceSet = new ResourceSetImpl();
resourceURI = URI.createURI("scheme://foo");
resource = new XtextResource(resourceURI);
resource.setLanguageName("FooLanguage");
final DefaultResourceServiceProvider resourceServiceProvider = new DefaultResourceServiceProvider() {
@Override
public org.eclipse.xtext.resource.IResourceDescription.Manager getResourceDescriptionManager() {
return DirtyStateEditorSupportTest.this;
}
@SuppressWarnings("unchecked")
@Override
public <T> T get(Class<T> t) {
if (DirtyStateResourceDescription.Manager.class.isAssignableFrom(t))
return (T) new DirtyStateResourceDescription.Manager(DirtyStateEditorSupportTest.this);
if (LanguageInfo.class.isAssignableFrom(t))
return (T) new LanguageInfo("FooLanguage");
return super.get(t);
}
};
ResourceServiceProviderRegistryImpl registry = new ResourceServiceProviderRegistryImpl() {
@Override
public IResourceServiceProvider getResourceServiceProvider(URI uri) {
return resourceServiceProvider;
}
};
resource.setResourceServiceProvider(resourceServiceProvider);
resourceSet.getResources().add(resource);
dirtyStateSupport = new DirtyStateEditorSupport();
dirtyStateSupport.setConcurrentEditingWarningDialog(this);
dirtyStateSupport.setResourceDescriptions(this);
dirtyStateManager = new DirtyStateManager();
stateChangeEventBroker = new StateChangeEventBroker();
dirtyStateManager.addListener(stateChangeEventBroker);
dirtyStateSupport.setDirtyStateManager(dirtyStateManager);
dirtyStateSupport.setStateChangeEventBroker(stateChangeEventBroker);
dirtyResource = new DocumentBasedDirtyResource();
dirtyStateSupport.setDirtyResource(dirtyResource);
dirtyStateSupport.setResourceServiceProviderRegistry(registry);
ignoreConcurrentEditing = Lists.newLinkedList();
exportedObjects = Collections.emptyList();
}
use of org.eclipse.xtext.LanguageInfo in project xtext-core by eclipse.
the class AbstractLanguageServerTest method setup.
@Before
@BeforeEach
public void setup() {
final Injector injector = Guice.createInjector(this.getServerModule());
injector.injectMembers(this);
final Object resourceServiceProvider = this.resourceServerProviderRegistry.getExtensionToFactoryMap().get(this.fileExtension);
if ((resourceServiceProvider instanceof IResourceServiceProvider)) {
this.languageInfo = ((IResourceServiceProvider) resourceServiceProvider).<LanguageInfo>get(LanguageInfo.class);
}
this.languageServer.connect(ServiceEndpoints.toServiceObject(this, this.getLanguageClientClass()));
this.languageServer.supportedMethods();
File _absoluteFile = new File("").getAbsoluteFile();
File _file = new File(_absoluteFile, AbstractLanguageServerTest.TEST_PROJECT_PATH);
this.root = _file;
}
Aggregations