Community
Participate
Working Groups
Window.getClosestMonitor() has been copied-and-pasted many times in the Eclipse platform. We should move this to an API method somewhere (either in SWT or JFace) and delete all the copies.
For 4.6 we could move this method to a separate util class (as it Javadoc) suggests and start using it without making it API, for example with the @noreference Javadoc annotation. IIRC @noreference does not create compile warnings but still avoids creating API.
We could, but we could also just wait for 4.7. I don't think there's any need to rush this cleanup since the code works fine even with the duplication.
(In reply to Stefan Xenos from comment #2) > We could, but we could also just wait for 4.7. I don't think there's any > need to rush this cleanup since the code works fine even with the > duplication. +1
While merging the code, we might also consider switching from using a "closest center point" algorithm to using a "closest perimeter point" algorithm.
Nikita, something for you to add to SWT? Note for myself: Once we have such an API, I can delete WBWRenderer#getClostestMonitor.
Nikita seem to not work on this anymore. I have another one patch "on hold" trying to copy/paste same code (https://git.eclipse.org/r/#/c/128617/). Stupid question: why do we want to have this method to a separate class? Why not just let it be in Window? If not, I would move ot to jface.util.Util class - the method uses jface.util.Geometry, so same package. My intent is to release this code and merge the patch above without code duplication, also remove remaining duplicates afterwards. Any objections?
No objections
(In reply to Lars Vogel from comment #7) > No objections To which one: keep in jface Window or move to jface Util?
(In reply to Andrey Loskutov from comment #8) > (In reply to Lars Vogel from comment #7) > > No objections > > To which one: keep in jface Window or move to jface Util? Whatever you prefer ;-)
New Gerrit change created: https://git.eclipse.org/r/131043
Gerrit change https://git.eclipse.org/r/131043 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=774e5910f7df6ec553ffe0c58dcf0b47bf6fb401
New Gerrit change created: https://git.eclipse.org/r/131052
New Gerrit change created: https://git.eclipse.org/r/131053
New Gerrit change created: https://git.eclipse.org/r/131056
Gerrit change https://git.eclipse.org/r/131052 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=7d06eee5307079772305012560960c9d7783b286
New Gerrit change created: https://git.eclipse.org/r/131073
Gerrit change https://git.eclipse.org/r/131053 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.text.git/commit/?id=bed03cffc0cc47fd681d9c57b5c04a95df805273
Gerrit change https://git.eclipse.org/r/131056 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.debug.git/commit/?id=8145992a4908a842ad58791594bbd8b5811dbc4f
Gerrit change https://git.eclipse.org/r/131073 was merged to [master]. Commit: http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=10346ec15dac3db7a9b1247fa7aabcd545febdb8
I believe to removed all duplicates I see in my workspace.
Andrey, could you add this to the N&N 4.10?