Add remote host name to ssh tunnel config, so that it can
be used to compute correct request mapping links for live
hovers.
This commit is contained in:
Kris De Volder
2018-08-07 10:04:21 -07:00
parent 64e7bbad45
commit 243586a8f8
8 changed files with 175 additions and 32 deletions

View File

@@ -24,7 +24,8 @@ Require-Bundle: org.eclipse.jdt.launching;bundle-version="3.9.0",
org.eclipse.ui.ide,
org.eclipse.jdt.core,
org.eclipse.ui.editors;bundle-version="3.11.100",
org.springsource.ide.eclipse.commons.livexp
org.springsource.ide.eclipse.commons.livexp,
org.apache.commons.lang3
Import-Package: com.google.gson;version="2.7.0",
org.eclipse.jface.preference,
org.osgi.framework

View File

@@ -14,6 +14,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.tuple.Pair;
import org.eclipse.jface.bindings.Binding;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.keys.IBindingService;
@@ -96,9 +97,9 @@ public class BootLanguageServerPlugin extends AbstractUIPlugin {
}
}
private static LiveSetVariable<String> remoteBootApps = new LiveSetVariable<>();
private static LiveSetVariable<Pair<String,String>> remoteBootApps = new LiveSetVariable<>();
public static LiveSetVariable<String> getRemoteBootApps() {
public static LiveSetVariable<Pair<String,String>> getRemoteBootApps() {
return remoteBootApps;
}

View File

@@ -18,7 +18,9 @@ import java.nio.file.FileSystems;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Collectors;
import org.apache.commons.lang3.tuple.Pair;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
@@ -30,6 +32,7 @@ import org.eclipse.lsp4j.jsonrpc.messages.ResponseMessage;
import org.eclipse.lsp4j.services.LanguageServer;
import org.springsource.ide.eclipse.commons.livexp.core.ValueListener;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
/**
@@ -50,7 +53,7 @@ public class DelegatingStreamConnectionProvider implements StreamConnectionProvi
private LanguageServer languageServer;
private final IPropertyChangeListener configListener = (e) -> sendConfiguration();
private final ValueListener<ImmutableSet<String>> remoteAppsListener = (e, v) -> sendConfiguration();
private final ValueListener<ImmutableSet<Pair<String,String>>> remoteAppsListener = (e, v) -> sendConfiguration();
public DelegatingStreamConnectionProvider() {
String port = System.getProperty("boot-java-ls-port");
@@ -123,6 +126,28 @@ public class DelegatingStreamConnectionProvider implements StreamConnectionProvi
}
}
public class RemoteBootAppData {
private String jmxurl;
private String host;
public RemoteBootAppData(String jmxurl, String host) {
super();
this.jmxurl = jmxurl;
this.host = host;
}
public String getJmxurl() {
return jmxurl;
}
public void setJmxurl(String jmxurl) {
this.jmxurl = jmxurl;
}
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
}
private void sendConfiguration() {
Map<String, Object> settings = new HashMap<>();
Map<String, Object> bootJavaObj = new HashMap<>();
@@ -134,7 +159,12 @@ public class DelegatingStreamConnectionProvider implements StreamConnectionProvi
bootJavaObj.put("boot-hints", bootHint);
bootJavaObj.put("change-detection", bootChangeDetection);
bootJavaObj.put("remote-apps", BootLanguageServerPlugin.getRemoteBootApps().getValues());
ImmutableSet<Pair<String, String>> remoteApps = BootLanguageServerPlugin.getRemoteBootApps().getValues();
bootJavaObj.put("remote-apps", BootLanguageServerPlugin.getRemoteBootApps().getValues()
.stream()
.map(pair -> new RemoteBootAppData(pair.getLeft(), pair.getRight()))
.collect(Collectors.toList())
);
settings.put("boot-java", bootJavaObj);