Source:
public void start(final Callback<WsAgentComponent, Exception> callback) { Promise<List<LanguageDescription>> registeredLanguages = serverLanguageRegistry.getSupportedLanguages(); registeredLanguages.then(new Operation<List<LanguageDescription>>() { @Override public void apply(List<LanguageDescription> langs) throws OperationException { LOGGER.info("registering language descriptions"); if (!langs.isEmpty()) { JsArrayString contentTypes = JsArrayString.createArray().cast(); for (LanguageDescription lang : langs) { if (lang.getFileExtensions() != null) { for (String ext : lang.getFileExtensions()) { final FileType fileType = new FileType(resources.file(), ext); lsRegistry.registerFileType(fileType, lang); editorRegistry.registerDefaultEditor(fileType, editorProvider); } } if (lang.getFileNames() != null) { for (String fileName : lang.getFileNames()) { final FileType fileType = new FileType(resources.file(), null, RegExp.quote(fileName)); lsRegistry.registerFileType(fileType, lang); editorRegistry.registerDefaultEditor(fileType, editorProvider); } } String mimeType = lang.getMimeType(); contentTypes.push(mimeType); OrionContentTypeOverlay contentType = OrionContentTypeOverlay.create(); contentType.setId(mimeType); contentType.setName(lang.getLanguageId()); contentType.setExtension(lang.getFileExtensions().toArray(new String[lang.getFileExtensions().size()])); contentType.setExtends("text/plain"); OrionHighlightingConfigurationOverlay config = OrionHighlightingConfigurationOverlay.create(); config.setId(lang.getLanguageId() + ".highlighting"); config.setContentTypes(mimeType); config.setPatterns(lang.getHighlightingConfiguration()); contentTypeRegistrant.registerFileType(contentType, config); LOGGER.info("registered language description for " + lang.getLanguageId()); } orionHoverRegistrant.registerHover(contentTypes, hoverProvider); orionOccurrencesRegistrant.registerOccurrencesHandler(contentTypes, occurrencesProvider); } callback.onSuccess(LanguageServerFileTypeRegister.this); } }).catchError(new Operation<PromiseError>() { @Override public void apply(PromiseError arg) throws OperationException { callback.onFailure(new Exception(arg.getMessage(), arg.getCause())); } }); }

Target:
public void start(final Callback<WsAgentComponent, Exception> callback) { Promise<List<LanguageDescription>> registeredLanguages = serverLanguageRegistry.getSupportedLanguages(); registeredLanguages.then(new Operation<List<LanguageDescription>>() { @Override public void apply(List<LanguageDescription> langs) throws OperationException { LOGGER.info("registering language descriptions"); if (!langs.isEmpty()) { JsArrayString contentTypes = JsArrayString.createArray().cast(); for (LanguageDescription lang : langs) { for (String ext : lang.getFileExtensions()) { final FileType fileType = new FileType(resources.file(), ext); lsRegistry.registerFileType(fileType, lang); editorRegistry.registerDefaultEditor(fileType, editorProvider); } for (String fileName : lang.getFileNames()) { final FileType fileType = new FileType(resources.file(), null, RegExp.quote(fileName)); lsRegistry.registerFileType(fileType, lang); editorRegistry.registerDefaultEditor(fileType, editorProvider); } String mimeType = lang.getMimeType(); contentTypes.push(mimeType); OrionContentTypeOverlay contentType = OrionContentTypeOverlay.create(); contentType.setId(mimeType); contentType.setName(lang.getLanguageId()); contentType.setFileName(lang.getFileNames().toArray(new String[lang.getFileNames().size()])); contentType.setExtension(lang.getFileExtensions().toArray(new String[lang.getFileExtensions().size()])); contentType.setExtends("text/plain"); OrionHighlightingConfigurationOverlay config = OrionHighlightingConfigurationOverlay.create(); config.setId(lang.getLanguageId() + ".highlighting"); config.setContentTypes(mimeType); config.setPatterns(lang.getHighlightingConfiguration()); contentTypeRegistrant.registerFileType(contentType, config); LOGGER.info("registered language description for " + lang.getLanguageId()); } orionHoverRegistrant.registerHover(contentTypes, hoverProvider); orionOccurrencesRegistrant.registerOccurrencesHandler(contentTypes, occurrencesProvider); } callback.onSuccess(LanguageServerFileTypeRegister.this); } }).catchError(new Operation<PromiseError>() { @Override public void apply(PromiseError arg) throws OperationException { callback.onFailure(new Exception(arg.getMessage(), arg.getCause())); } }); }