-
Notifications
You must be signed in to change notification settings - Fork 113
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
Deduplicate stored launch configs of nested projects #798 #856
base: master
Are you sure you want to change the base?
Deduplicate stored launch configs of nested projects #798 #856
Conversation
Test Results 1 758 files ±0 1 758 suites ±0 1h 39m 0s ⏱️ + 14m 36s For more details on these failures, see this check. Results for commit a742866. ± Comparison against base commit 6d514be. ♻️ This comment has been updated with latest results. |
@Bananeweizen master is open do you like to finish this? |
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.
That's a nice enhancement, the issue bothered me as well.
The same could be done for PDE's target files which are also found multiple times, in the preferences and by Oomph (not sure if it is Oomph's fault).
IContainer container = getContainer(); | ||
if (container == null) { | ||
return getName().hashCode(); | ||
} else { | ||
return getName().hashCode() + container.hashCode(); | ||
int result = getName().hashCode(); | ||
if (container != null) { | ||
result += container.hashCode(); | ||
} | ||
IPath location = getLocation(); | ||
if (location != null) { | ||
result += location.hashCode(); | ||
} | ||
return result; |
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.
What about just one line?
return Objects.hash(getName(), getContainer(), getLocation());
@Bananeweizen |
8ef4484
to
a359e6e
Compare
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.
@Bananeweizen do you have plans to complete this?
@@ -369,7 +369,7 @@ public boolean equals(Object object) { | |||
LaunchConfiguration config = (LaunchConfiguration) object; | |||
if (!config.isWorkingCopy()) { | |||
return getName().equals(config.getName()) && | |||
equalOrNull(getContainer(), config.getContainer()); | |||
(equalOrNull(getContainer(), config.getContainer()) || equalOrNull(getLocation(), config.getLocation())); |
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.
(equalOrNull(getContainer(), config.getContainer()) || equalOrNull(getLocation(), config.getLocation())); | |
(Objects.equals(getContainer(), config.getContainer()) || Objects.equals(getLocation(), config.getLocation())); |
…#798 Fixes eclipse-platform#798. m2e projects can be nested (e.g. modules stored inside a reactor). Launch configs stored the inner nested projects appear twice, because they are not equal with the old implementation checking only name and container. Therefore also check the resolved location if the containers are different. I've tested this with an m2e IDE containing such nested projects and stored launch configs. The duplicates are gone with the change.
a359e6e
to
a742866
Compare
Fixes #798.
m2e projects can be nested (e.g. modules stored inside a reactor). Launch configs stored the inner nested projects appear twice, because they are not equal with the old implementation checking only name and container. Therefore also check the resolved location if the containers are different.
I've tested this with an m2e IDE containing such nested projects and stored launch configs. The duplicates are gone with the change.