## e4 What's New in 2010 Release

Here are descriptions of some of the more interesting or significant changes made in the e4 incubator for the July 2010 release. They are grouped into:

- OpenSocial
- XWT Changes
- XWT Tooling Changes
- Workbench Tooling Changes
- Resources Changes
- Examples

OpenSocial
OpenSocial gadgets | OpenSocial gadgets can now be opened as views in Eclipse. Gadgets are reusable web UI components as defined in the OpenSocial Gadgets API Specification. At this point, only parts of the specification are implemented, but many existing gadgets already work. Many social websites implement this specification and can host OpenSocial Gadgets, for example iGoogle, hi5, LinkedIn, MySpace, orkut, Friendster, Ning, XING and others. The "social" aspect of OpenSocial Gadgets, including access to user data and their network of "friends", is also not yet implemented in e4 - we have focused on the Gadgets part of the specification. The procedure to add a gadget is straight-forward: Press CTRL+3 to bring up Quick Access, type "Open gadget" and press Enter. A dialog will open in which you can enter the gadget URL (for example, use `http://www.google.com/ig/modules/dictionary.xml` for a Google Dictionary gadget). A new view displaying your gadget is now available in your workbench! You can repeat the process to also display your Twitter timeline, a gadget showing the temperature at your home, etc. If your gadget is customizable, you can use the View menu to edit its preferences on a dedicated property page. You can find more details, and a list of gadgets to try, on the e4 OpenSocial wiki page. Keep in mind that the implementation is in a very early stage. Many features of the OpenSocial Gadgets specification are still missing or are not fully implemented.
XWT
Simplified JFace viewers | This release has simplified the declaration of JFace viewer. The `ILabelProvider` and `IContentProvider` are not needed any more. Here is the code for TableViewer,
    <TableViewer input="{Binding Path=employees}">
    	<TableViewer.columns>
    		<TableViewerColumn width="150" text="Name" displayMemberPath="name"/>
    		<TableViewerColumn width="150" text="Age" displayMemberPath="age"/>
    	</TableViewer.columns>
         	<TableViewer.control.layoutData>
    		<GridData horizontalAlignment="FILL" grabExcessHorizontalSpace="true"/>
    	</TableViewer.control.layoutData>
    </TableViewer>
Here is the code for ComboViewer,
      <ComboViewer input="{Binding Path=employees}" displayMemberPath="name">
    	<ComboViewer.control.layoutData>
    		<GridData horizontalAlignment="FILL"
            		grabExcessHorizontalSpace="true"/>
    	</ComboViewer.control.layoutData>
      </ComboViewer>
And the code of ListViewer
      <ListViewer input="{Binding Path=employees}" displayMemberPath="name">
    	<ListViewer.control.layoutData>
    		<GridData horizontalAlignment="FILL"
            		grabExcessHorizontalSpace="true"/>
    	</ListViewer.control.layoutData>
      </ListViewer>
ComboViewer | The `ComboViewer` of JFace can now be defined in the same way as `ListViewer` and `TableViewer` using the standard JFace class.
Viewer Filter | A new class `ViewerFilter` is provided to define a filter in a JFace viewer. This class contains a collection of `Condition` which is used as predicate to select the elements to display.
      <TableViewer Name="TableViewer" input="{Binding Path=employees}" >
    	<TableViewer.filters>
    		<ViewerFilter>
    			<ViewerFilter.conditions>
    				<Condition property="age" value="30" operator="GT"/>
    				<Condition property="name" value="Th*" operator="LIKE"/>
    			</ViewerFilter.conditions>
    		</ViewerFilter>
    	</TableViewer.filters>

    	<TableViewer.columns>
    		<TableViewerColumn width="150" text="Name" displayMemberPath="name"/>
    		<TableViewerColumn width="150" text="Age" displayMemberPath="age"/>
    	</TableViewer.columns>
      </TableViewer>
This `TableViewer` displays all employees whose name starts with "Th" and age is great than 30.
IObservable Management | A new IObservable management is implemented in XWT for each UI resource unit. XWT keeps now all instances of IObservable. It allows developers to get the IObservableValue and then modify observed values with automatically notifications in UI and in behind data. The service is provided in the main class `XWT`:
    IObservableValue XWT.getObservableValue(Object control, Object data, String path);
Master/Detail support | XWT now provides a transparent "Declarative Data Binding" solution to hide all the complexity of JFace data binding. The master/detail presentation is supported straightforward in the path expression of Data Binding. The expression language is extended to complete the missing type in programming language. For example, the element type of a collection is always missing in binary Java classes. This information is necessary to build the data binding chain in the master/detail pattern. In the following example, we have a class `Company` with a property "employees" in a collection or an array. The employees are displayed in a `ListViewer`, when user select an element, its name will be displayed in the `Label` below..
      <ListViewer name="master" input="{Binding Path=employees}" displayMemberPath="name">
    	<ListViewer.control.layoutData>
    		<GridData horizontalAlignment="FILL"
            		grabExcessHorizontalSpace="true"/>
    	</ListViewer.control.layoutData>
      </ListViewer>
      <Label text="{Binding elementName=master,path=singleSelection.(j:Employee.name)}"/>
