Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 529115

Summary: [code mining] CodeMining should support line header/content annotation type both
Product: [Eclipse Project] Platform Reporter: Angelo ZERR <azerr>
Component: TextAssignee: Platform-Text-Inbox <platform-text-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: daniel_megert, gautier.desaintmartinlacaze, mistria, noopur_gupta
Version: 4.8   
Target Milestone: 4.8 M6   
Hardware: All   
OS: All   
See Also: https://git.eclipse.org/r/116631
https://git.eclipse.org/c/platform/eclipse.platform.text.git/commit/?id=907bc9caff4b9a164cb7a02c3ec3cadce90578c1
https://git.eclipse.org/r/116770
https://git.eclipse.org/c/platform/eclipse.platform.text.git/commit/?id=b301c7cc39babb8889ad7b83efc279d421882ef2
Whiteboard:
Bug Depends on:    
Bug Blocks: 529011    
Attachments:
Description Flags
Java CodeMining Parameter Demo none

Description Angelo ZERR CLA 2017-12-21 12:16:10 EST
Today codemining are drawn with CodeMiningAnnotation which extends LineHeaderAnnotation which draw the content of mining only in the line header.

To support for instance annotation parameter names https://bugs.eclipse.org/bugs/show_bug.cgi?id=529011, mining should support line header/content annotation type. In other words ICodeMining API should provide the capability to define the inlined type (header or content).

Here a proposition of changes:

 * defines an enum InlinedType:

--------------------------------------
public enum InlinedType {
	Header, Content;
}
--------------------------------------

 * defines ICodeMining#getInlinedType() which is filled when code mining is created inside a codemining provider.

 * the AbstractInlinedAnnotation supports both header/content type and waits for inside the constructor the inlined type

 * LineContentAnnotation extends AbstractInlinedAnnotation  by setting in the constructor InlinedType#Content

 * LineHeaderAnnotation extends AbstractInlinedAnnotation  by setting in the constructor InlinedType#Header

 * CodeMiningAnnotation extends AbstractInlinedAnnotation and InlinedType is filled according the ICodeMining#getInlinedType()

 * the InlinedAnnotationDrawingStrategy uses InlinedType to draw the annotation.

@Mickael what do you think about that?
Comment 1 Dani Megert CLA 2018-01-29 10:08:34 EST
Please set a target milestone again when you really plan to work on it.
Comment 2 Angelo ZERR CLA 2018-01-29 10:14:10 EST
@Dani I wanted to work on this issue, but since CodeMining with large file is unusable, I'm trying to improve StyledText (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=530019 and https://bugs.eclipse.org/bugs/show_bug.cgi?id=529570)

But it's a really an hard task -( As soon as StyledText will be improved, I will work on this issue, but for the moment I take my main time to try to improve StyledText.
Comment 3 Eclipse Genie CLA 2018-02-02 13:30:57 EST
New Gerrit change created: https://git.eclipse.org/r/116631
Comment 4 Angelo ZERR CLA 2018-02-02 13:35:40 EST
Created attachment 272519 [details]
Java CodeMining Parameter Demo

Here a demo with JDT to support parameter annotation by using the "line content" codemining support. You can see in this demo "line content"/"line header" codemining support.
Comment 5 Angelo ZERR CLA 2018-02-03 03:18:43 EST
You can in the demo that parameter name have white background when lien is selected although it should be blue. 

I have tried to use StyledText#getLineBackground(int i) but it doesn't work (returns null), but it seems because this backgroudn is managed with a LineBackroundListener (CursorLinePainter).

Have you some idea how to fix that? Thanks!
Comment 7 Mickael Istria CLA 2018-02-05 09:51:53 EST
Thanks a lot Angelo!
Comment 8 Eclipse Genie CLA 2018-02-06 05:46:42 EST
New Gerrit change created: https://git.eclipse.org/r/116770
Comment 10 Noopur Gupta CLA 2018-02-06 05:47:43 EST
(In reply to Eclipse Genie from comment #9)
> Gerrit change https://git.eclipse.org/r/116770 was merged to [master].
> Commit:
> http://git.eclipse.org/c/platform/eclipse.platform.text.git/commit/?id=b301c7cc39babb8889ad7b83efc279d421882ef2
Fixed the API tools errors due to missing @since tags.