29
Benjamin Cabé [email protected]

Model my PDE!

Embed Size (px)

Citation preview

Page 2: Model my PDE!

Agenda

PDE origins

EMF+ Forms + other cool stuff EMF Forms!

Examplary project: Declarative Services tooling

Page 3: Model my PDE!

PDE as of 3.6, it is

Java model+

Text-editing framework+

OSGi integration+

Forms

March 25th, 2010© Sierra Wireless

Page 4: Model my PDE!

Fair enough…

March 25th, 2010© Sierra Wireless

Page 5: Model my PDE!

Bummer! A new OSGi header!

March 25th, 2010© Sierra Wireless

Page 6: Model my PDE!

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

Page 7: Model my PDE!

And from an editing framework?

Standard widgets Extensible

Model-backed Simple

March 25th, 2010© Sierra Wireless

Page 8: Model my PDE!

March 25th, 2010© Sierra Wireless

EMF

Page 9: Model my PDE!

© 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

Page 10: Model my PDE!

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

Page 11: Model my PDE!

EMF Forms: the Page

AbstractEmfFormPage• createContents()• bind()

March 25th, 2010© Sierra Wireless

Page 12: Model my PDE!

EMF Forms: Master/Details blocks

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

(DetailsObservable)

March 25th, 2010© Sierra Wireless

Page 13: Model my PDE!

March 25th, 2010© Sierra Wireless

What? You’re not

using databinding

?!?

Page 14: Model my PDE!

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

Page 15: Model my PDE!

EMF Databinding

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

March 25th, 2010© Sierra Wireless

Page 16: Model my PDE!

Databinding examples

bindingContext.bindValue(ViewerProperties.input().

observe(_propertiesMasterDetail.getTreeViewer())

,

getEditor().getInputObservable());

March 25th, 2010© Sierra Wireless

Page 17: Model my PDE!

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

Page 18: Model my PDE!

EditingDomain?

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

March 25th, 2010© Sierra Wireless

Page 19: Model my PDE!

Undo/redo

CommandStack

Period.

March 25th, 2010© Sierra Wireless

Page 20: Model my PDE!

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

Page 21: Model my PDE!

Model validation

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

March 25th, 2010© Sierra Wireless

Page 22: Model my PDE!

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

Page 23: Model my PDE!

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

Page 24: Model my PDE!

DS Tooling: the model

XSD Ecore

March 25th, 2010© Sierra Wireless

Page 25: Model my PDE!

DS Tooling: the model

March 25th, 2010© Sierra Wireless

Page 26: Model my PDE!

March 25th, 2010© Sierra Wireless

Demo!

Page 27: Model my PDE!

Roadmap (?)

Better text/modelsynchronization

Improve the API

Xtext integration

Exemplary project:OSGi bundle editor

Documentation

March 25th, 2010© Sierra Wireless

Page 28: Model my PDE!

Feedback

PDE/UI bugzilla [modeling]

March 25th, 2010© Sierra Wireless

Page 29: Model my PDE!

Thanks!

Benjamin Cabé [email protected]

March 25th, 2010© Sierra Wireless