Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] Extract SelectionMode out of StyledText

Hi all,

I have a question about a bit bigger contributions then just simple
fixes. I have already contributed test cases for StyledText widget and
fixed an NPE but would like to contribute a bit more. Especially to the
StyledText widget because I think it is somewhat central to eclipse and
it would be good if it would get some love.

Actually I have inspected the code and think the current code style does
not scale well. For axample the block selection mode (great feature,
really appreciate it!) is added with just a bunch of if statements to
the main class. Around 800-900 LOCs of a total of around 10500 LOCs are
just added for block selection, complicating the main class. Adding a
third selection mode (e.g. select all the same words in the document as
a "poor mans rename refactoring") will not be nice, because then each
method would get a third 'if' statement.

I think it should be possible to extract some "SelectionMode" interface
and provide two implementations "DefaultSelectionMode" and
"BlockSelectionMode". This would extract more then 10% of the LOCs from
the mail class. Should ease maintanance at least. Adding some public
method to set a custom/additional SelectionMode would then enable
us/customers to add arbitrary selection modes without to complicate the
main widget further.

Of course such a refactoring would be quite some work and needs to be
done very carefully, extensivly tested. And needs agreement from
commiters. What would be the best way to initiate such a refactoring?
Just create a bugzilla ticket and start discussion there? Provide some
prototype? Would be great if you could advise about the best way to proceed.

Kind regards,
Arne Deutsch


Back to the top