From 2e3fdec2813de535f0fc95a30e81972acf784160 Mon Sep 17 00:00:00 2001 From: Snjezana Peco Date: Fri, 12 Apr 2019 05:49:51 +0200 Subject: [PATCH] Fix build on Windows Signed-off-by: Snjezana Peco --- .../internal/handlers/JDTLanguageServer.java | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/JDTLanguageServer.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/JDTLanguageServer.java index 9a856b16bf..ae6c97c5f0 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/JDTLanguageServer.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/JDTLanguageServer.java @@ -31,6 +31,7 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.OperationCanceledException; import org.eclipse.core.runtime.jobs.IJobManager; import org.eclipse.core.runtime.jobs.Job; @@ -304,27 +305,32 @@ private CodeActionOptions getCodeActionOptions() { @Override public CompletableFuture shutdown() { logInfo(">> shutdown"); + disconnectFromWorkspace(); return computeAsync((monitor) -> { - try { - JavaRuntime.removeVMInstallChangedListener(jvmConfigurator); - if (workspaceDiagnosticsHandler != null) { - workspaceDiagnosticsHandler.removeResourceChangeListener(); - workspaceDiagnosticsHandler = null; - } - ResourcesPlugin.getWorkspace().save(true, monitor); - } catch (CoreException e) { - logException(e.getMessage(), e); - } return new Object(); }); } + private void disconnectFromWorkspace() { + try { + JavaRuntime.removeVMInstallChangedListener(jvmConfigurator); + if (workspaceDiagnosticsHandler != null) { + workspaceDiagnosticsHandler.removeResourceChangeListener(); + workspaceDiagnosticsHandler = null; + } + ResourcesPlugin.getWorkspace().save(true, new NullProgressMonitor()); + } catch (CoreException e) { + logException(e.getMessage(), e); + } + } + /* (non-Javadoc) * @see org.eclipse.lsp4j.services.LanguageServer#exit() */ @Override public void exit() { logInfo(">> exit"); + disconnectFromWorkspace(); JavaLanguageServerPlugin.getLanguageServer().exit(); Executors.newSingleThreadScheduledExecutor().schedule(() -> { logInfo("Forcing exit after 1 min.");