@Before public void setup() { try { 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.<LanguageClientExtensions>toServiceObject(this, LanguageClientExtensions.class)); this.languageServer.supportedMethods(); File _absoluteFile = new File("").getAbsoluteFile(); File _file = new File(_absoluteFile, "/test-data/test-project"); this.root = _file; boolean _mkdirs = this.root.mkdirs(); boolean _not = (!_mkdirs); if (_not) { Files.cleanFolder(this.root, null, true, false); } this.root.deleteOnExit(); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } }
protected String getStratumName(final SourceRelativeURI path) { IResourceServiceProvider provider = serviceProviderRegistry.getResourceServiceProvider(path.getURI()); if (provider == null) { // it might happen that trace data is in the workspace but the corresponding language is not installed. // we use the file extension then. String result = path.getURI().fileExtension(); if (result != null) { return result; } return "unknown"; } final LanguageInfo languageInfo = provider.get(LanguageInfo.class); String name = languageInfo.getShortName(); return name; }
@Override public LanguageInfo getLanguage() { LanguageInfo result = trace.findLanguage(getAbsoluteResourceURI()); return result; }
@Override public LanguageInfo getLocalLanguage() { return findLanguage(getLocalURI()); }
protected LanguageInfo findLanguage(AbstractURIWrapper uri) { return getService(uri, LanguageInfo.class); }
@Inject public void initialize(LanguageInfo languageInfo, AbstractUIPlugin uiPlugin) { String bundleName = uiPlugin.getBundle().getSymbolicName(); String languageName = languageInfo.getShortName().toLowerCase(); setMarkerTypes(bundleName + "." + languageName); }
@Inject public XtextEditorInfo(LanguageInfo languageInfo) { this.languageInfo = languageInfo; }
public LanguageInfo getLanguageInfo() { return languageInfo; }
/** * @return the language that this resource belongs to. May be <code>null</code>. */ LanguageInfo getLanguage();
/** * Returns the language that is associated with the local resource. May be <code>null</code> * if the artifact does not have an associated Xtext language, e.g. for html or java files. * * @return the language that is associated with the local resource. May be <code>null</code>. */ LanguageInfo getLocalLanguage();