/** * Sends a status to the client to be presented to users * @param msg The status to send back to the client */ public void sendStatus(ServiceStatus serverStatus, String status) { StatusReport $ = new StatusReport(); client.sendStatusReport( $.withMessage(status).withType(serverStatus.name())); }
private StreamProvider createProvider() { Integer port = JDTEnvironmentUtils.getClientPort(); if (port != null) { return new SocketStreamProvider(JDTEnvironmentUtils.getClientHost(), port); } return new StdIOStreamProvider(); }
/** * Sends a message to the client to be presented to users, with possible * commands to execute */ public void sendActionableNotification(MessageType severity, String message, Object data, List<Command> commands) { ActionableNotification notification = new ActionableNotification().withSeverity(severity).withMessage(message).withData(data).withCommands(commands); sendActionableNotification(notification); }
/** * Given the uri returns a {@link ICompilationUnit}. * May return null if it can not associate the uri with a Java * file. * * @param uriString * @return compilation unit */ public static ICompilationUnit resolveCompilationUnit(String uriString) { return resolveCompilationUnit(toURI(uriString)); }
/** * Given the uri string returns a {@link IPackageFragement}. May return null if * it can not associate the uri with a package fragment. * * @param uriString * @return package fragment */ public static IPackageFragment resolvePackage(String uriString) { return resolvePackage(toURI(uriString)); }
@Override public String getContent(URI uri, IProgressMonitor monitor) throws CoreException { IClassFile classFile = JDTUtils.resolveClassFile(uri); if (classFile != null) { return getSource(classFile, monitor); } return null; }
public InputStream getInputStream() throws IOException { return getSelectedStream().getInputStream(); }
public OutputStream getOutputStream() throws IOException { return getSelectedStream().getOutputStream(); }
/** * Given the uri returns a {@link IClassFile}. * May return null if it can not resolve the uri to a * library. * * @see #toLocation(IClassFile, int, int) * @param uri with 'jdt' scheme * @return class file */ public static IClassFile resolveClassFile(String uriString){ return resolveClassFile(toURI(uriString)); }
@Override public void handleException(Throwable exception) { JavaLanguageServerPlugin.logException("Exception happened inside DynamicValidationStateChange: ", exception); } });
@Override public void setTaskName(String name) { super.setTaskName(name); taskName = name; }
/** * Sends a progress report to the client to be presented to users * * @param progressReport * The progress report to send back to the client */ public void sendProgressReport(ProgressReport progressReport) { client.sendProgressReport(progressReport); }
/** * Returns with the client host. Defaults to {@code localhost} if not set. Has * absolutely no effect, if this is set but the {@code CLIENT_PORT} is not. */ public static String getClientHost() { return Environment.get(CLIENT_HOST); }
static void startLanguageServer(LanguageServer newLanguageServer) throws IOException { if (pluginInstance != null) { pluginInstance.languageServer = newLanguageServer; pluginInstance.startConnection(); } }
/** * Sends a message to the client to be presented to users, with possible commands to execute */ public void sendActionableNotification(ActionableNotification notification) { client.sendActionableNotification(notification); }
public static IJavaElement findElementAtSelection(ITypeRoot unit, int line, int column, PreferenceManager preferenceManager, IProgressMonitor monitor) throws JavaModelException { IJavaElement[] elements = findElementsAtSelection(unit, line, column, preferenceManager, monitor); if (elements != null && elements.length == 1) { return elements[0]; } return null; }
@Override public InputStream getInputStream() throws IOException { if (fInputStream == null) { initializeConnection(); } return fInputStream; }
/** * * @return */ public StreamProvider getSelectedStream() { if (provider == null) { provider = createProvider(); } return provider; }
/** * @see {@link org.eclipse.lsp4j.services.LanguageClient#registerCapability(RegistrationParams)} */ public void registerCapability(RegistrationParams params) { client.registerCapability(params); }
@Override protected void sendStatus() { if (client == null) { return; } String message = formatMessage(subTaskName); client.sendStatusReport(new StatusReport().withType(ServiceStatus.Starting.name()).withMessage(message)); } }