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

Bug 375179

Summary: [Editor]Need option not to show annotation in the ruler.
Product: [ECD] Orion Reporter: libing wang <libingw>
Component: ClientAssignee: Silenio Quarti <Silenio_Quarti>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: Silenio_Quarti
Version: 0.4   
Target Milestone: 0.5 M1   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description libing wang CLA 2012-03-23 09:43:29 EDT
In compare editor we are showing diffs in char/word level by annotation but we do not want to introduce additional annotation rulers on either side.
Not limited to compare editor, there must be other cases that there is annotation ruler but we just want to hide certain types of annotations from the ruler.

Back to the compare editor, if we will eventually use "bigger" annotations for diff blocks we still want to hide the annotation ruler but use the current overview ruler. Is that a good approach, Silenio?
Comment 1 Silenio Quarti CLA 2012-03-23 15:50:03 EDT
There are at least two options here:

1) We let the annotation factory decide which rulers to create in createAnnotationRulers(). There are a few small changes in the editor to get this done so that it can live without the annotation/overview rulers but still have the annotation model/styler.  We could also change the default factory in editorFeatures.js to take booleans specifying which rulers to create or you could just subclass the factory.

2) We add API in editor to decide which rulers are visible. Something like:

editor.setAnnotationRulerVisible(false)
editor.setOverviewRulerVisible(false)
editor.setLineRulerVisible(false)

The second option allows for dynamically controlling this after the editor is created.  I can see it being useful for the line number ruler. For example, in eclipse the user can hide it.  I am not this applies to the annotation/overview rulers.

Of course, we could do both things as well.

Any preferences?
Comment 2 libing wang CLA 2012-03-23 16:07:20 EDT
(In reply to comment #1)
> There are at least two options here:
> 
> 1) We let the annotation factory decide which rulers to create in
> createAnnotationRulers(). There are a few small changes in the editor to get
> this done so that it can live without the annotation/overview rulers but still
> have the annotation model/styler.  We could also change the default factory in
> editorFeatures.js to take booleans specifying which rulers to create or you
> could just subclass the factory.
> 
> 2) We add API in editor to decide which rulers are visible. Something like:
> 
> editor.setAnnotationRulerVisible(false)
> editor.setOverviewRulerVisible(false)
> editor.setLineRulerVisible(false)
> 
> The second option allows for dynamically controlling this after the editor is
> created.  I can see it being useful for the line number ruler. For example, in
> eclipse the user can hide it.  I am not this applies to the annotation/overview
> rulers.
> 
> Of course, we could do both things as well.
> 
> Any preferences?

I prefer to the second. And even more, editor.setAnnotationRulerVisible(false) should be called automatically.

Lets say if the compare editor supports find in the future.
When the find&replace slide out is there the annotation ruler should show up.
I think we should have kind of logic to let certain types of annotation to be visible (search) and other type not visible(char diff) in the ruler.
If there are no visible annotations the ruler has to be removed.
Just a thought though.
Comment 3 Silenio Quarti CLA 2012-03-30 17:06:54 EDT
Added editor.setXXXRulerVisible().

Fixed
http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=7df014b7afbc53f87a2a24e4bb4dc3cba63a133b

We already have a mechanism to filter which annotations are shown in the rulers and in the annotation styler.  They will not be shown unless their type has been added to the ruler/styler by calling:

ruler/styler.addAnnotationType(type);