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

GEF/GEF4/MVC

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 GEF4 MVC Logo view, 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.examples.logo.MvcLogoExample)
  • 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.examples.logo.ui), which integrates with 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.examples.logo.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.examples.logo and org.eclipse.gef4.mvc.examples.logo.ui) 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.examples.logo.MvcLogoExample 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.

Back to the top