-
Notifications
You must be signed in to change notification settings - Fork 408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Changes on Formatter profiles have no effect before reloading #1738
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
|
@@ -175,7 +176,12 @@ public void fileChanged(String uriString, CHANGE_TYPE changeType) { | |
List<URI> 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; | ||
} | ||
|
@@ -193,7 +199,12 @@ public void fileChanged(String uriString, CHANGE_TYPE changeType) { | |
List<URI> 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)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you add similar code for the settingsUri variable - 008b542#diff-f23d0258ce24117c110acd6753e8490a09fbdf0bc039d662bdffe279c8c28469L177 ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added in c88f8f5 |
||
if (URIUtil.toFile(formatterUri).toPath().equals(URIUtil.toFile(uri).toPath())) { | ||
changed = true; | ||
break; | ||
} | ||
} else if (formatterUri.equals(uri)) { | ||
changed = true; | ||
break; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could be a helper method
compareURI(URI uri1, URI uri2)
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this util be put into JDTUtils?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
org.eclipse.core.runtime.URIUtil#sameURI
seems to do the same thing you want. Could you check if that satisfies your needs?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works. I'll use it then.