Skip to content
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

Merged
merged 3 commits into from
Apr 23, 2021
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)) {
Copy link
Contributor

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).

Copy link
Contributor Author

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?

Copy link
Contributor

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?

Copy link
Contributor Author

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.

if (URIUtil.toFile(settingsURI).toPath().equals(URIUtil.toFile(uri).toPath())) {
changed = true;
break;
}
} else if (settingsURI.equals(uri)) {
changed = true;
break;
}
Expand All @@ -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)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add similar code for the settingsUri variable - 008b542#diff-f23d0258ce24117c110acd6753e8490a09fbdf0bc039d662bdffe279c8c28469L177 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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;
}
Expand Down