The property "name" in the binding expression is prefixed by its type Employee and enclosed by parentheses. Here is the example Snippet017 of Jface Data binding ported in XWT:
Heterogeneous data model support | In a real application, the data model can be mixed together with the business model: Java Bean, POJO, dynamic EMF, Web service, XML, database etc. The previous release has supported most of them separately in one expression, data model could not be mixed. This release removes this limitation, it provides a total transparent Declarative Data Binding expression solution. For example, if we have two classes: one in Java and another in EMF
      public class Author {
          protected EObject content;
          ...
      }
where "content" can be an instance of Book class defined in EMF, which is a dynamic model with one attribute "title". In UI, if we just need to specify the binding in the same way,
     <Text text="{Binding path=content.(Book.title)}" />
Update Source trigger | This release integrates a new type `UpdateSourceTrigger`. In addition, a new property "updateSourceTrigger" has been added in the class `Binding` and therefore in data binding expressions. This class indicates when modifications to the data binding source model will occur. Many UI elements have only one possible trigger, such as check buttons. However text widgets have two possibilities: when the content gets changed, or when the focus is lost.
      <Text text="{Binding path=name,updateSourceTrigger=FocusOut}">
More operators in conditions | The following operators have been added in `Condition` and all classes of `Trigger` to extend the expression support:
Operator | Data type | Description
EG | Any | Equal
NE | Any | Not equal
LT | Number | Less then
GT | Number | Great then
LE | Number | Less and equal
GE | Number | Great and equal
LIKE | String | String matching. * and ? are supported.
IS_A | Any | Tests if an instance is a type
IS_KIND_OF | Type | Tests if a type is same or a subclass of another.
TreeViewer | JFace data binding has two classes, `ObservableListTreeContentProvider` and `ObservableSetTreeContentProvider`, for `TreeViewer` to handle the tree content corresponding to `List` and `Set` collections. These classes require a property to determine the content of subtree nodes. XWT relies on the same concept to support `TreeViewer`. Two classes are provided and a property "contentPath" will be used to indicate the sub-nodes:
      <ObservableListTreeContentProvider contentPath="list"/>
or:
      <ObservableSetTreeContentProvider contentPath="set"/>
The screenshot below is snippet019 from the data binding framework ported to XWT.
Eclipse forms | Eclipse Forms contains a set of customs widgets and other supporting classes to provide Web-like UIs by modestly extending SWT and/or manipulating style bits, colors, fonts and other properties in order to get the desired behavior. This technology was used throughout PDE multi-page editors and has been available as public API since Eclipse 3.0. The new plug-in `org.eclipse.e4.xwt.forms` has been added to support creation of Eclipse forms in XWT. The support includes the latest forms API from Eclipse 3.5 and earlier.
UI profile support | UI profiles are a new mechanism for meta-class management. They provide a flexible solution for managing a set of UI meta-classes, for registering new meta-classes, and for overwriting and restoring the predefined meta-classes as a whole. Three new methods are introduced in the `XWT` class: `createProfile()`, `applyProfile()`, and `restoreProfile()`. This solution is used by XWT Eclipse forms to support overwriting the standard SWT Widgets.
Data binding change notification | Data binding change notification is a tracking mechanism for all events from UI elements in a resource scope. It is particularly useful for tracking the binding data state. It is used by the e4 workbench integration to track the editor part state. Three new API methods are added in the `XWT` class, and a new interface `IChangeListener`: `addObservableChangeListener(Object context, IChangeListener listener)` `removeObservableChangeListener(Object context, IChangeListener listener)`
Workbench state management | In this release of XWT, e4 workbench integration is extended to provide automatic state management for saveable/editor parts. This state management uses data binding change notification to detect and notify the data binding state in an editor part created using XWT declarative data binding. This solution is implemented in the class `XWTSaveablePart` located in the bundle `org.eclipse.e4.xwt.ui.workbench`. All editors should inherit from this class to leverage this support. This state management support is used in the last version of the e4 Contacts demo to manage the change state of the Details part.
Data binding aggregation | In general, data binding establishes a binding from one property of a binding source to one property of a binding target. Multi-binding provides the ability to bind one binding target property to a list of source properties, and then apply logic to produce a value with the given input. In the e4 Contacts demo, a full name is composed of two properties: first name and last name. A Text field is bound to a composite virtual property:
    <Text>
      <Text.text>
        <MultiBinding>
          <Binding path="firstName"/>
          <Binding path="lastName"/>
        </MultiBinding>
      </Text.text>
    </Text>
