e(fx)clipse 2.4.0 released


we are happy to announce that e(fx)clipse 2.4.0 has been released last week. The main working area in this release has once more been the code editor framework.

Code editor framework

Starting with this release we are have replacement for all features one is used from your Eclipse IDE Code-Editing framework, like keyboard navigation, hover-information, … .

We’ve as always taken extra care that we are not introduce JavaFX dependencies but kept a clean split between core-services providing the plain data and visualization services presenting those plain data points (eg in JavaFX).

  • Lexical-Code-Highlighting improvements:
    • Our custom rules have been adjusted to match the highlighting behavior known from the Eclipse Java-Editor.
      Old

      New
    • New rules to eg support lua multi-line string and comments. I confess I’ve not seen a language before who has a similar concept for multi-line constructs. If you are not familiar with lua let me try to explain it. A multi-line comment starts with --[ followed by an optional number of "="-chars followed by another "[" and then ends with "]" the same amount of "="-chars than you used in the start section followed by another "]"
      --[==[
      I'm a multi line
      comment
      ]==]
      
      lua-code
      
      --[====[
      I'm a multi line
      comment
      ]====]
      

      We have enhanced our highlighting format to support this kind of rules. For lua it looks like this:

      // ...
      rule {
        multi_line __lua_ml_comment   "--[" pattern '(=*)' '['   => "]{0}]"
        single_line __lua_sl_comment  "--"  => ''
        multi_line __lua_ml_string    "["  pattern '(=*)' '['   => "]{0}]"
        single_line __lua_string      "'"   => "'" escaped by "\\"
        single_line __lua_string      '"'   => '"' escaped by "\\"
      }
      // ...
      
    • While the ldef-language allows to specify rules very easy those rules have to be defined up-front which sometimes is not possible to the highlighting needs to adapt based on other conditions. We enhanced the system to contribute rules dynamically by registering a service of type DynamicScannerRuleCalculator
  • Autocomplete improvments: You can now configure the editor to invoke auto-complete system not only on CTRL+Space but as well eg at the moment you type "."-character
  • Code navigation support: This release introduces code navigation like you know it from your Eclipse IDE (including low-level APIs to jump to positions inside your editor control)
  • Support for block matching: We implemented exemplary code to show how one can implement block matching (eg matching braces)
  • Code rearrangement with DnD: We now have support to rearrange code parts using DnD
  • Support for undo/redo: We’ve now connected the editor to the undo/redo system available in eclipse.text

e4 on JavaFX

Prebuilt Perspective Switchers

The framework now provides:

  • A perspective switcher control one can embed into the TrimBar (PerspectiveSwitcherComponent)
  • A heavy and a lightweight perspective switcher dialog and a handler to trigger the dialog the appropriate one

New tag to center MWindow

You can now add the tag "efx-center-on-screen" to your Application.e4xmi and the window will be centered on screen.

Tab-Context-Menu

One can now register MPopupMenu on an MPart who is translated into a context-menu assigned to the Tab in a TabPane. Just taq the MPopupMenu with "tabmenu" and e4 on JavaFX will take care for you to render the context menu.

Other new runtime APIs

TextUtil#templateValuSubstitutor(String,Map)

This new helper allows you to evaluate simple template expressions and applying formats on it.

class Person {
   String name = "Tom";
   Date birthday = new Date(1,4,79);
}

Person p = new Person();
TextUtil.templateValuSubstitutor( 
  "The birthday from ${p.name} is on ${p.birthday,date,short}", Collections.singletonMap("p",p) );

ImageProvider support HiDPI images

JavaFX itself supports HiDPI images already since sometime but the internal abstraction who is used by e4 on JavaFX lacked such a support. This has been fixed with this release.

Delayed observables

To appropriately support undo/redo in form based UIs it is very important to collect changes in logical units. A good example is the that you probably would not require the user to undo each and every keystroke in a text-field. To address this use case Eclipse Databinding for SWT has the concept of so called delayed observables who wait for a certain amount of time before they inform others about their modification.

Eclipse Databinding for JavaFX controls now has the same concept.

TextField f = new TextField();
IObservableValue textObs = JavaFXUIProperties.text2().observeDelayed(400, f);

Error-Decoration

For form base UIs it is crucial to display validation information. We added new API to our control-library to who supports field decorations. The API is designed to work equally well in a basic scenario as well as when using MVVM (in the same vein we added new properties you can publish in your ViewModels)

static class VM {
  private final ValidatedStringProperty firstname;
  private final ValidatedStringProperty lastname;
  private final StatusAggregator aggregator;

  public VM(String firstname, String lastname) {
    this.firstname = new ValidatedSimpleStringProperty(new SimpleStringProperty(this, "firstname",firstname));
    this.firstname.registerValidator(s -> s.isEmpty() ? Status.status(State.ERROR, -1, "Vorname muß befüllt sein", null) : Status.ok());

    this.lastname = new ValidatedSimpleStringProperty(new SimpleStringProperty(this, "lastname", lastname));
    this.lastname.registerValidator(s -> s.isEmpty() ? Status.status(State.ERROR, -1, "Nachname muß befüllt sein", null) : Status.ok());

    this.aggregator = new StatusAggregator(this.firstname,this.lastname);
  }
}

VM vm = new VM("Tom", "Schindl");

{
  Label l = new Label("Vorname");
  p.getChildren().add(l);

  TextField field = new TextField();
  field.textProperty().bindBidirectional(vm.firstname.bindProperty());

  NodeDecorator.apply(field, vm.firstname);
  p.getChildren().add(field);
}
Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

17 Responses to e(fx)clipse 2.4.0 released

  1. Pingback: JavaFX für Eclipse: e(fx)clipse 2.4.0 mit verbessertem Quellcodeeditor - JAXenter

  2. Velganesh Subramanian says:

    Hi Tom, Is the name TextUtil.templateValuSubstitutor intentional? “Valu” should be “Value”, isn’t it?

  3. Nice work. I really feel tempted to migrate Phaser Editor to a complete JavaFX based IDE 🙂 Right now we are embedding JavaFX canvas in key components like scene builder, preview windows, etc…

    By the way, is there somewhere a list with the Eclipse stuff replacements? I mean, I see you implemented an editor framework, is there a Navigator/Project views replacement too?

    • Tom Schindl says:

      We are more working towards a smart code editor who doesn’t require eg an eclipse workspace but directly interacts with the filesystem (there’s a filesystem viewer available!). So we don’t really need a replacement for Project-Navigator, … (as of today!). Our vision is to rely on external libraries and headless server to provide things like auto-complete, error-marker which is the new trend anyways (look at dart, typescript, javascript, …)

      • So you mean there is a filesystem viewer.. let me check it. The language servers are good and I think projects like JSDT are moving to that trend too, but there are concepts in the resources framework that I think there are needed yet, like delta changes and builders. Anyway I am going to check this filesystem viewer.

  4. Is this one the filesystem viewer https://tomsondev.bestsolution.at/2015/01/12/javafx-filesystem-viewers/ ? Does it allow copy/move/delete and things like that? Or it is something we should implement from scratch?

    • Tom Schindl says:

      It’s just a viewer. Another important note is that the editor uses an abstraction to access source-files and it is possible to use core-resources as well (we even have internally an implementation who does exactly that). If you want we can work on a navigator framework who is bound to core resources (similar to common-navigator for SWT).

  5. That would be great to have something like that, and not only for a complete JavaFX IDE, for example, my project is an HTML5 games IDE and JavaFX is helping a lot, because its visuality and simplicity, so I am ebedding a FXCanvas here and there. Some time ago I was tempted to implement myself a new project navigator based on JavaFX but yet is not a priority… but I believe that a JavaFX navigator framwwork could be a boost for projects like mine, because it can help a lot with inline previsualization and fancy layouts and navigation.

    Really I do not have time to implement something like that (or resources to hire someone 😦 )… but this is something that I am putting in list.

  6. Pingback: JavaFX links of the week, June 13 | JavaFX News, Demos and Insight // FX Experience

  7. Tim says:

    Hello, where can we get the newest release of the efxclipse? regards Tim

  8. L says:

    Is refactoring support planned for things like changing fx:id or onAction=”#method” handlers? This is pretty much a must-have for refactoring when working with such UI layout formats.

  9. Matthew says:

    Does e(fx)clipse 2.4.0 expect to be installed in Eclipse 4.6 (Neon), or does it also work in Eclipse 4.5 (Mars)? It would be handy if future release announcements list the Eclipse version(s) they work with – I’m sure the information is somewhere, but it’s not easy to find.
    Thanks!

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 )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s