People often ask questions that what are add-on benefits of Eclipse ADT over Classical GUI workbench. Well, there are many including offline code preservation and one the most important: Native Eclipse Features! They are easy to use yet powerful and make work easy for the day. Let’s discuss them one by one:
Refactoring is also known as Quickfix in Eclipse. Quickfix Allows:
- To create an implementation of a Class definition and vice versa: When a developer, starts writing a class in Eclipse ADT, s/he starts writing definition and implementations are to be separately written which is time-consuming. Eclipse helps here and make it easier. Just press Ctrl + 1 after writing definition and Eclipse analyzes and suggests that implementation is missing and also offers if Eclipse should create an implementation for you! Go for it and save some precious time.
- Changing visibility of components: Sometimes we forget to assign right visibility of methods/attributes. This may produce a compile-time syntax error. Quickfix comes in handy here. Just put the cursor on method/attribute, Press Ctrl + 1 and Eclipse suggests changing the visibility of the component. Analyze the options proposed by Eclipse and use them if they fit.
- Delete methods/attributes: If some of the method/attributes are extra and not needed, Quickfix also proposes them to delete. Just selecting this option will delete required methods/attributes.
We all ABAPers have faced this situation where we may need to change method or attribute name after the development is complete… & we hate it! Getting this done in Classical SAP GUI Workbench can be a long and tedious task.
Eclipse ADT provides a clever feature here which can save a lot for developer time with a lesser chance of errors. Follow following steps for rename:
- Just select the variable where it is declared
- Press Shortcut Alt + Shift + R or right-click on the source code for context Menu > Select Rename…
- Eclipse asks to choose new method/attribute/variable name
- Click Next and Eclipse ask to choose Transport. The option will be disabled in case of Local transport.
- Click Next. There can be two scenarios here:
- Syntax Error: If renaming causes a syntax error, Dialog shows it and Developer has the option to go back and make correction
- Check changes and Confirm: If renaming is not causing any syntax error, Eclipse ADT offers a dialog where it shows File-wise changes to be made. A developer should check all changes carefully before s/he proceeds.
- Click Finish and Renaming are done for all selected dependencies.
- Activate the code!
Extract a method to move a code block to a new method and replacing the block with a call to that new method.
Delete Unused Variables (Shortcut Alt + U):
Deleting unused variables can’t be easier now with Eclipse ADT. Unused variables are always reported in SLIN(Extended Program Check) and ATC(ABAP Test Cockpit) results, so it is better to always get rid of them once development is complete.
Just press Shortcuts Alt + U(Delete all unused variables) or Alt + Shift + U(Delete unused variables in selection) and ADT does the work for you.
Well, this is not an Eclipse native feature and it was always there in SAP GUI Workbench. We call it PRETTY PRINTER in ABAP workbench!