Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ide-dev] Any tips for teaching Java with Eclipse?

What comes close to Ctrl+D in Eclipse is Ctrl+Alt+Up / Down. It works line-wise. If nothing is selected it duplicates the current line in the direction given by the arrow key. It duplicates multiple lines if they are (partly) selected. Without holding down the Ctrl key the shortcut moves line(s) in the given direction.

What I use regularly is Alt+Shift+Arrow keys to grow or shrink 'refactorable' units of code.Eclipse just shows an error message if the selection cannot be refactored. If you select a variable name minus one char and hit Alt+Shift+R to rename it - JDT will only complain. With the above shortcut you can make sure that JDT can make sense out of the selection.
BTW I think IntelliJ is nicer here. I have seen it suggest suitable code segments if the current selection does not form a refactorable unit. 

If TDD is part of your tutorial then MoreUnit [1] is a helpful tool. You'll need to setup the projects or source fodlers that contains code and test first and the UI therefore ins't very nice, but then you can run tests with Ctrl+R regardless of the editor shows the code or test class and jump between code and tests with Ctrl+J.

Refactoring key bindings I usually recommend for beginners is Alt+Shift+T and Alt+Shift+S. They bring up the 'Refactoring' and 'Source' popup menus so that users get a choice of what is available and can gradually learn the direct key bindings if they wish.

What I often forget to mention to new Eclipse users is its real key feature: there is no build step. Once the editor is saved, the project is ready to run. So that's maybe something noteworthy for non-Java/non-Eclipse programmers.

A setting that I also like is to let JDT automatically insert semicolons and braces at the right position (Preferences > Java > Editor > Typing).

Good Luck!

From: Michael Scharf <eclipse@xxxxxxxxx>
To: ide-dev@xxxxxxxxxxx
Sent: Tuesday, January 5, 2016 10:40 PM
Subject: [ide-dev] Any tips for teaching Java with Eclipse?


in the next weeks I will give some Java tutorials for experienced
non-java programmers. My idea is teach Java together with eclipse.
The formula is
   Java = language + libraries + IDE;
   IDE = eclipse;

The last 3 years or so, I have been using mostly IntelliJ products
(because I do _javascript_ and web development). So, my day to day
knowledge of eclipse with Java is a bit rusty.

Therefore I am looking for tips, like shortcuts, cool options and
commands, hidden features of JDT and helpful plugins that make
eclipse really shine for Java developers.

So, what are your favorite ticks and tips that make Java development
with eclipse really fun?

Any resources with good tips and tricks?

Any plugin that really boosts the experience?

Here are some tips I have on my list:
  - save actions
  - static members for content assist
      Preferences->Java->Editor->Content Assist->Favorites
       add org.junit.Assert
  - for plain java programs use execution environments
  - write x= foo(); and then let quickfix declare x
  - generate seters/getters
  - generate equals/hash
  - ...

There are some (language independent) IntelliJ features
I miss in eclipse. Are there any plugins that add those features?

  Cmd-D     Duplicate the current selection (the same as
            Cmd-C Cmd-V Cmd-V, but without loosing the current
            paste buffer)

  Cmd-E     Shows a list of recently used editors and
            if you hit Cmd-E again it selects the next
            file in the list and you can navigate with the
            keyboard and hitting ENTER jumps to the editor
            or view:

 Cmd-Shift-V  show a history of the paste buffer


ide-dev mailing list
To change your delivery options, retrieve your password, or unsubscribe from this list, visit

Back to the top