From 008b542479ec26991c0835053031318a02dead19 Mon Sep 17 00:00:00 2001 From: Shi Chen Date: Thu, 22 Apr 2021 17:56:26 +0800 Subject: [PATCH 1/3] fix drive letter issue in windows Signed-off-by: Shi Chen --- .../core/internal/managers/StandardProjectsManager.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/managers/StandardProjectsManager.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/managers/StandardProjectsManager.java index 3d53653477..365bf9cb84 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/managers/StandardProjectsManager.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/managers/StandardProjectsManager.java @@ -58,6 +58,7 @@ import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.SubMonitor; +import org.eclipse.core.runtime.URIUtil; import org.eclipse.core.runtime.jobs.Job; import org.eclipse.jdt.core.IClasspathEntry; import org.eclipse.jdt.core.IJavaProject; @@ -193,7 +194,12 @@ public void fileChanged(String uriString, CHANGE_TYPE changeType) { List uris = getURIs(formatterUrl); boolean changed = false; for (URI formatterUri : uris) { - if (formatterUri.equals(uri)) { + if (Platform.OS_WIN32.equals(Platform.getOS()) && URIUtil.isFileURI(formatterUri) && URIUtil.isFileURI(uri)) { + if (URIUtil.toFile(formatterUri).toPath().equals(URIUtil.toFile(uri).toPath())) { + changed = true; + break; + } + } else if (formatterUri.equals(uri)) { changed = true; break; } From c88f8f58c051c63af12a99ecd997cc8ad69ff347 Mon Sep 17 00:00:00 2001 From: Shi Chen Date: Fri, 23 Apr 2021 10:10:59 +0800 Subject: [PATCH 2/3] add code for settingsUri Signed-off-by: Shi Chen --- .../ls/core/internal/managers/StandardProjectsManager.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/managers/StandardProjectsManager.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/managers/StandardProjectsManager.java index 365bf9cb84..54f10ef677 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/managers/StandardProjectsManager.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/managers/StandardProjectsManager.java @@ -176,7 +176,12 @@ public void fileChanged(String uriString, CHANGE_TYPE changeType) { List uris = getURIs(settingsUrl); boolean changed = false; for (URI settingsURI : uris) { - if (settingsURI.equals(uri)) { + if (Platform.OS_WIN32.equals(Platform.getOS()) && URIUtil.isFileURI(settingsURI) && URIUtil.isFileURI(uri)) { + if (URIUtil.toFile(settingsURI).toPath().equals(URIUtil.toFile(uri).toPath())) { + changed = true; + break; + } + } else if (settingsURI.equals(uri)) { changed = true; break; } From efe4e2145eca8f0b48647679317caefa541eb2de Mon Sep 17 00:00:00 2001 From: Shi Chen Date: Fri, 23 Apr 2021 13:21:51 +0800 Subject: [PATCH 3/3] use URIUtil.sameURI() Signed-off-by: Shi Chen --- .../internal/managers/StandardProjectsManager.java | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/managers/StandardProjectsManager.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/managers/StandardProjectsManager.java index 54f10ef677..d37ae3a998 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/managers/StandardProjectsManager.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/managers/StandardProjectsManager.java @@ -176,12 +176,7 @@ public void fileChanged(String uriString, CHANGE_TYPE changeType) { List uris = getURIs(settingsUrl); boolean changed = false; for (URI settingsURI : uris) { - if (Platform.OS_WIN32.equals(Platform.getOS()) && URIUtil.isFileURI(settingsURI) && URIUtil.isFileURI(uri)) { - if (URIUtil.toFile(settingsURI).toPath().equals(URIUtil.toFile(uri).toPath())) { - changed = true; - break; - } - } else if (settingsURI.equals(uri)) { + if (URIUtil.sameURI(settingsURI, uri)) { changed = true; break; } @@ -199,12 +194,7 @@ public void fileChanged(String uriString, CHANGE_TYPE changeType) { List uris = getURIs(formatterUrl); boolean changed = false; for (URI formatterUri : uris) { - if (Platform.OS_WIN32.equals(Platform.getOS()) && URIUtil.isFileURI(formatterUri) && URIUtil.isFileURI(uri)) { - if (URIUtil.toFile(formatterUri).toPath().equals(URIUtil.toFile(uri).toPath())) { - changed = true; - break; - } - } else if (formatterUri.equals(uri)) { + if (URIUtil.sameURI(formatterUri, uri)) { changed = true; break; }