Being a heavy Eclipse user, I’ve grown accustomed to its keyboard shortcuts for moving and copying lines of text. Xcode doesn’t have a regular editing command for this, but it does offer similar functionality via user scripts. The Move Line Up and Move Line Down scripts are already there, just waiting for you to bind keys to them. Go to the script menu, which is to the left of the Help menu, and select the Edit User Scripts… menu item. Expand the disclosure triangle next to Text, and you can set keyboard shortcuts by double-clicking in the column to the right of the script names. Below is a screenshot of what the dialog will look like if you follow all of the instructions in this post.
Most users of Eclipse are familiar with its
code generation features. One of the more common of these is “Generate
hashCode() and equals()…” from the right-click -> Source (⌘-Opt-S)
menu. It roughly follows the recipe on page 33
of Joshua Bloch’s Effective Java, and it is effective in most situations.
One case where it doesn’t work is when the class is proxied.
Hibernate is just one example of a
framework that generates proxies. If the Person class below were
proxied, the default Eclipse implementation of
equals() would break.
In a Hibernate application, this can lead to anything from unnecessary
deletes and inserts to some very frustrating bugs.