e(fx)clipse 1.0 – New Features – Generate JavaFX Properties accessors

e(fx)clipse 1.0.0 is just around the corner and scheduled to be released on August 15th, while we are polishing the final bits, the Eclipse IP-Team checks our IP-Log, … .

I’d like to introduce you the new and exiting features that we worked on in the last months since we released 0.9.0 in February.

Blog series

Other posts in this series are:

The first feature we’d like to introduce is small helper who allows you to generate get*/set*/*Property methods for your JavaFX properties.

For those not familiar with JavaFX development: A JavaFX Bean works a bit different than a plain Java Bean. I guess all of you are familiar with the JavaBean-Pattern which looks like this:

public class MyBean {
  private int myInt;
  private int myReadonlyInt;

  private PropertyChangeSupport support = 
    new PropertyChangeSupport(this);

  public void addPropertyChangeListener(
    PropertyChangeListener l) {

  public void removePropertyChangeListener(
    PropertyChangeListener l) {

  public int getMyInt() {
    return myInt;

  public void setMyInt(int myInt) {

  public int getMyReadonlyInt() {
    return myReadonlyInt;

  private void setMyReadonlyInt(int myReadonlyInt) {

which is written in JavaFX like this:

public class MyFXBean {
  private IntegerProperty myInt = new SimpleIntegerPropery(this,"myInt");
  private ReadOnlyIntegerWrapper myReadonlyInt = new ReadOnlyIntegerWrapper(this,"myReadonlyInt");
  public int getMyInt() {
    return myIntProperty().get();

  public void setMyInt(int myInt) {

  public IntegerProperty myIntProperty() {
    return myInt;

  public final ReadOnlyIntegerProperty myReadonlyIntProperty() {
    return this.myReadonlyInt.getReadOnlyProperty();

  public final int getMyReadonlyInt() {
    return this.myReadonlyIntProperty().get();

While Eclipse allows you to generate Getters/Setters for the JavaBean pattern would invalid Getters/Setters for a JavaFX Bean and no accessor at all for property itself.

So this makes a good first new feature to be introduced by e(fx)clipse tooling:

A wizard who generates the methods

  • Bring up the context menu on the Editor
  • Select Generate JavaFX Getters and Setters
  • A dialog opens and shows you all JavaFX-Propertiesdialog
  • Select the properties you want to generate the accessors for the “make methods final” is good JavaFX design because subclasses should not be able to overwrite your methods. See for example also JavaFX Tip 4: Have the Final Word hence making them final is the default
  • Simply hit OK and you get the resultfinal-result

For those who prefer to use keyboard short-cuts you can use:

  • CTRL/CMD+3 – To open the Quick Assist
  • Type “Generate JavaFX” and you should already see the command you want to execute and on subsequent Quick-Assist is very likely in the previos choice section

Give it a try and get Eclipse Luna + e(fx)clipse 1.0.0 nightly build from our update-site or simply download the all-in-one package from http://efxclipse.bestsolution.at/install.html.

This entry was posted in e(fx)clipse and tagged . Bookmark the permalink.

9 Responses to e(fx)clipse 1.0 – New Features – Generate JavaFX Properties accessors

  1. Pingback: e(fx)clipse 1.0 – New Features – LayoutPanes can be controlled by CSS | Tomsondev Blog

  2. Pingback: e(fx)clipse 1.0 – New Features – CSS Gradient Editor | Tomsondev Blog

  3. Pingback: e(fx)clipse 1.0 – New Features – Drag and Drop for e4/JavaFX applications | Tomsondev Blog

  4. Pingback: JavaFX links of the week, August 11 // JavaFX News, Demos and Insight // FX Experience

  5. Pingback: e(fx)clipse 1.0 – New Features – The clever CSS-Editor who got more clever | Tomsondev Blog

  6. Pingback: e(fx)clipse 1.0 – New Features – StyledText control to build a code editor (framework) | Tomsondev Blog

  7. Pingback: e(fx)clipse 1.0 – New Features – Integration of JavaFX source and property JavaDoc | Tomsondev Blog

  8. Pingback: e(fx)clipse 1.0 – New Features – Consume none OSGi-Artifacts from a maven repository | Tomsondev Blog

  9. Pingback: e(fx)clipse 1.0 released | Tomsondev Blog

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 )

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.