Model my PDE!

Preview:

Citation preview

Benjamin CabéBCabe@sierrawireless.com

Agenda

PDE origins

EMF+ Forms + other cool stuff EMF Forms!

Examplary project: Declarative Services tooling

PDE as of 3.6, it is

Java model+

Text-editing framework+

OSGi integration+

Forms

March 25th, 2010© Sierra Wireless

Fair enough…

March 25th, 2010© Sierra Wireless

Bummer! A new OSGi header!

March 25th, 2010© Sierra Wireless

What do you expect from an editor?

Undo/Redo Copy/Paste Error feedback

Drag&Drop Outline Properties view

Contextual actions

March 25th, 2010© Sierra Wireless

And from an editing framework?

Standard widgets Extensible

Model-backed Simple

March 25th, 2010© Sierra Wireless

March 25th, 2010© Sierra Wireless

EMF

© Sierra Wireless

EMF Forms

A generic & tiny framework To build advanced editors on top of models Lives in PDE incubator• /cvsroot/eclipse• pde-incubator/modeling component

March 25th, 2010

EMF Forms: the Editor

EmfFormEditor<? extends EObject>• Generic editor• Configurable

• Custom Forms toolkit• Outline?• Rich error tooltips?• Source page?

March 25th, 2010© Sierra Wireless

EmfFormEditor

IEmfFormEditorConfig

EMF Forms: the Page

AbstractEmfFormPage• createContents()• bind()

March 25th, 2010© Sierra Wireless

EMF Forms: Master/Details blocks

EmfMasterDetailBlock /EmfDetailsPart• Ease the process of registering details pages• Hierarchical databinding

(DetailsObservable)

March 25th, 2010© Sierra Wireless

March 25th, 2010© Sierra Wireless

What? You’re not

using databinding

?!?

Databinding

Linking objects with each other in a declarative and simple way Allows to specify• Conversion rules• Validation policies

March 25th, 2010© Sierra Wireless

ViewModel

Controller

EMF Databinding

On top of the Edit layer Compact syntax Default behavior easily customizable

March 25th, 2010© Sierra Wireless

Databinding examples

bindingContext.bindValue(ViewerProperties.input().

observe(_propertiesMasterDetail.getTreeViewer())

,

getEditor().getInputObservable());

March 25th, 2010© Sierra Wireless

Databinding examples (MasterDetails)

bindingContext.bindValue(WidgetProperties.text(SWT.FocusOut).

observe(propertyComposite.getTextName())

, EMFEditProperties.value(getEditingDomain(),

ScrPackage.Literals.COMPONENT__NAME).

observeDetail(getCurrentSelection()));

March 25th, 2010© Sierra Wireless

EditingDomain?

Every operation on the model is a Command This command being stacked on a CommandStack

March 25th, 2010© Sierra Wireless

Undo/redo

CommandStack

Period.

March 25th, 2010© Sierra Wireless

Model validation

« Simple » validation rules• Directly in the model• Code mostly generated if you use the http://www.eclipse.org/emf/2002/Ecore#constraints annotation

• On-demand

March 25th, 2010© Sierra Wireless

Model validation

More complex rules• Contributed from the outside• Declaration• Fine-grained

March 25th, 2010© Sierra Wireless

EMF Validation

Constraints defined in extension points• Bound to specific feature(s) and operation(s)

They can be written in Java, OCL… or any language

March 25th, 2010© Sierra Wireless

Validation builder

ModelIncrementalBuilder• Generic builder• Detects modification on model files• Creates markers

• EMFFormEditor implements IGotoMarker

• Make things faster filtering on a content-type

March 25th, 2010© Sierra Wireless

DS Tooling: the model

XSD Ecore

March 25th, 2010© Sierra Wireless

DS Tooling: the model

March 25th, 2010© Sierra Wireless

March 25th, 2010© Sierra Wireless

Demo!

Roadmap (?)

Better text/modelsynchronization

Improve the API

Xtext integration

Exemplary project:OSGi bundle editor

Documentation

March 25th, 2010© Sierra Wireless

Feedback

PDE/UI bugzilla [modeling]

March 25th, 2010© Sierra Wireless

Thanks!

Benjamin Cabé BCabe@sierrawireless.com

March 25th, 2010© Sierra Wireless

Recommended