Native Eclipse Features in ADT

Index

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 (Shortcut Ctrl + 1):

Refactoring is also known as Quickfix in Eclipse. Quickfix Allows:

  1. 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.
  2. 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.
  3. 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.

Rename (Shortcut Alt + Shift + R):

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:

  1. Just select the variable where it is declared
  2. Press Shortcut Alt + Shift + R or right-click on the source code for context Menu > Select Rename…
  3. Eclipse asks to choose new method/attribute/variable name
  4. Click Next and Eclipse ask to choose Transport. The option will be disabled in case of Local transport.
  5. Click Next. There can be two scenarios here:
    1. Syntax Error: If renaming causes a syntax error, Dialog shows it and Developer has the option to go back and make correction
    2. 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.
  6. Click Finish and Renaming are done for all selected dependencies.
  7. Activate the code!

Extract a Method (Shortcut Alt + Shift + M):

Extract a method to move a code block to a new method and replacing the block with a call to that new method.

Just Select the block of code and press Shortcut Alt + Shift + M. This is fun to move a piece of code. Try it yourself and trust me, it is going to help you in future.

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.

Format:

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!

Index

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s