Skip to content
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

More access to the line numbers #127

Closed
balage1551 opened this issue Mar 13, 2015 · 1 comment
Closed

More access to the line numbers #127

balage1551 opened this issue Mar 13, 2015 · 1 comment

Comments

@balage1551
Copy link

I would like to extend the functionality of the line number column by decorators (like in Eclipse, indicating errors, warnings or bookmarks, etc).

My first idea was to simply inherit from the LineNumberFactory and modify the apply method to add the additional control to. (Using, for example, a HBox to encapsulate the original control (returned by super.apply(idx)) and the decorator.

But LineNumberFactory is well hidden, which restricts to be overridden.

For one, it has no public constructor, so inheriting is impossible (If the intention was this, mark the class final to be more obvious).
So my only option would be:
(1) Use decorator pattern: encapsulating an original LineNumberFactory instance and delegating all the non-private methods.
(2) Copy the whole source of LineNumberFactory and add the code to it.

Both solution would generate a huge amount of unnecessary boiler code, and would be fragile to future implementation changes on the original class.

It would be most welcome to have better support for this. It also would raise the need to provide mechanism to be able to attach additional information to the paragraphs (lines): this additional model data could be used to pass the required information for the decorators, such as error messages.

@TomasMikula
Copy link
Member

Hi,

the preferred way to do this is composition instead of inheritance. See my answer here on how to add a little line pointer next to the line number.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants