diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/JavaLanguageServerPlugin.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/JavaLanguageServerPlugin.java index 8c9cc28f88..cc0a2e6994 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/JavaLanguageServerPlugin.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/JavaLanguageServerPlugin.java @@ -38,8 +38,6 @@ import org.eclipse.core.internal.net.ProxySelector; import org.eclipse.core.net.proxy.IProxyData; import org.eclipse.core.net.proxy.IProxyService; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.IWorkspaceDescription; import org.eclipse.core.resources.IWorkspaceRoot; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; @@ -156,15 +154,6 @@ public static BundleContext getBundleContext() { @Override public void start(BundleContext bundleContext) throws Exception { super.start(bundleContext); - try { - Platform.getBundle(ResourcesPlugin.PI_RESOURCES).start(Bundle.START_TRANSIENT); - IWorkspace workspace = ResourcesPlugin.getWorkspace(); - IWorkspaceDescription description = workspace.getDescription(); - description.setAutoBuilding(false); - workspace.setDescription(description); - } catch (BundleException e) { - logException(e.getMessage(), e); - } boolean isDebug = Boolean.getBoolean("jdt.ls.debug"); try { redirectStandardStreams(isDebug); diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/LanguageServerApplication.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/LanguageServerApplication.java index b70c91411e..9a7c03dbdf 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/LanguageServerApplication.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/LanguageServerApplication.java @@ -12,8 +12,15 @@ *******************************************************************************/ package org.eclipse.jdt.ls.core.internal; +import org.eclipse.core.resources.IWorkspace; +import org.eclipse.core.resources.IWorkspaceDescription; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.Platform; import org.eclipse.equinox.app.IApplication; import org.eclipse.equinox.app.IApplicationContext; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleException; public class LanguageServerApplication implements IApplication { @@ -23,6 +30,7 @@ public class LanguageServerApplication implements IApplication { @Override public Object start(IApplicationContext context) throws Exception { + prepareWorkspace(); JavaLanguageServerPlugin.startLanguageServer(this); synchronized (waitLock) { while (!shutdown) { @@ -38,6 +46,18 @@ public Object start(IApplicationContext context) throws Exception { return IApplication.EXIT_OK; } + private static void prepareWorkspace() throws CoreException { + try { + Platform.getBundle(ResourcesPlugin.PI_RESOURCES).start(Bundle.START_TRANSIENT); + IWorkspace workspace = ResourcesPlugin.getWorkspace(); + IWorkspaceDescription description = workspace.getDescription(); + description.setAutoBuilding(false); + workspace.setDescription(description); + } catch (BundleException e) { + JavaLanguageServerPlugin.logException(e.getMessage(), e); + } + } + @Override public void stop() { synchronized (waitLock) {