diff --git a/plugins/de.fraunhofer.ipa.ros.xtext.ide/pom.xml b/plugins/de.fraunhofer.ipa.ros.xtext.ide/pom.xml index 0dfe06246..050b9dd3c 100644 --- a/plugins/de.fraunhofer.ipa.ros.xtext.ide/pom.xml +++ b/plugins/de.fraunhofer.ipa.ros.xtext.ide/pom.xml @@ -12,22 +12,124 @@ eclipse-plugin + src + + + src + + **/*.java + **/*.xtend + + + org.eclipse.xtend xtend-maven-plugin + + org.codehaus.mojo + build-helper-maven-plugin + 3.3.0 + + + add-source + initialize + + add-source + add-resource + + + + src-gen + + + + src-gen + + **/*.java + **/*.g + + + + + + + org.apache.maven.plugins - maven-clean-plugin + maven-shade-plugin + 3.2.4 + + + + de.fraunhofer.ipa.ros.ide.launch.ServerLauncher + + + plugin.properties + + + + + + + *:* + + META-INF/INDEX.LIST + META-INF/*.SF + META-INF/*.DSA + META-INF/*.RSA + .options + .api_description + *.profile + *.html + about.* + about_files/* + plugin.xml + systembundle.properties + profile.list + **/*._trace + **/*.g + **/*.mwe2 + **/*.xtext + + + + true + ls + false + - xtend-gen-clean - clean + package + + shade + + + + ${project.groupId} + de.fraunhofer.ipa.ros.xtext + ${project.version} + + + org.eclipse.xtext + org.eclipse.xtext.ide + ${xtextVersion} + + + org.eclipse.xtext + org.eclipse.xtext.xbase.ide + ${xtextVersion} + + + diff --git a/plugins/de.fraunhofer.ipa.ros.xtext.ide/src/de/fraunhofer/ipa/ros/ide/launch/ServerLauncher.java b/plugins/de.fraunhofer.ipa.ros.xtext.ide/src/de/fraunhofer/ipa/ros/ide/launch/ServerLauncher.java new file mode 100644 index 000000000..b4b27ed45 --- /dev/null +++ b/plugins/de.fraunhofer.ipa.ros.xtext.ide/src/de/fraunhofer/ipa/ros/ide/launch/ServerLauncher.java @@ -0,0 +1,55 @@ +package de.fraunhofer.ipa.ros.ide.launch; + +import java.io.IOException; +import java.net.InetSocketAddress; +import java.net.SocketAddress; +import java.nio.channels.AsynchronousServerSocketChannel; +import java.nio.channels.AsynchronousSocketChannel; +import java.nio.channels.Channels; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.function.Function; + +import org.eclipse.lsp4j.jsonrpc.Launcher; +import org.eclipse.lsp4j.jsonrpc.MessageConsumer; +import org.eclipse.lsp4j.services.LanguageClient; +import org.eclipse.xtext.ide.server.LanguageServerImpl; +import org.eclipse.xtext.ide.server.ServerModule; + +import com.google.inject.Guice; +import com.google.inject.Injector; + +public class ServerLauncher { + public static void main(String[] args) throws InterruptedException, IOException { + Injector injector = Guice.createInjector(new ServerModule()); + LanguageServerImpl languageServer = injector.getInstance(LanguageServerImpl.class); + Function wrapper = consumer -> { + MessageConsumer result = consumer; + return result; + }; + Launcher launcher = createSocketLauncher(languageServer, LanguageClient.class, + new InetSocketAddress("localhost", 5008), Executors.newCachedThreadPool(), wrapper); + languageServer.connect(launcher.getRemoteProxy()); + Future future = launcher.startListening(); + while (!future.isDone()) { + Thread.sleep(10_000l); + } + } + + static Launcher createSocketLauncher(Object localService, Class remoteInterface, + SocketAddress socketAddress, ExecutorService executorService, + Function wrapper) throws IOException { + AsynchronousServerSocketChannel serverSocket = AsynchronousServerSocketChannel.open().bind(socketAddress); + AsynchronousSocketChannel socketChannel; + try { + socketChannel = serverSocket.accept().get(); + return Launcher.createIoLauncher(localService, remoteInterface, Channels.newInputStream(socketChannel), + Channels.newOutputStream(socketChannel), executorService, wrapper); + } catch (InterruptedException | ExecutionException e) { + e.printStackTrace(); + } + return null; + } +} \ No newline at end of file diff --git a/plugins/de.fraunhofer.ipa.ros1.xtext.ide/pom.xml b/plugins/de.fraunhofer.ipa.ros1.xtext.ide/pom.xml index 3b79f0d4b..e88ac9bf5 100644 --- a/plugins/de.fraunhofer.ipa.ros1.xtext.ide/pom.xml +++ b/plugins/de.fraunhofer.ipa.ros1.xtext.ide/pom.xml @@ -12,22 +12,124 @@ eclipse-plugin + src + + + src + + **/*.java + **/*.xtend + + + org.eclipse.xtend xtend-maven-plugin + + org.codehaus.mojo + build-helper-maven-plugin + 3.3.0 + + + add-source + initialize + + add-source + add-resource + + + + src-gen + + + + src-gen + + **/*.java + **/*.g + + + + + + + org.apache.maven.plugins - maven-clean-plugin + maven-shade-plugin + 3.2.4 + + + + de.fraunhofer.ipa.ros1.ide.launch.ServerLauncher + + + plugin.properties + + + + + + + *:* + + META-INF/INDEX.LIST + META-INF/*.SF + META-INF/*.DSA + META-INF/*.RSA + .options + .api_description + *.profile + *.html + about.* + about_files/* + plugin.xml + systembundle.properties + profile.list + **/*._trace + **/*.g + **/*.mwe2 + **/*.xtext + + + + true + ls + false + - xtend-gen-clean - clean + package + + shade + + + + ${project.groupId} + de.fraunhofer.ipa.ros.xtext + ${project.version} + + + org.eclipse.xtext + org.eclipse.xtext.ide + ${xtextVersion} + + + org.eclipse.xtext + org.eclipse.xtext.xbase.ide + ${xtextVersion} + + + diff --git a/plugins/de.fraunhofer.ipa.ros1.xtext.ide/src/de/fraunhofer/ipa/ros1/ide/launch/ServerLauncher.java b/plugins/de.fraunhofer.ipa.ros1.xtext.ide/src/de/fraunhofer/ipa/ros1/ide/launch/ServerLauncher.java new file mode 100644 index 000000000..41cbebd3d --- /dev/null +++ b/plugins/de.fraunhofer.ipa.ros1.xtext.ide/src/de/fraunhofer/ipa/ros1/ide/launch/ServerLauncher.java @@ -0,0 +1,55 @@ +package de.fraunhofer.ipa.ros1.ide.launch; + +import java.io.IOException; +import java.net.InetSocketAddress; +import java.net.SocketAddress; +import java.nio.channels.AsynchronousServerSocketChannel; +import java.nio.channels.AsynchronousSocketChannel; +import java.nio.channels.Channels; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.function.Function; + +import org.eclipse.lsp4j.jsonrpc.Launcher; +import org.eclipse.lsp4j.jsonrpc.MessageConsumer; +import org.eclipse.lsp4j.services.LanguageClient; +import org.eclipse.xtext.ide.server.LanguageServerImpl; +import org.eclipse.xtext.ide.server.ServerModule; + +import com.google.inject.Guice; +import com.google.inject.Injector; + +public class ServerLauncher { + public static void main(String[] args) throws InterruptedException, IOException { + Injector injector = Guice.createInjector(new ServerModule()); + LanguageServerImpl languageServer = injector.getInstance(LanguageServerImpl.class); + Function wrapper = consumer -> { + MessageConsumer result = consumer; + return result; + }; + Launcher launcher = createSocketLauncher(languageServer, LanguageClient.class, + new InetSocketAddress("localhost", 5008), Executors.newCachedThreadPool(), wrapper); + languageServer.connect(launcher.getRemoteProxy()); + Future future = launcher.startListening(); + while (!future.isDone()) { + Thread.sleep(10_000l); + } + } + + static Launcher createSocketLauncher(Object localService, Class remoteInterface, + SocketAddress socketAddress, ExecutorService executorService, + Function wrapper) throws IOException { + AsynchronousServerSocketChannel serverSocket = AsynchronousServerSocketChannel.open().bind(socketAddress); + AsynchronousSocketChannel socketChannel; + try { + socketChannel = serverSocket.accept().get(); + return Launcher.createIoLauncher(localService, remoteInterface, Channels.newInputStream(socketChannel), + Channels.newOutputStream(socketChannel), executorService, wrapper); + } catch (InterruptedException | ExecutionException e) { + e.printStackTrace(); + } + return null; + } +} \ No newline at end of file diff --git a/plugins/de.fraunhofer.ipa.ros2.xtext.ide/pom.xml b/plugins/de.fraunhofer.ipa.ros2.xtext.ide/pom.xml index 1ed02d04c..b4bf8f4b3 100644 --- a/plugins/de.fraunhofer.ipa.ros2.xtext.ide/pom.xml +++ b/plugins/de.fraunhofer.ipa.ros2.xtext.ide/pom.xml @@ -12,22 +12,124 @@ eclipse-plugin + src + + + src + + **/*.java + **/*.xtend + + + org.eclipse.xtend xtend-maven-plugin + + org.codehaus.mojo + build-helper-maven-plugin + 3.3.0 + + + add-source + initialize + + add-source + add-resource + + + + src-gen + + + + src-gen + + **/*.java + **/*.g + + + + + + + org.apache.maven.plugins - maven-clean-plugin + maven-shade-plugin + 3.2.4 + + + + de.fraunhofer.ipa.ros2.ide.launch.ServerLauncher + + + plugin.properties + + + + + + + *:* + + META-INF/INDEX.LIST + META-INF/*.SF + META-INF/*.DSA + META-INF/*.RSA + .options + .api_description + *.profile + *.html + about.* + about_files/* + plugin.xml + systembundle.properties + profile.list + **/*._trace + **/*.g + **/*.mwe2 + **/*.xtext + + + + true + ls + false + - xtend-gen-clean - clean + package + + shade + + + + ${project.groupId} + de.fraunhofer.ipa.ros.xtext + ${project.version} + + + org.eclipse.xtext + org.eclipse.xtext.ide + ${xtextVersion} + + + org.eclipse.xtext + org.eclipse.xtext.xbase.ide + ${xtextVersion} + + + diff --git a/plugins/de.fraunhofer.ipa.ros2.xtext.ide/src/de/fraunhofer/ipa/ros2/ide/launch/ServerLauncher.java b/plugins/de.fraunhofer.ipa.ros2.xtext.ide/src/de/fraunhofer/ipa/ros2/ide/launch/ServerLauncher.java new file mode 100644 index 000000000..7bf341dd9 --- /dev/null +++ b/plugins/de.fraunhofer.ipa.ros2.xtext.ide/src/de/fraunhofer/ipa/ros2/ide/launch/ServerLauncher.java @@ -0,0 +1,55 @@ +package de.fraunhofer.ipa.ros2.ide.launch; + +import java.io.IOException; +import java.net.InetSocketAddress; +import java.net.SocketAddress; +import java.nio.channels.AsynchronousServerSocketChannel; +import java.nio.channels.AsynchronousSocketChannel; +import java.nio.channels.Channels; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.function.Function; + +import org.eclipse.lsp4j.jsonrpc.Launcher; +import org.eclipse.lsp4j.jsonrpc.MessageConsumer; +import org.eclipse.lsp4j.services.LanguageClient; +import org.eclipse.xtext.ide.server.LanguageServerImpl; +import org.eclipse.xtext.ide.server.ServerModule; + +import com.google.inject.Guice; +import com.google.inject.Injector; + +public class ServerLauncher { + public static void main(String[] args) throws InterruptedException, IOException { + Injector injector = Guice.createInjector(new ServerModule()); + LanguageServerImpl languageServer = injector.getInstance(LanguageServerImpl.class); + Function wrapper = consumer -> { + MessageConsumer result = consumer; + return result; + }; + Launcher launcher = createSocketLauncher(languageServer, LanguageClient.class, + new InetSocketAddress("localhost", 5008), Executors.newCachedThreadPool(), wrapper); + languageServer.connect(launcher.getRemoteProxy()); + Future future = launcher.startListening(); + while (!future.isDone()) { + Thread.sleep(10_000l); + } + } + + static Launcher createSocketLauncher(Object localService, Class remoteInterface, + SocketAddress socketAddress, ExecutorService executorService, + Function wrapper) throws IOException { + AsynchronousServerSocketChannel serverSocket = AsynchronousServerSocketChannel.open().bind(socketAddress); + AsynchronousSocketChannel socketChannel; + try { + socketChannel = serverSocket.accept().get(); + return Launcher.createIoLauncher(localService, remoteInterface, Channels.newInputStream(socketChannel), + Channels.newOutputStream(socketChannel), executorService, wrapper); + } catch (InterruptedException | ExecutionException e) { + e.printStackTrace(); + } + return null; + } +} \ No newline at end of file