From 43d3de1e3c6fbaaa5087fa9fcd7076c2db152007 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Spo=CC=88nemann?= Date: Thu, 6 Jul 2017 16:37:08 +0200 Subject: [PATCH] Removed workaround for eclipse/xtext-core#57 (see eclipse/xtext-core#372) --- server/build.gradle | 1 - .../kieler/elkgraph/web/ServerLauncher.xtend | 7 +- .../web/xtext/InMemoryServerModule.xtend | 23 ----- .../web/xtext/InMemoryWorkspaceConfig.xtend | 93 ------------------- .../web/xtext/LanguageServerImpl.xtend | 20 ---- 5 files changed, 5 insertions(+), 139 deletions(-) delete mode 100644 server/elkgraph-web/src/main/java/de/cau/cs/kieler/elkgraph/web/xtext/InMemoryServerModule.xtend delete mode 100644 server/elkgraph-web/src/main/java/de/cau/cs/kieler/elkgraph/web/xtext/InMemoryWorkspaceConfig.xtend delete mode 100644 server/elkgraph-web/src/main/java/de/cau/cs/kieler/elkgraph/web/xtext/LanguageServerImpl.xtend diff --git a/server/build.gradle b/server/build.gradle index dc1ed71..0df880b 100644 --- a/server/build.gradle +++ b/server/build.gradle @@ -17,7 +17,6 @@ ext.versions = [ subprojects { repositories { jcenter() - mavenLocal() maven { name 'sonatype-snapshots' url 'https://oss.sonatype.org/content/repositories/snapshots/' diff --git a/server/elkgraph-web/src/main/java/de/cau/cs/kieler/elkgraph/web/ServerLauncher.xtend b/server/elkgraph-web/src/main/java/de/cau/cs/kieler/elkgraph/web/ServerLauncher.xtend index df47cad..f9f3205 100644 --- a/server/elkgraph-web/src/main/java/de/cau/cs/kieler/elkgraph/web/ServerLauncher.xtend +++ b/server/elkgraph-web/src/main/java/de/cau/cs/kieler/elkgraph/web/ServerLauncher.xtend @@ -10,7 +10,6 @@ package de.cau.cs.kieler.elkgraph.web import com.google.inject.Guice import com.google.inject.Inject import com.google.inject.Provider -import de.cau.cs.kieler.elkgraph.web.xtext.InMemoryServerModule import java.net.InetSocketAddress import javax.websocket.server.ServerEndpointConfig import org.eclipse.elk.alg.layered.options.LayeredOptions @@ -25,12 +24,16 @@ import org.eclipse.jetty.util.log.Slf4jLog import org.eclipse.jetty.webapp.WebAppContext import org.eclipse.jetty.websocket.jsr356.server.deploy.WebSocketServerContainerInitializer import org.eclipse.xtext.ide.server.ServerModule +import org.eclipse.xtext.resource.IResourceServiceProvider import org.eclipse.xtext.util.Modules2 class ServerLauncher { def static void main(String[] args) { - val launcher = Guice.createInjector(Modules2.mixin(new ServerModule, new InMemoryServerModule)).getInstance(ServerLauncher) + val injector = Guice.createInjector(Modules2.mixin(new ServerModule, [ + bind(IResourceServiceProvider.Registry).toProvider(IResourceServiceProvider.Registry.RegistryProvider) + ])) + val launcher = injector.getInstance(ServerLauncher) launcher.initialize() launcher.start() } diff --git a/server/elkgraph-web/src/main/java/de/cau/cs/kieler/elkgraph/web/xtext/InMemoryServerModule.xtend b/server/elkgraph-web/src/main/java/de/cau/cs/kieler/elkgraph/web/xtext/InMemoryServerModule.xtend deleted file mode 100644 index 0256b8d..0000000 --- a/server/elkgraph-web/src/main/java/de/cau/cs/kieler/elkgraph/web/xtext/InMemoryServerModule.xtend +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2017 TypeFox GmbH (http://www.typefox.io) and others. - * 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 - *******************************************************************************/ -package de.cau.cs.kieler.elkgraph.web.xtext - -import com.google.inject.AbstractModule -import org.eclipse.lsp4j.services.LanguageServer -import org.eclipse.xtext.ide.server.IWorkspaceConfigFactory -import org.eclipse.xtext.resource.IResourceServiceProvider - -class InMemoryServerModule extends AbstractModule { - - override protected configure() { - bind(IResourceServiceProvider.Registry).toProvider(IResourceServiceProvider.Registry.RegistryProvider) - bind(LanguageServer).to(LanguageServerImpl) - bind(IWorkspaceConfigFactory).to(InMemoryWorkspaceConfigFactory) - } - -} \ No newline at end of file diff --git a/server/elkgraph-web/src/main/java/de/cau/cs/kieler/elkgraph/web/xtext/InMemoryWorkspaceConfig.xtend b/server/elkgraph-web/src/main/java/de/cau/cs/kieler/elkgraph/web/xtext/InMemoryWorkspaceConfig.xtend deleted file mode 100644 index 38297b3..0000000 --- a/server/elkgraph-web/src/main/java/de/cau/cs/kieler/elkgraph/web/xtext/InMemoryWorkspaceConfig.xtend +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2017 TypeFox GmbH (http://www.typefox.io) and others. - * 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 - *******************************************************************************/ -package de.cau.cs.kieler.elkgraph.web.xtext - -import org.eclipse.emf.common.util.URI -import org.eclipse.xtend.lib.annotations.Accessors -import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor -import org.eclipse.xtext.ide.server.IWorkspaceConfigFactory -import org.eclipse.xtext.workspace.IProjectConfig -import org.eclipse.xtext.workspace.ISourceFolder -import org.eclipse.xtext.workspace.IWorkspaceConfig - -import static extension org.eclipse.xtext.util.UriUtil.* - -class InMemoryWorkspaceConfigFactory implements IWorkspaceConfigFactory { - - override getWorkspaceConfig(URI workspaceBaseURI) { - val projectConfig = new InMemoryProjectConfig - return projectConfig.workspaceConfig - } - -} - -class InMemoryProjectConfig implements IProjectConfig { - - @Accessors - val URI path - - new() { - this(URI.createURI('inmemory:/')) - } - - new(URI path) { - this.path = path - } - - override getName() { - 'inmemory' - } - - override findSourceFolderContaining(URI member) { - new InMemorySourceFolder(member.trimFragment.trimSegments(1)) - } - - override getSourceFolders() { - emptySet - } - - override getWorkspaceConfig() { - new InMemoryWorkspaceConfig(this) - } - -} - -@FinalFieldsConstructor -class InMemorySourceFolder implements ISourceFolder { - - @Accessors - val URI path - - override getName() { - 'inmemory' - } - -} - -@FinalFieldsConstructor -class InMemoryWorkspaceConfig implements IWorkspaceConfig { - - val IProjectConfig projectConfig - - override findProjectByName(String name) { - if (projectConfig.name == name) - return projectConfig - } - - override findProjectContaining(URI member) { - if (projectConfig.path.isPrefixOf(member)) - return projectConfig - else - new InMemoryProjectConfig(member.trimFragment.trimSegments(1)) - } - - override getProjects() { - #{projectConfig} - } - -} \ No newline at end of file diff --git a/server/elkgraph-web/src/main/java/de/cau/cs/kieler/elkgraph/web/xtext/LanguageServerImpl.xtend b/server/elkgraph-web/src/main/java/de/cau/cs/kieler/elkgraph/web/xtext/LanguageServerImpl.xtend deleted file mode 100644 index 346445d..0000000 --- a/server/elkgraph-web/src/main/java/de/cau/cs/kieler/elkgraph/web/xtext/LanguageServerImpl.xtend +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2017 TypeFox GmbH (http://www.typefox.io) and others. - * 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 - *******************************************************************************/ -package de.cau.cs.kieler.elkgraph.web.xtext - -import org.eclipse.lsp4j.InitializeParams - -class LanguageServerImpl extends org.eclipse.xtext.ide.server.LanguageServerImpl { - - override initialize(InitializeParams params) { - if (params.rootUri === null) - params.rootUri = 'inmemory:/' - super.initialize(params) - } - -} \ No newline at end of file