Animation | This release includes initial integration with Trident, an animation engine for Java. This integration consists of the following elementary classes: `ColorAnimation` `IntAnimation` `PointAnimation` `RectangleAnimation` These classes are driven by the class `Storyboard` via Event Trigger. Here is an example for the fade transition:
    <Shell xmlns="http://www.eclipse.org/xwt/presentation"
    	xmlns:x="http://www.eclipse.org/xwt"
    	name="window">
    	<Shell.layout>
    		<GridLayout numColumns="1"/>
    	</Shell.layout>
    	<Label name="labelTarget" text="Int the animation"/>

    	<Button name="startButton" text="Start Animation">
    	  <Button.triggers>
    	    <EventTrigger routedEvent="SelectionEvent">
    	      <BeginStoryboard name="MyBeginStoryboard">
    	        <Storyboard>
    	          <IntAnimation
    	             targetName="window"
    	             targetProperty="alpha"
    	               duration="0:0:3" from="0" to="255" />
    	        </Storyboard>
    	      </BeginStoryboard>
    	    </EventTrigger>
       </Button.triggers>
    	</Button>
    </Shell>
The fade animation starts when we click on the button "Start animation", it lasts for three seconds and the alpha value will change from 0 to 255.
Data binding validation and error handling | Validation is the last step in data binding operations during an update. In general, the result needs to be displayed in the UI to notify end users. There are several way to perform this notification: decoration, status bars, tool tips, message dialogs, etc. A generic solution is implemented in this release to support all the most useful error handling mechanisms of data binding. This solution itself relies on data binding. Here is an example of a status bar that manages two `Text` fields.
Support for null layout | The standard SWT Composite has no layout by default. Its children can be manually positioned and arranged by the coordination x and y. It is known as Null Layout. In case of a Composite with a pre-defined layout, when this UI element is marked up in XWT, it is possible to need removing the layout and use it without layout. With this release, it can be done using an extension of markup "Null". For example, MyFillComposite is a Composite with a FillLayout, we can create one without layout in the following way:
         <MyFillComposite layout-"{x:Null}"/>
Resource pre-processing | By default, XWT UI resources are loaded directly to create runtime SWT UI controls. In some cases, we need to change dynamically some UIs during runtime. For example, it could be useful to change the UIs through some conditions such as security rules, user privileges, application context etc. To meet this requirement, a pre-processing mechanism is introduced. A callback will be called just after the loading of XWT Resource if the following option is provided in XWT.loadWithOptions().
       options.get(IXWTLoader.BEFORE_PARSING_CALLBACK, preprocessor);
       XWT.loadWithOptions(url, options);
