@Override public void logMessage(MessageParams message) { switch (message.getType()) { case Error: LOG.error(message.getMessage()); break; case Warning: LOG.warn(message.getMessage()); break; case Info: LOG.info(message.getMessage()); break; case Log: LOG.debug(message.getMessage()); break; } }
public void processNotification(final MessageParams messageParams) { Log.debug(getClass(), "Received a 'ShowMessage' message: " + messageParams.getMessage()); switch (messageParams.getType()) { case Error: this.notificationManager.notify( messageParams.getMessage(), StatusNotification.Status.FAIL, FLOAT_MODE); break; case Warning: this.notificationManager.notify( messageParams.getMessage(), StatusNotification.Status.WARNING, FLOAT_MODE); break; case Info: case Log: default: this.notificationManager.notify( messageParams.getMessage(), StatusNotification.Status.SUCCESS, FLOAT_MODE); break; } }
private void loadWorkspace(final InitializeParams params) { try { som.loadWorkspace(params.getRootUri()); } catch (URISyntaxException e) { MessageParams msg = new MessageParams(); msg.setType(MessageType.Error); msg.setMessage("Workspace root URI invalid: " + params.getRootUri()); client.logMessage(msg); ServerLauncher.logErr(msg.getMessage()); } }
public void reportError(final String msgStr) { MessageParams msg = new MessageParams(); msg.setType(MessageType.Log); msg.setMessage(msgStr); client.logMessage(msg); ServerLauncher.logErr(msgStr); }
/** * Sends the logMessage message back to the client as a notification * @param msg The message to send back to the client */ public void logMessage(MessageType type, String msg) { MessageParams $= new MessageParams(); $.setMessage(msg); $.setType(type); client.logMessage($); }
/** * Sends the message to the client, to be displayed on a UI element. * * @param type * @param msg */ public void showNotificationMessage(MessageType type, String msg){ MessageParams $ = new MessageParams(); $.setMessage(msg); $.setType(type); client.showMessage($); }
@Test public void testNotification() throws IOException { MessageParams p = new MessageParams(); p.setMessage("Hello World"); p.setType(MessageType.Info); client.expectedNotifications.put("window/logMessage", p); serverLauncher.getRemoteProxy().logMessage(p); client.joinOnEmpty(); }
@Inject private void subscribe(EventService eventService) { eventService.subscribe( event -> endpointIds.forEach( endpointId -> requestTransmitter .newRequest() .endpointId(endpointId) .methodName("window/showMessage") .paramsAsDto(new MessageParamsDto(event)) .sendAndSkipResult()), MessageParams.class); }
public void reconcilePath(String fileLocation, String projectPath) { String fileName = new Path(fileLocation).lastSegment(); if (!POM_FILE_NAME.equals(fileName)) { return; } EditorWorkingCopy workingCopy = editorWorkingCopyManager.getWorkingCopy(fileLocation); if (workingCopy == null) { return; } String newPomContent = workingCopy.getContentAsString(); if (isNullOrEmpty(newPomContent)) { return; } List<Problem> problems; try { problems = reconcile(fileLocation, projectPath, newPomContent); List<Diagnostic> diagnostics = convertProblems(newPomContent, problems); client.publishDiagnostics( new PublishDiagnosticsParams(LanguageServiceUtils.prefixURI(fileLocation), diagnostics)); } catch (ServerException | NotFoundException e) { LOG.error(e.getMessage(), e); client.showMessage(new MessageParams(MessageType.Error, "Error reconciling " + fileLocation)); } }
public void reconcileUri(String uri, String text) { try { String pomPath = LanguageServiceUtils.removePrefixUri(uri); List<Problem> problems = reconcile(pomPath, new File(pomPath).getParent(), text); List<Diagnostic> diagnostics = convertProblems(text, problems); client.publishDiagnostics(new PublishDiagnosticsParams(uri, diagnostics)); } catch (ServerException | NotFoundException e) { LOG.error("Error reconciling content: " + uri, e); client.showMessage(new MessageParams(MessageType.Error, "Error reconciling " + uri)); } }
@Override public void showMessage(MessageParams messageParams) { }
@Override public void logMessage(MessageParams message) { }
public void logMessage(final MessageParams message) { this.noImpl3.logMessage(message); }
public void showMessage(final MessageParams messageParams) { this.noImpl3.showMessage(messageParams); }
@Override public void showMessage(MessageParams messageParams) { eventService.publish(messageParams); }
/** * Sends the given <code>log message notification</code> back to the client * as a notification * * @param type * the type of message * @param msg * The message to send back to the client */ public void sendLogMessageNotification(final MessageType type, final String msg) { client.logMessage(new MessageParams(type, msg)); }
/** * Sends the given <code>show message notification</code> back to the client * as a notification * * @param type * the type of message * @param msg * The message to send back to the client */ public void sendShowMessageNotification(final MessageType type, final String msg) { client.showMessage(new MessageParams(type, msg)); }
/** * The show message notification is sent from a server to a client to ask * the client to display a particular message in the user interface. */ @JsonNotification("window/showMessage") void showMessage(MessageParams messageParams);
/** * The log message notification is send from the server to the client to ask * the client to log a particular message. */ @JsonNotification("window/logMessage") void logMessage(MessageParams message);