GEF/GEF4/MVC

From Eclipsepedia

< GEF‎ | GEF4
Jump to: navigation, search

Note to non-wiki readers: This documentation is generated from the Eclipse wiki - if you have corrections or additions it would be awesome if you added them in the original wiki page.


Introduction

The GEF 4 MVC component provides support for building up graphical editors and views based on a model-view-controller architecture. It provides toolkit-independent MVC-support (MVC) as well JavaFX-specific specializations (MVC.FX) and Eclipse UI-integration for both (MVC.UI, MVC.FX.UI).

MVC (org.eclipse.gef4.mvc)

The MVC plug-in offers those core concepts that are independent of any concrete rendering toolkit as well as of the Eclipse UI. And while there are classpath-dependencies to org.eclipse.runtime and org.eclipse.commands, there is actually no need for an OSGi runtime (no extensions provided and no bundle activation required).

As indicated by the name, the plug-in provides a model-view-controller architecture that can be used to build up graphical editors and views.

MVC.FX (org.eclipse.gef4.mvc.fx)

MVC.UI (org.eclipse.gef4.mvc.ui)

MVC.FX.UI (org.eclipse.gef4.mvc.fx.ui)

Examples (Standalone, Web, and Eclipse UI)

We currently provide a simple example in the form of a GEF logo editor, which demonstrates the interplay of all MVC components (i.e. MVC, MVC.FX, MVC.UI, and MVC.FX.UI), and is also based on other GEF4 components. The example comes in three variants:

  • A standalone JavaFX application (org.eclipse.gef4.mvc.fx.example.FXExampleApplication)
  • A web-integrated version of the standalone application, embedded into a web page (via Java WebStart)
  • An extended version in the form of an Eclipse view (org.eclipse.gef4.mvc.fx.ui.example.view.FXExampleView), which integrates within the Eclipse Workbench operation history as well as the Eclipse UI properties view)

GEF4 MVC FX Example Web.png GEF4 MVC FX Example.png GEF4 MVC FX UI Example.png

The web-integrated version of the standalone example is provided in a bundled form on hudson.eclipse.org and can be accessed at https://hudson.eclipse.org/hudson/job/gef4-master/lastSuccessfulBuild/artifact/org.eclipse.gef4.mvc.fx.example.web-files/index.html. You will need to have the Java plug-in installed into your browser, and you may have to adjust your Java plug-in security settings to allow java content for the respective url.

Despite this, the examples are not bundled on our update-sites but rather have to be checked out in source (org.eclipse.gef4.mvc.fx.example and org.eclipse.gef4.mvc.fx.ui.example) from our GEF4 Git repository. In order to have the example plug-in compile properly, all other required GEF4 bundles will either have to be installed (in a matching version) into your running eclipse platform, added to a target definition (the already provided in the active target platform (the provided target definitions may be augmented for this purpose), or checked out in source as well (see GEF Project Contributor Guide for details on how to obtain the sources and setup your workspace). To start the Eclipse UI-integrated version, you will also need to have e(fx)clipse installed in your running eclipse platform in order to run the example.

Having prepared everything as outlined before, the standalone example might easily be started by launching org.eclipse.gef4.mvc.fx.example.FXExampleApplication via the context menu ('Run As' -> 'Java Application').

The Eclipse UI-integrated version can be launched as an Eclipse Application, not forgetting to provide the
-Dosgi.framework.extensions=org.eclipse.fx.osgi
vm argument in your launch configuration (otherwise all JavaFX classes will not be resolved, also on Java8). The example view can then easily be accessed in your runtime eclipse application via the Window->Show View->Other... menu, where it is located in the Other category.