where the variable "preprocessor" is an instance of the type IBeforeParsingCallback.
XWT Tooling
XWT visual designer | XWT Visual Designer is a visual editor-like WYSIWYG tool. It is designed to allow applications to be designed by non-software engineers. Here is the summary of the main features supported by XWT Visual Designer: A tool palette view WYSIWYG authoring Support for SWT and JFace Support for XML editing with code completion Integration with the tabbed Properties view Hierarchical outline view with DnD operation, copy/paste and undo/redo Support for all layouts: including `SashForm` String externalization Surround With Widget style change via context menus Advanced control binding editing This tool is tested on Windows, Linux and Mac OS Carbon/Cocoa.
Part creation | XWT Visual Designer provides a palette tool for creating an empty `Part` implementation. A dialog is presented during part creation: It is possible to create a Java based part or an XWT based part. If the data context type is provided, the UI form is generated through the bean structure.
XWT input part | An input part is a part that reads its root data from a data source such as a file. A Contributed Input Part palette tool has been added to create a part that reads data from an EMF file. After having provided the EMF data file in the creation option dialog, we can select the root object such as Customer. For a collection property, it is possible to check the option "Master/Detail" to generate the necessary code to update "Selection" property of the Eclipse selection service when an item gets selected. The UI form for the Part is generated in XWT through the data structure and user selection.
XWT Selection Part | A "Selection Part" is a part that displays the selected element in the Eclipse selection service. During the "Selection Part" creation using the "Contributed Selection Part" tool in the palette, an option dialog is presented that requires a data type. The data type can be a type defined in an EMF data file, or directly in a Java class. The tool also allows you to select the properties to display. With "Input Part" palette tool, we can create an e4 application in Master/Detail presentation pattern without one line hand code.
Workbench Tooling
New visual design tool | e4 Workbench Visual Designer is a visual editor-like WYSIWYG tool for e4 workbench authoring. The designer allows you to assemble and layout an e4 application visually without needing programming or EMF knowledge. It reuses many components from XWT Visual Designer. The following components/features are implemented: A tool palette view WYSIWYG authoring Part layout reorganization using DnD Integration with the standard Properties view Hierarchical outline view This tool is tested on Windows, Linux and Mac OS Carbon/Cocoa.
e4 project wizard | A project wizard has been added to help creating a simple e4 application project. A screencast is provided to help getting started with an e4 application. It shows how to develop, run and deploy an e4 application using the e4 wizard and e4 Visual Designer.
Hierarchical outline view | The following new features have been added to the hierarchical Outline view of e4 Workbench Visual Designer: DnD for moving and copy DnD creation from Palette Copy/Paste/Cut Undo/Redo
Model integrity control | Model integrity control in the current e4 workbench is very weak. The only model integrity control currently provided is the integrity of the java programming language itself. The UI meta model provides almost no integrity checking. Since e4 Visual Designer relies on the UI meta model, we need additional model integrity control. A command-based mechanism has been added in both the Outline view and WYSIWYG editor to guarantee the correctness of the UI model and provides the undo/redo capability.
Perspective switching | The Outline view of the e4 Workbench Visual Designer has a command to switch from one perspective to another. This allows you to design multiple perspectives for your application from within the visual design tool.
Change the active part | The Outline view and WYSIWYG editor of e4 Workbench Visual Designer has a command to change the active part contained in a `PartStack`. This allows you to design each part within a stack using the visual design tool.
Search capability | This release provides a useful search operation in the visual design view and Outline view via the context menu. Three submenu entries are created, corresponding to three kinds of search on Element Name, Element Id and Contribution URI. The found element will be selected in the current part view. This feature is a basic operation that can be used to setup the references between any elements in the Properties view.
Category display in hierarchical outline view | Previously, the visual designer's Outline view used an EMF-generated tree view to display the contents of Workbench elements. All contained elements were displayed as children in a flat list. For example, The elements of Handler and Command were displayed at the same level as the Trimmed Window. This release changes the view by adding the categories as defined by the containment property, except the children property.
Child creation via context menu | In the visual designer's Outline view and Visual Design view, a context menu "New" is added for each node to create an immediate child. After the calling of this menu, a dialog in Rich UI is displayed for data initialization, in which all required information (denoted by "*") must be provided.
Editing in Properties view | A user-friendly editor in the visual designer has been added to he Properties view under a delegate tab.
Advanced workbench model editor | A new form-based editor has been introduced that provides support for editing the workbench model in a more natural way than the default reflective editor that comes with EMF. This first version supports: Editing the model at design time Editing a live model in a running e4 application instance Integration with JDT to define contributions using auto-completion
Single sourcing | The model editor now comes with integration in the different flavors of the Eclipse Platform: Eclipse 3.6 SDK: Eclipse 4.0 SDK: "Native" e4-Application: Using the same code base. The only difference is how the component integrates into the different platforms.
Support for icon-URIs | Support for selection constructing icons URIs has been added to the form-based workbench model editor.
Support for extended applications | The workbench model editor bundle now comes with an extension point which allows it to deal with extended application models.
Resources
Semantic File System | The Semantic File System (SFS) continues the e4 work on flexible resources and brings in a capability to work with a non-file-system-based content. The SFS allows the resource model to tap a variety of sources of information that reside on the Internet or a corporate network. The minimal requirement is that the source of information exposes its content in the form of Internet resources. That is, pieces of information that can be addressed via URI/URL and transferred via a byte stream. The resource-based content will usually be accessed via the HTTP protocol but the SFS also allows plugging in other communication protocols. Remote content exposed via SFS can be mounted as a resource hierarchy underneath an Eclipse project so that standard Eclipse editors/tools can work with this content as if it were coming from the local file system. You can start playing with local-only aspects of the SFS by creating a new project and choosing SFS as a file system implementation: You can discover the full capabilities of SFS by running through SFS Examples that demonstrate additional features and aspects of the user interface.
SFS team integration | The Semantic File System integrates with different aspects of the Eclipse Platform Team support: Repository Provider to control content lifecycle (e.g. open for edit, revert, etc) Synchronization support to control flow of changes between Eclipse and remote sources of information History View Merge/Compare For example, you can share the project via the SFS Repository provider in order to enable `FileModificationValidator` and `MoveDeleteHook` functionality: Or you can open the Synchronize perspective and examine your changes using Compare Editor: For more information about Semantic File System, see the SFS wiki. The SFS is currently in an early incubation phase so that the APIs and the functionality are likely to be changed/extended in the upcoming releases.
Examples
SimpleIDE Demo | Work on another demo application has been started which shows how to write a very simple IDE like Application using pure e4-UI-Technologies For more information take a look at: e4 wiki page