Difference between revisions of "Eclipse Tips"

From CSE231 Wiki
Jump to navigation Jump to search
Line 67: Line 67:
  
 
=JavaFX Setup=
 
=JavaFX Setup=
Install the e(fx)clipse plugin from the Marketplace [http://www.cse.wustl.edu/~cosgroved/courses/cse231/s17/setup/JavaFX.html e(fx)clipse].
+
Install the e(fx)clipse plugin from the Marketplace
 +
 
 
[[File:Marketplace JavaFX.png]]
 
[[File:Marketplace JavaFX.png]]
  

Revision as of 03:04, 19 January 2018

Eclipse is a very powerful IDE for Java development. You can download it from eclipse.org/downloads. This page will contain tips for using Eclipse more efficiently in this class.

Refresh

Sometimes after you pull from git you will find that your project needs to be refreshed. The following steps are a bit heavy handed, but often will get your project back up and working again.

Select your project in the package explorer:

  1. "F5" to refresh
  2. "Alt-F5" to refresh Maven
  3. "Project" -> "Clean..." from the menu bar.

Note in order to invoke the function keys on some laptops you need to press the Function modifier key.

Maven

Sometimes refreshing Maven isn't enough.

Maven_Force_Update

Content Assist

Content assist is amazing. You should use it.

Mac

On the Mac, the Spotlight often masks content assist. Follow this guide to set up a new keyboard shortcut of your choosing.

Windows

On Windows it is pretty easy. Just type Ctrl+SPACE.

Content Assist lambda ()->{}

set up "body" template to produce an empty lambda (see images below)

Text for the copy buffer:

() -> {
    ${cursor}
}

example usage:

type async
type ctrl+SPACE (or whatever you have mapped content assist to)
type RIGHT_ARROW
type ctrl+SPACE (or whatever you have mapped content assist to)
type ENTER

TemplatePreferences.png

LambdaTemplate.png

Content Assist async,finish imports

All classes are equal but some classes are more equal than others. The following will single out the V5 class to promote the static methods async, finish, and friends to be offered in content assist.

V5ImportStaticPreferences.png

V5ImportStaticNewFavoriteType.png

V5ImportStaticTypeSelection.png

Git Action Set

CustomizePerspective.png

ActionSetAvailability.png

GitActionSet.png

JDK Setup

By default Eclipse is often configured to use the JRE. Switching to the JDK is a easy way to get access to the Java source code which is great for tunneling in to see how the system is implemented.

Mac

https://manski.net/2011/12/eclipse-and-the-jdk-under-mac-os-x-lion/#manually-adding-a-jdk

Windows

http://www.gamefromscratch.com/post/2011/11/15/Telling-Eclipse-to-use-the-JDK-instead-of-JRE.aspx

JavaFX Setup

Install the e(fx)clipse plugin from the Marketplace

Marketplace JavaFX.png

Hierarchical Package Presentation

As the semester progresses the number of packages can get to be a bit unwieldy. Switching to Hierarchical Package Presentation might be worth trying out. EclipsePackagePresentationHighlight.png