Extract SelectionMode out of StyledText

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Extract SelectionMode out of StyledText

Arne Deutsch
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
_______________________________________________
platform-swt-dev mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev
Reply | Threaded
Open this post in threaded view
|

Re: Extract SelectionMode out of StyledText

Ned Twigg
I'm not an SWT developer.  I have similar needs (wanting to make non-conservative changes to SWT).  One approach I've considered would be to setup an "swt-experimental" project, with a looser contribution model, and SWT could cherry-pick proven stuff from swt-experimental.  So long as swt-experimental doesn't change the natives and rebases for every SWT release, it ought to stay manageable.

Ideally these things could be done without forking SWT, but there is some API which is package-private that makes it impossible.

A real SWT dev probably has better ideas :)

Ned Twigg
Lead Software Architect, DiffPlug LLC
540-336-8043 (cell)
888-513-6870 (fax)
340 S Lemon Ave #343
3, Walnut, CA 91789

On Sat, Aug 26, 2017 at 6:12 AM, Arne Deutsch <[hidden email]> wrote:
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
_______________________________________________
platform-swt-dev mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev


_______________________________________________
platform-swt-dev mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev
Reply | Threaded
Open this post in threaded view
|

Re: Extract SelectionMode out of StyledText

Daniel Megert
In reply to this post by Arne Deutsch
Hi Arne

Personally, I think it makes good sense if there is really a project that wants to plug in another selection mode. Otherwise it's better to spend the energy on another topic that brings additional value, e.g. some existing StyledText bugs/features.

Having said that, you're welcome to experiment with this. We have an e4 incubator project that can be used to implement and test such changes. SWT can be cloned there and you can work directly in the SWT code. Once that code has production quality, it can be moved to the platform.

HTH
Dani



From:        Arne Deutsch <[hidden email]>
To:        [hidden email]
Date:        26.08.2017 15:12
Subject:        [platform-swt-dev] Extract SelectionMode out of StyledText
Sent by:        [hidden email]




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
_______________________________________________
platform-swt-dev mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev





_______________________________________________
platform-swt-dev mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev
Reply | Threaded
Open this post in threaded view
|

Re: Extract SelectionMode out of StyledText

Ned Twigg
I'm interested in work such as this, Arne.  Happy help with code review and might have time to contribute.

Ned Twigg
Lead Software Architect, DiffPlug LLC
540-336-8043 (cell)
888-513-6870 (fax)
340 S Lemon Ave #343
3, Walnut, CA 91789

On Thu, Aug 31, 2017 at 6:55 AM, Daniel Megert <[hidden email]> wrote:
Hi Arne

Personally, I think it makes good sense if there is really a project that wants to plug in another selection mode. Otherwise it's better to spend the energy on another topic that brings additional value, e.g. some existing StyledText bugs/features.

Having said that, you're welcome to experiment with this. We have an e4 incubator project that can be used to implement and test such changes. SWT can be cloned there and you can work directly in the SWT code. Once that code has production quality, it can be moved to the platform.

HTH
Dani



From:        Arne Deutsch <[hidden email]>
To:        [hidden email]
Date:        26.08.2017 15:12
Subject:        [platform-swt-dev] Extract SelectionMode out of StyledText
Sent by:        [hidden email]




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
_______________________________________________
platform-swt-dev mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev





_______________________________________________
platform-swt-dev mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev


_______________________________________________
platform-swt-dev mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev