-
Notifications
You must be signed in to change notification settings - Fork 228
introduce getMouseHover, getMouseOut and getMouseMove in ICodeMining #2770
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
Conversation
42d9ba4 to
1213c88
Compare
85c70a2 to
5c95b3f
Compare
|
we have API Errors here. As far as I see the version was incremented to 3.27 with 816a056 So it should be sufficient to add since tags with 3.27 to the new methods. Incrementing to 3.28 now complains that the since tag on SurroundWithBracketsStrategy is wrong. What's correct here? |
|
Do API tools have issues with "Default" methods? |
5c95b3f to
cf9fa42
Compare
bundles/org.eclipse.jface.text/src/org/eclipse/jface/text/codemining/ICodeMiningExtension.java
Outdated
Show resolved
Hide resolved
cf9fa42 to
e73bcf6
Compare
|
@mickaelistria: What do you think about this change? Is it fine from your point of view? |
| /** | ||
| * @since 3.27 | ||
| */ | ||
| public interface ICodeMiningExtension { |
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.
Instead of a new interface, you can add the new methods as default returning null to the existing interface.
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.
I tried this with [1213c88] but then got errors from the API checks. Looks like that adding a default method implementation to an existing interface makes troubles with existing interface implementations, see https://github.com/eclipse-platform/eclipse.platform/blob/master/docs/Evolving-Java-based-APIs-2.md (Adding a default method will break an existing client type if it already implements another interface that declares a default method with a matching signature)
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.
Indeed, this would require API exception. But if we evaluate that the risk of method with colliding signature is about 0, then it's fine to add default interface methods and to add API tools exceptions
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.
how can an "API tools exception" be added?
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.
+1 for default implementation. Exception can be added via quick fix
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.
so does the current version of the PR look good to you @mickaelistria and @vogella regarding the "default" methods and the API tools exception?
mickaelistria
left a comment
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.
I have no strong objection, just a suggestion inline.
I'm also wondering whether the API is actually on the best grain: here it looks like from the example that a link SelectionEvent could be a better fit. Thinking much further, it looks like the trend with code mining is to allow any rendering in here. Currently, it's just Text (drawn with native bits), but maybe it should become a free SWT Canvas to allow full widget power.
But again, no objection if you want to merge that now.
This change allows code mining implementors to react on mouse move events and call setCursor on the text widget for example.
e73bcf6 to
24173ef
Compare

This change allows code mining implementors to react on mouse move events and call setCursor on the text widget for example.
We would like to implement a similar feature like shown in the following screenshot based on the eclipse code minings.

The code mining text color can already be set by overriding the draw method of LineHeaderCodeMining. The mouse cursor handle currently cannot be currently specified by the implementor; it is hard coded in AbstractInlinedAnnotation. This pull request introduces the methods getMouseHover, getMouseOut and getMouseMove in the ICodeMining interface so that the implementor can influence what mouse cursor is shown when hovering and moving over the mining. This API is very low level and technical, but it gives the implementor all possibilities to provide its own link-like controls in the code minings.