Merge branch 'master' of github.com:spring-projects/sts4
This commit is contained in:
@@ -15,7 +15,7 @@ Require-Bundle: org.eclipse.jdt.launching;bundle-version="3.9.0",
|
||||
org.eclipse.ui.workbench,
|
||||
org.eclipse.jface,
|
||||
org.eclipse.xtext.xbase.lib,
|
||||
org.springframework.tooling.ls.eclipse.commons,
|
||||
org.springframework.tooling.ls.eclipse.commons;bundle-version="0.0.10",
|
||||
org.eclipse.core.resources,
|
||||
org.eclipse.ui
|
||||
Import-Package: com.google.gson;version="2.7.0",
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
package org.springframework.tooling.boot.java.ls;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
@@ -23,6 +24,7 @@ import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.jdt.internal.launching.StandardVMType;
|
||||
import org.eclipse.lsp4e.server.ProcessStreamConnectionProvider;
|
||||
import org.osgi.framework.Bundle;
|
||||
import org.springframework.tooling.ls.eclipse.commons.LanguageServerProcessReaper;
|
||||
|
||||
/**
|
||||
* @author Martin Lippert
|
||||
@@ -30,6 +32,8 @@ import org.osgi.framework.Bundle;
|
||||
@SuppressWarnings("restriction")
|
||||
public class SpringBootJavaLanguageServer extends ProcessStreamConnectionProvider {
|
||||
|
||||
private static LanguageServerProcessReaper processReaper = new LanguageServerProcessReaper();
|
||||
|
||||
public SpringBootJavaLanguageServer() {
|
||||
List<String> commands = new ArrayList<>();
|
||||
commands.add(getJDKLocation());
|
||||
@@ -50,6 +54,18 @@ public class SpringBootJavaLanguageServer extends ProcessStreamConnectionProvide
|
||||
setWorkingDirectory(workingDir);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() throws IOException {
|
||||
super.start();
|
||||
processReaper.addProcess(LanguageServerProcessReaper.getProcess(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
super.stop();
|
||||
processReaper.removeProcess(LanguageServerProcessReaper.getProcess(this));
|
||||
}
|
||||
|
||||
protected String getJDKLocation() {
|
||||
File jre = new File(System.getProperty("java.home"));
|
||||
File javaExecutable = StandardVMType.findJavaExecutable(jre);
|
||||
|
||||
@@ -7,7 +7,8 @@ Bundle-Version: 0.0.10.qualifier
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Require-Bundle: org.eclipse.jdt.launching;bundle-version="3.8.0",
|
||||
org.eclipse.core.runtime;bundle-version="3.12.0",
|
||||
org.eclipse.lsp4e;bundle-version="0.2.0"
|
||||
org.eclipse.lsp4e;bundle-version="0.2.0",
|
||||
org.springframework.tooling.ls.eclipse.commons;bundle-version="4.0.0"
|
||||
Import-Package: org.eclipse.jface.preference,
|
||||
org.eclipse.lsp4j;version="0.2.0.v20170518-0647",
|
||||
org.eclipse.lsp4j.jsonrpc.messages;version="0.1.0.v20170117-0759",
|
||||
|
||||
@@ -13,7 +13,6 @@ package org.springframework.tooling.cloudfoundry.manifest.ls;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.Field;
|
||||
import java.net.URI;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
@@ -32,6 +31,7 @@ import org.eclipse.lsp4j.jsonrpc.messages.Message;
|
||||
import org.eclipse.lsp4j.jsonrpc.messages.ResponseMessage;
|
||||
import org.eclipse.lsp4j.services.LanguageServer;
|
||||
import org.osgi.framework.Bundle;
|
||||
import org.springframework.tooling.ls.eclipse.commons.LanguageServerProcessReaper;
|
||||
|
||||
/**
|
||||
* @author Martin Lippert
|
||||
@@ -93,7 +93,7 @@ public class CloudFoundryManifestLanguageServer extends ProcessStreamConnectionP
|
||||
public void stop() {
|
||||
removeLanguageServer(this);
|
||||
super.stop();
|
||||
processReaper.removeProcess(this.getProcess());
|
||||
processReaper.removeProcess(LanguageServerProcessReaper.getProcess(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -120,22 +120,9 @@ public class CloudFoundryManifestLanguageServer extends ProcessStreamConnectionP
|
||||
@Override
|
||||
public void start() throws IOException {
|
||||
super.start();
|
||||
processReaper.addProcess(getProcess());
|
||||
processReaper.addProcess(LanguageServerProcessReaper.getProcess(this));
|
||||
}
|
||||
|
||||
private Process getProcess() {
|
||||
try {
|
||||
//The super class is doesn't provide a way to get at the process without using reflection...
|
||||
// This method can be removed if / when the super-class provides a getProcess method we can call.
|
||||
Field processField = ProcessStreamConnectionProvider.class.getDeclaredField("process");
|
||||
processField.setAccessible(true);
|
||||
Process process = (Process) processField.get(this);
|
||||
return process;
|
||||
} catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected String getLanguageServerJARLocation() {
|
||||
String languageServer = "manifest-yaml-language-server-" + Constants.LANGUAGE_SERVER_VERSION;
|
||||
|
||||
|
||||
@@ -1,19 +1,21 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2017 Spring IDE Developers
|
||||
* Copyright (c) 2017 Pivotal, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Spring IDE Developers - initial API and implementation
|
||||
* Pivotal, Inc. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.springframework.tooling.cloudfoundry.manifest.ls;
|
||||
package org.springframework.tooling.ls.eclipse.commons;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.lsp4e.server.ProcessStreamConnectionProvider;
|
||||
|
||||
/**
|
||||
* A 'last resort cleanup' utility for LSP server processes. This class, when instantiated
|
||||
@@ -44,6 +46,19 @@ public class LanguageServerProcessReaper extends Thread {
|
||||
}
|
||||
}
|
||||
|
||||
public static Process getProcess(ProcessStreamConnectionProvider connectionProvider) {
|
||||
try {
|
||||
//The super class is doesn't provide a way to get at the process without using reflection...
|
||||
// This method can be removed if / when the super-class provides a getProcess method we can call.
|
||||
Field processField = ProcessStreamConnectionProvider.class.getDeclaredField("process");
|
||||
processField.setAccessible(true);
|
||||
Process process = (Process) processField.get(connectionProvider);
|
||||
return process;
|
||||
} catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
LinkedList<Process> processes = new LinkedList<>();
|
||||
{
|
||||
Runtime.getRuntime().addShutdownHook(this);
|
||||
Reference in New Issue
Block a user