I’ve recently switched from IntelliJ IDEA to VS Code to develop a JavaFX application. The “Extension Pack for Java” seems to have everything I need and I can build and debug my application just fine.
One thing I’m missing from IntelliJ is it’s support for generating JavaFX property getter and setter through the code generation menu.
In VS Code such an option is still available via the “Source Action (Alt+Ins)” menu. However, this seems to support only simple Beans getter and setter. Is there any plugin to provide the support I need? Otherwise, where can I reach out to suggest support for this?
Here’s an example of what code is generated by selecting Source Action -> Generate Getters and Setters:
public class Properties {
private SimpleBooleanProperty property; // the property field in question
// simple Beans-style getters and setters
public SimpleBooleanProperty getProperty() {
return property;
}
public void setProperty(SimpleBooleanProperty property) {
this.property = property;
}
}
But what I actually need for JavaFX to recognize these properties via reflection is this:
public class Properties {
private SimpleBooleanProperty property; // the property field in question
// proper set of getters / setters - note the additional "enabledProperty" method
public boolean getProperty() {
return property.get();
}
public BooleanProperty propertyProperty() {
return property;
}
public void setProperty(boolean value) {
this.property.set(value);
}
}