Add support for injectign remote JMX urls into boot ls
This commit is contained in:
@@ -23,7 +23,8 @@ Require-Bundle: org.eclipse.jdt.launching;bundle-version="3.9.0",
|
||||
org.eclipse.ui,
|
||||
org.eclipse.ui.ide,
|
||||
org.eclipse.jdt.core,
|
||||
org.eclipse.ui.editors;bundle-version="3.11.100"
|
||||
org.eclipse.ui.editors;bundle-version="3.11.100",
|
||||
org.springsource.ide.eclipse.commons.livexp
|
||||
Import-Package: com.google.gson;version="2.7.0",
|
||||
org.eclipse.jface.preference,
|
||||
org.osgi.framework
|
||||
|
||||
@@ -19,6 +19,7 @@ import org.eclipse.ui.PlatformUI;
|
||||
import org.eclipse.ui.keys.IBindingService;
|
||||
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.springsource.ide.eclipse.commons.livexp.core.LiveSetVariable;
|
||||
|
||||
/**
|
||||
* Boot-Java LS extension plugin
|
||||
@@ -94,5 +95,11 @@ public class BootLanguageServerPlugin extends AbstractUIPlugin {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private static LiveSetVariable<String> remoteBootApps = new LiveSetVariable<>();
|
||||
|
||||
public static LiveSetVariable<String> getRemoteBootApps() {
|
||||
return remoteBootApps;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ package org.springframework.tooling.boot.ls;
|
||||
public class Constants {
|
||||
|
||||
public static final String PLUGIN_ID = "org.springframework.tooling.boot.ls";
|
||||
public static final String LANGUAGE_SERVER_VERSION = "0.3.2-SNAPSHOT.jar";
|
||||
public static final String LANGUAGE_SERVER_VERSION = "0.4.0-SNAPSHOT.jar";
|
||||
|
||||
public static final String PREF_BOOT_HINTS = "boot-java.boot-hints.on";
|
||||
public static final String PREF_CHANGE_DETECTION = "boot-java.change-detection.on";
|
||||
|
||||
@@ -28,6 +28,9 @@ import org.eclipse.lsp4j.InitializeResult;
|
||||
import org.eclipse.lsp4j.jsonrpc.messages.Message;
|
||||
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.ImmutableSet;
|
||||
|
||||
/**
|
||||
* if the system property "boot-java-ls-port" exists, delegate to the socket-based
|
||||
@@ -46,12 +49,8 @@ public class DelegatingStreamConnectionProvider implements StreamConnectionProvi
|
||||
private ResourceListener fResourceListener;
|
||||
private LanguageServer languageServer;
|
||||
|
||||
private final IPropertyChangeListener configListener = new IPropertyChangeListener() {
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent event) {
|
||||
sendConfiguration();
|
||||
}
|
||||
};
|
||||
private final IPropertyChangeListener configListener = (e) -> sendConfiguration();
|
||||
private final ValueListener<ImmutableSet<String>> remoteAppsListener = (e, v) -> sendConfiguration();
|
||||
|
||||
public DelegatingStreamConnectionProvider() {
|
||||
String port = System.getProperty("boot-java-ls-port");
|
||||
@@ -96,6 +95,7 @@ public class DelegatingStreamConnectionProvider implements StreamConnectionProvi
|
||||
fResourceListener = null;
|
||||
}
|
||||
BootLanguageServerPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(configListener);
|
||||
BootLanguageServerPlugin.getRemoteBootApps().removeListener(remoteAppsListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -116,6 +116,9 @@ public class DelegatingStreamConnectionProvider implements StreamConnectionProvi
|
||||
FileSystems.getDefault().getPathMatcher("glob:**/*.gradle"),
|
||||
FileSystems.getDefault().getPathMatcher("glob:**/*.java")
|
||||
)));
|
||||
|
||||
//Add remote boot apps listener
|
||||
BootLanguageServerPlugin.getRemoteBootApps().addListener(remoteAppsListener);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -131,6 +134,7 @@ public class DelegatingStreamConnectionProvider implements StreamConnectionProvi
|
||||
|
||||
bootJavaObj.put("boot-hints", bootHint);
|
||||
bootJavaObj.put("change-detection", bootChangeDetection);
|
||||
bootJavaObj.put("remote-apps", BootLanguageServerPlugin.getRemoteBootApps().getValues());
|
||||
|
||||
settings.put("boot-java", bootJavaObj);
|
||||
|
||||
|
||||
@@ -16,8 +16,6 @@ import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.core.runtime.FileLocator;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
@@ -99,5 +97,4 @@ public class SpringBootLanguageServer extends STS4LanguageServerProcessStreamCon
|
||||
File dataFile = bundle.getDataFile(languageServerLocalCopy);
|
||||
Files.copy(stream, dataFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,14 +20,8 @@
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
|
||||
Reference in New Issue
Block a user