Recently, I did some pair programming with one of my colleagues. My colleague showed me the block selection mode. This is a small feature provided by Eclipse which I would like to share with you, today.
I knew this feature for selecting and copying some blocks from my ABAP source code. You can compare it to the short-cut CTRL+Y in SAP GUI. I guess you know this one.
This functionality on its own is already very helpful, but I didn't know that you can use this mode also to edit source code in an Eclipse editor. Therefore, here is the whole story...
We were in the following situation: We wanted to write an ABAP Unit test that has to add some source code to an internal table that has to be processed by the test. We just copied the source code for the test in our test method.
In the past, I changed the coding manually by going through each line and adding APPEND ' in the front and ' TO SOURCE_CODE. at the end of each line. Sometimes I created a small macro to save some time. But still than, I had to surround each source code line with the quote sign.
Block selection mode in Eclipse allowed us to make this change in a much easier way...
We just started block selection mode by using the short-cut Alt+Shift+A. Than we were able to select all lines in front of my source code as shown in the following screenshot.
After that we added my APPEND ' in front of each source code line in one shot...
... and did the same with ' TO SOURCE_CODE. at the end of each source code line.
Done! In this situation this saved us a lot of time, because we had to do it not just for one test!
Maybe it will save you some time in the future, too!
P.S.: To disable block selection mode you just press the short-cut Alt+Shift+A, again.