Lightweight Dialogs in e4 & JavaFX

I’ve just checked in the initial bits to use lightweight dialogs in your e4 + JavaFX applications. You can see it in action in the short video from below

Useage is fairly simple. First you need to have dialog implementation like this:

static class OpenProjectDialogImpl extends TitleAreaDialog {
  private ListView<Project> list;
  private final CommandService cmdService;

  public OpenProjectDialogImpl(Workbench workbench, 
    CommandService cmdService, @Service List<ProjectService> projectServiceList) {

    super("Open project", 
      "Open project", "Open an existing project");
    this.cmdService = cmdService;
    list = new ListView<>();
    list.setCellFactory(v -> 
      new SimpleListCell<Project>( 
        p -> labelExtractor(p, projectServiceList), 
        p -> cssProvider(p,projectServiceList)));
  protected void handleOk() {
    if( list.getSelectionModel().getSelectedItem() != null ) {
      cmdService.execute("", Collections.singletonMap("projectId", list.getSelectionModel().getSelectedItem().getProjectId()));

and displaying it is nothing more than:

public class OpenProjectDialog {
  public void open(LightWeightDialogService dialogService) {
    dialogService.openDialog(OpenProjectDialogImpl.class, ModalityScope.WINDOW);

As you can see in the video you can choose how the dialog is opened & closed. This is done through an OSGi-Service of type LightweightDialogTransitionService:

public class FadeDialogTranstionServiceImpl extends FadeDialogTranstionService implements LightweightDialogTransitionService {
  protected void configureFadeIn(FadeTransition transition) {
  protected void configureFadeOut(FadeTransition transition) {
This entry was posted in e(fx)clipse. Bookmark the permalink.

4 Responses to Lightweight Dialogs in e4 & JavaFX

  1. Pingback: JavaFX links of the week, April 27 // JavaFX News, Demos and Insight // FX Experience

  2. pavanesh says:

    hi Tom,
    Yesterday me and my colleague (Govind) presented a topic JavaFX in Eclipse RCP @ and we got very good response from audience. People were excited to see our demos

  3. Konstantin says:

    “This is done through an OSGi-Service of type LightweightDialogTransitionService”
    that means you need to have your own implementation of LightweightDialogTransitionService as an OSGi-Service, where you can also adjust transition (easy out/in, duration, etc)

    P.S. It wasn’t clear for me for a while, could be a bit difficult for somebody else.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your 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.