Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Efxclipse/Tutorials/Tutorial2"

(Create an Eclipse ViewPart)
 
(15 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
{{Efxclipse}}
 +
 
== Create an Eclipse ViewPart ==
 
== Create an Eclipse ViewPart ==
  
Line 6: Line 8:
 
<li>Setup a target platform
 
<li>Setup a target platform
 
<ol>
 
<ol>
<li>On first page select "Default: Default target for running platform"</li>
+
<li>Start Eclipse with no open projects</li>
<li>Click on "Add..." and select "Software Site"</li>
+
<li>On menu item "Window", select "Preferences" and then expand the list item "Plug-in Development"</li>
<li>Point to the p2 repository at http://download.eclipse.org/efxclipse/runtime-nightly/site/</li>
+
<li>Click the list item "Plug-in Development" item "Target Platform"</li>
<li>Expand the "FX Target" entry and select "RCP 3.x Target Platform Feature"</li>
+
<li>Click Add ... </li>
<li><b>UNCHECK</b> "Include Required software"</li>
+
<li>Select "Default: Default target for the running platform".  Click the "Next" button.</li>
</ol></li>
+
<li>Enter a different name in the top text field</li>
 +
<li>Add ... </li>
 +
<li>Select Software Site </li>
 +
<li>
 +
<ul>
 +
<li>If you run on Mars: "eFX Runtime Nightly" with Url "http://download.eclipse.org/efxclipse/runtime-nightly/site" as a site</li>
 +
<li>If you run on Luna: "eFX Runtime 1.2.0" with Url "http://download.eclipse.org/efxclipse/runtime-released/1.2.0/site" as a site</li>
 +
<li>If you run on Kepler: "eFX Runtime 0.9.0" with Url "http://download.eclipse.org/efxclipse/runtime-released/0.9.0/site" as site</li>
 +
</ul></li>
 +
<li>Expand "FX Target" and check "RCP 3.x Target Platform Feature" and <b>uncheck</b> "Include required software" </li>
 +
<li>Finish </li>
 +
<li>In the list activate the new target by checking the checkbox in the list and click the Ok button.</li>
 +
</ol>
 +
<br />
 
<li>File > New > Project ... <br />
 
<li>File > New > Project ... <br />
 
[[Image:efxclipse_tut2_1.png]]
 
[[Image:efxclipse_tut2_1.png]]
 
</li>
 
</li>
<li>Select "Plug-in Project" and click the "Next" button. <br />
+
<li>Expand "Plug-in Development" and select "Plug-in Project" and click the "Next" button. <br />
 
[[Image:efxclipse_tut2_2.png]]</li>
 
[[Image:efxclipse_tut2_2.png]]</li>
 
<li>Enter a project name and click the "Next" button. <br />
 
<li>Enter a project name and click the "Next" button. <br />
Line 31: Line 46:
 
<li>Launch an "inner Eclipse" by bringing up the context menu on your project and select Run As > Eclipse Application. <br />
 
<li>Launch an "inner Eclipse" by bringing up the context menu on your project and select Run As > Eclipse Application. <br />
 
[[Image:efxclipse_tut2_9.png]]</li>
 
[[Image:efxclipse_tut2_9.png]]</li>
<li>Close the launched instance and open your the Launch Configuration and add -Dosgi.framework.extensions=org.eclipse.fx.osgi to your VM args
+
<li>Close the launched instance and open your the Launch Configuration and add -Dosgi.framework.extensions=org.eclipse.fx.osgi to your VM args and launch once more
 
</li>
 
</li>
 
<li>In the running application, bring up Quick Access (Ctrl+3) and enter "My Fx View". Select the presented choice to open your view. <br />
 
<li>In the running application, bring up Quick Access (Ctrl+3) and enter "My Fx View". Select the presented choice to open your view. <br />

Latest revision as of 03:25, 7 April 2015


Create an Eclipse ViewPart

JavaFX allows you to embed JavaFX scenes into SWT UIs using the FXCanvas class. The following tutorial will guide you through the creation of a JavaFX-enabled ViewPart.

  1. Setup a target platform
    1. Start Eclipse with no open projects
    2. On menu item "Window", select "Preferences" and then expand the list item "Plug-in Development"
    3. Click the list item "Plug-in Development" item "Target Platform"
    4. Click Add ...
    5. Select "Default: Default target for the running platform". Click the "Next" button.
    6. Enter a different name in the top text field
    7. Add ...
    8. Select Software Site
    9. Expand "FX Target" and check "RCP 3.x Target Platform Feature" and uncheck "Include required software"
    10. Finish
    11. In the list activate the new target by checking the checkbox in the list and click the Ok button.


  2. File > New > Project ...
    Efxclipse tut2 1.png
  3. Expand "Plug-in Development" and select "Plug-in Project" and click the "Next" button.
    Efxclipse tut2 2.png
  4. Enter a project name and click the "Next" button.
    Efxclipse tut2 3.png
  5. Make sure that "This plug-in will make contributions to the UI" is checked and deselect the RCP creation. Click "Next".
    Efxclipse tut2 4.png
  6. Select the "JavaFX Eclipse 3.x ViewPart" template and click "Next".
    Efxclipse tut2 5.png
  7. Keep the default settings and click "Finish".
    Efxclipse tut2 6.png
  8. The result of the wizard is a new OSGi bundle with your ViewPart class.
    Efxclipse tut2 7.png
  9. Implement your view by adding some JavaFX code to your ViewPart class.
    Efxclipse tut2 8.png
  10. Launch an "inner Eclipse" by bringing up the context menu on your project and select Run As > Eclipse Application.
    Efxclipse tut2 9.png
  11. Close the launched instance and open your the Launch Configuration and add -Dosgi.framework.extensions=org.eclipse.fx.osgi to your VM args and launch once more
  12. In the running application, bring up Quick Access (Ctrl+3) and enter "My Fx View". Select the presented choice to open your view.
    Efxclipse tut2 10.png
  13. A view with your JavaFX content will be shown at the bottom.
    Efxclipse tut2 11.png

Back to the top