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.
Difference between revisions of "Efxclipse/Tutorials/Tutorial2"
(New page: = 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-enabl...) |
|||
(19 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | = Create an Eclipse ViewPart = | + | {{Efxclipse}} |
+ | |||
+ | == 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. | 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. | ||
+ | |||
+ | <ol> | ||
+ | <li>Setup a target platform | ||
+ | <ol> | ||
+ | <li>Start Eclipse with no open projects</li> | ||
+ | <li>On menu item "Window", select "Preferences" and then expand the list item "Plug-in Development"</li> | ||
+ | <li>Click the list item "Plug-in Development" item "Target Platform"</li> | ||
+ | <li>Click Add ... </li> | ||
+ | <li>Select "Default: Default target for the running platform". Click the "Next" button.</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 /> | ||
+ | [[Image:efxclipse_tut2_1.png]] | ||
+ | </li> | ||
+ | <li>Expand "Plug-in Development" and select "Plug-in Project" and click the "Next" button. <br /> | ||
+ | [[Image:efxclipse_tut2_2.png]]</li> | ||
+ | <li>Enter a project name and click the "Next" button. <br /> | ||
+ | [[Image:efxclipse_tut2_3.png]]</li> | ||
+ | <li>Make sure that "This plug-in will make contributions to the UI" is checked and deselect the RCP creation. Click "Next".<br /> | ||
+ | [[Image:efxclipse_tut2_4.png]]</li> | ||
+ | <li>Select the "JavaFX Eclipse 3.x ViewPart" template and click "Next".<br /> | ||
+ | [[Image:efxclipse_tut2_5.png]]</li> | ||
+ | <li>Keep the default settings and click "Finish". <br /> | ||
+ | [[Image:efxclipse_tut2_6.png]]</li> | ||
+ | <li>The result of the wizard is a new OSGi bundle with your ViewPart class. <br /> | ||
+ | [[Image:efxclipse_tut2_7.png]]</li> | ||
+ | <li>Implement your view by adding some JavaFX code to your ViewPart class. <br /> | ||
+ | [[Image:efxclipse_tut2_8.png]]</li> | ||
+ | <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> | ||
+ | <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>In the running application, bring up Quick Access (Ctrl+3) and enter "My Fx View". Select the presented choice to open your view. <br /> | ||
+ | [[Image:efxclipse_tut2_10.png]]</li> | ||
+ | <li>A view with your JavaFX content will be shown at the bottom. <br /> | ||
+ | [[Image:efxclipse_tut2_11.png]]</li> | ||
+ | </ol> |
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.
- Setup a target platform
- Start Eclipse with no open projects
- On menu item "Window", select "Preferences" and then expand the list item "Plug-in Development"
- Click the list item "Plug-in Development" item "Target Platform"
- Click Add ...
- Select "Default: Default target for the running platform". Click the "Next" button.
- Enter a different name in the top text field
- Add ...
- Select Software Site
-
- If you run on Mars: "eFX Runtime Nightly" with Url "http://download.eclipse.org/efxclipse/runtime-nightly/site" as a site
- 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
- 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
- Expand "FX Target" and check "RCP 3.x Target Platform Feature" and uncheck "Include required software"
- Finish
- In the list activate the new target by checking the checkbox in the list and click the Ok button.
- File > New > Project ...
- Expand "Plug-in Development" and select "Plug-in Project" and click the "Next" button.
- Enter a project name and click the "Next" button.
- Make sure that "This plug-in will make contributions to the UI" is checked and deselect the RCP creation. Click "Next".
- Select the "JavaFX Eclipse 3.x ViewPart" template and click "Next".
- Keep the default settings and click "Finish".
- The result of the wizard is a new OSGi bundle with your ViewPart class.
- Implement your view by adding some JavaFX code to your ViewPart class.
- Launch an "inner Eclipse" by bringing up the context menu on your project and select Run As > Eclipse Application.
- 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
- In the running application, bring up Quick Access (Ctrl+3) and enter "My Fx View". Select the presented choice to open your view.
- A view with your JavaFX content will be shown at the bottom.