0 Replies Latest reply on Mar 15, 2013 2:06 PM by 997166

    JavaFX - SWT interoperation: application freezes


      I am building a RCP application, based on Eclipse 3.5. Thanks to two articles[1][2] that I've found on oracle.com, I have been able to implement a working RCP view, that displays a pie chart.

      Unfortunately, if I close the view and reopen it, then the applications freezes and never comes back.

      I am using JavaFX 2.2.7, under JDK on Windows 7 X64.

      Here is the code. The view is a standard subclass of org.eclipse.ui.part.ViewPart.

      Composite panel = new Composite(parent, SWT.NONE);
      RowLayout layout = new RowLayout();
      FXCanvas fxCanvas = new FXCanvas(panel, SWT.NONE) {
      public Point computeSize(int wHint, int hHint, boolean changed) {
      int width = (int) getScene().getWidth();
      int height = (int) getScene().getHeight();
      return new Point(width, height);

      Scene scene = new Scene(new Group());
      RGB rgb = panel.getBackground().getRGB();
      Color color = Color.rgb(rgb.red, rgb.green, rgb.blue);
      ObservableList<PieChart.Data> pieChartData = FXCollections.observableArrayList();
      pieChartData.add(new PieChart.Data("label1", 20));
      pieChartData.add(new PieChart.Data("label2", 20));
      pieChartData.add(new PieChart.Data("label3", 20));
      pieChartData.add(new PieChart.Data("label4", 20));
      pieChartData.add(new PieChart.Data("label5", 20));
      Chart chart = new PieChart(pieChartData);
      ((Group) scene.getRoot()).getChildren().add(chart);

      Can anyone help?