eclipse 4 (e4) the next generation of rcp - jug · eclipse 4 (e4) – the next generation of rcp...

29
© 2012 EclipseSource | June 25th 2012 | http://eclipsesource.com/munich 1 Eclipse 4 (e4) the next generation of RCP Jonas Helming EclipseSource

Upload: ngomien

Post on 19-Apr-2018

230 views

Category:

Documents


7 download

TRANSCRIPT

Page 1: Eclipse 4 (e4) the next generation of RCP - JUG · Eclipse 4 (e4) – the next generation of RCP ... • e4 is an incubator Eclipse project to produce ... Adding a little Zest to

© 2012 EclipseSource | June 25th 2012 | http://eclipsesource.com/munich

1

Eclipse 4 (e4) – the next generation of RCP

Jonas Helming

EclipseSource

Page 2: Eclipse 4 (e4) the next generation of RCP - JUG · Eclipse 4 (e4) – the next generation of RCP ... • e4 is an incubator Eclipse project to produce ... Adding a little Zest to

© 2012 EclipseSource | June 25th 2012 | http://eclipsesource.com/munich

2

Who is Jonas Helming?

• Software Engineer / Trainer /

General Manager at EclipseSource

Munich

• Visiting lecturer at Technische

Universität München

• Committer at EMFStore, EMF Client

Platform, EDAPT

• Author for Eclipse Magazin, Java

aktuell and Jaxx Enter

• Blog: http://eclipsesource.com/blogs/author/jhelming/

Page 3: Eclipse 4 (e4) the next generation of RCP - JUG · Eclipse 4 (e4) – the next generation of RCP ... • e4 is an incubator Eclipse project to produce ... Adding a little Zest to

© 2012 EclipseSource | June 25th 2012 | http://eclipsesource.com/munich

3

Eclipse is…

A Java IDE

A Tools Platform

An Application Platform (Rich Client Platform)

Page 4: Eclipse 4 (e4) the next generation of RCP - JUG · Eclipse 4 (e4) – the next generation of RCP ... • e4 is an incubator Eclipse project to produce ... Adding a little Zest to

© 2012 EclipseSource | June 25th 2012 | http://eclipsesource.com/munich

4

Page 5: Eclipse 4 (e4) the next generation of RCP - JUG · Eclipse 4 (e4) – the next generation of RCP ... • e4 is an incubator Eclipse project to produce ... Adding a little Zest to

© 2012 EclipseSource | June 25th 2012 | http://eclipsesource.com/munich

5

Eclipse 4 Target

Make Eclipse RCP development more effective and the

result more visual appealing

Page 6: Eclipse 4 (e4) the next generation of RCP - JUG · Eclipse 4 (e4) – the next generation of RCP ... • e4 is an incubator Eclipse project to produce ... Adding a little Zest to

© 2012 EclipseSource | June 25th 2012 | http://eclipsesource.com/munich

6

What is e4?

• e4 is an incubator Eclipse project to produce

innovations on the platform

• Eclipse 4.x are releases which contain some parts of

the project e4

• Parts of e4 are also used in the 3.x stream

Page 7: Eclipse 4 (e4) the next generation of RCP - JUG · Eclipse 4 (e4) – the next generation of RCP ... • e4 is an incubator Eclipse project to produce ... Adding a little Zest to

© 2012 EclipseSource | June 25th 2012 | http://eclipsesource.com/munich

7

Why do we need e4?

• Innovation is difficult in 3.x

• More diverse community

• Technical improvements

• more modular

• more flexible

• less dependencies

+ Fix design mistakes from 3.x!

Page 8: Eclipse 4 (e4) the next generation of RCP - JUG · Eclipse 4 (e4) – the next generation of RCP ... • e4 is an incubator Eclipse project to produce ... Adding a little Zest to

© 2012 EclipseSource | June 25th 2012 | http://eclipsesource.com/munich

8

What is wrong with 3.x?

• Complexity

• Very complex workbench API

• Workbench is not generic (e.g. Editors)

• Hard to test

• Singletons

• Always looks like an IDE

Page 9: Eclipse 4 (e4) the next generation of RCP - JUG · Eclipse 4 (e4) – the next generation of RCP ... • e4 is an incubator Eclipse project to produce ... Adding a little Zest to

© 2012 EclipseSource | June 25th 2012 | http://eclipsesource.com/munich

9

Agenda Today

• Modeled Workbench

• Dependency Injection

• Annotations

• Services

• Outlook

Page 10: Eclipse 4 (e4) the next generation of RCP - JUG · Eclipse 4 (e4) – the next generation of RCP ... • e4 is an incubator Eclipse project to produce ... Adding a little Zest to

© 2012 EclipseSource | June 25th 2012 | http://eclipsesource.com/munich

10

Example Application

Page 11: Eclipse 4 (e4) the next generation of RCP - JUG · Eclipse 4 (e4) – the next generation of RCP ... • e4 is an incubator Eclipse project to produce ... Adding a little Zest to

© 2012 EclipseSource | June 25th 2012 | http://eclipsesource.com/munich

11

The 3.x Workbench

Page 12: Eclipse 4 (e4) the next generation of RCP - JUG · Eclipse 4 (e4) – the next generation of RCP ... • e4 is an incubator Eclipse project to produce ... Adding a little Zest to

© 2012 EclipseSource | June 25th 2012 | http://eclipsesource.com/munich

12

The modeled Workbench

• Workbench is an

EMF model

• Can be modified

like EMF

Single entry point

Editor available

Modification during

runtime

Page 13: Eclipse 4 (e4) the next generation of RCP - JUG · Eclipse 4 (e4) – the next generation of RCP ... • e4 is an incubator Eclipse project to produce ... Adding a little Zest to

© 2012 EclipseSource | June 25th 2012 | http://eclipsesource.com/munich

13

Workbench model

WorkbenchModel

DetailsView

TreeView injects

TestCase

Page 14: Eclipse 4 (e4) the next generation of RCP - JUG · Eclipse 4 (e4) – the next generation of RCP ... • e4 is an incubator Eclipse project to produce ... Adding a little Zest to

© 2012 EclipseSource | June 25th 2012 | http://eclipsesource.com/munich

14

Dependency Injection

Hollywood principle: „Do not call us, we call you!“

Your Class (POJO)

This is what I need

E4

Page 15: Eclipse 4 (e4) the next generation of RCP - JUG · Eclipse 4 (e4) – the next generation of RCP ... • e4 is an incubator Eclipse project to produce ... Adding a little Zest to

© 2012 EclipseSource | June 25th 2012 | http://eclipsesource.com/munich

15

Singletons

Singleton

Page 16: Eclipse 4 (e4) the next generation of RCP - JUG · Eclipse 4 (e4) – the next generation of RCP ... • e4 is an incubator Eclipse project to produce ... Adding a little Zest to

© 2012 EclipseSource | June 25th 2012 | http://eclipsesource.com/munich

16

Core Services

• Example: Loggin in 3.x

E4 proudly presents:

The 20 things!

Page 17: Eclipse 4 (e4) the next generation of RCP - JUG · Eclipse 4 (e4) – the next generation of RCP ... • e4 is an incubator Eclipse project to produce ... Adding a little Zest to

© 2012 EclipseSource | June 25th 2012 | http://eclipsesource.com/munich

17

Dependency Injection Details

Injections are updated if the value changes

Contexts can be hierachical

@Inject: Tries to satisfy the requested type

@Named: Define a key, which is used for look-up

@Optional: Injects null, if not available

Context

Map <String, Object>

YourClass

@Inject

SomeThing

injects

Page 18: Eclipse 4 (e4) the next generation of RCP - JUG · Eclipse 4 (e4) – the next generation of RCP ... • e4 is an incubator Eclipse project to produce ... Adding a little Zest to

© 2012 EclipseSource | June 25th 2012 | http://eclipsesource.com/munich

18

The selection service

PlayerListView

@Inject

Service1

SelectionService

PlayerListView

@Inject

Selection

sets selection retrieves selection

Page 19: Eclipse 4 (e4) the next generation of RCP - JUG · Eclipse 4 (e4) – the next generation of RCP ... • e4 is an incubator Eclipse project to produce ... Adding a little Zest to

© 2012 EclipseSource | June 25th 2012 | http://eclipsesource.com/munich

19

Annotations

A handler in 3.x

A handler in E4

How to test this?

Page 20: Eclipse 4 (e4) the next generation of RCP - JUG · Eclipse 4 (e4) – the next generation of RCP ... • e4 is an incubator Eclipse project to produce ... Adding a little Zest to

© 2012 EclipseSource | June 25th 2012 | http://eclipsesource.com/munich

20

Always looks like an IDE

Page 21: Eclipse 4 (e4) the next generation of RCP - JUG · Eclipse 4 (e4) – the next generation of RCP ... • e4 is an incubator Eclipse project to produce ... Adding a little Zest to

© 2012 EclipseSource | June 25th 2012 | http://eclipsesource.com/munich

21

Styling

Warning: I am not an artist!

CSS

Page 22: Eclipse 4 (e4) the next generation of RCP - JUG · Eclipse 4 (e4) – the next generation of RCP ... • e4 is an incubator Eclipse project to produce ... Adding a little Zest to

© 2012 EclipseSource | June 25th 2012 | http://eclipsesource.com/munich

22

Migration from 3.x?

• E4 offers a compatibility layer (Warning there have

been issues in the past).

• E4 only offers benefits, if you use the new concepts

• There are efforts to make single sourcing as easy as

possible (Tom Schindl)

• Many things like styling or dependency injection can

be used in 3.x, too!

Page 23: Eclipse 4 (e4) the next generation of RCP - JUG · Eclipse 4 (e4) – the next generation of RCP ... • e4 is an incubator Eclipse project to produce ... Adding a little Zest to

© 2012 EclipseSource | June 25th 2012 | http://eclipsesource.com/munich

23

Option1: Pure e4 Application

• Benefits:

• Use all concepts such as dependency injection, modeled

workbench, CSS

• Clean design

• Disadvantages:

• Existing UI componentes need to be migrated

• External UI componentes might not work at all!

Page 24: Eclipse 4 (e4) the next generation of RCP - JUG · Eclipse 4 (e4) – the next generation of RCP ... • e4 is an incubator Eclipse project to produce ... Adding a little Zest to

© 2012 EclipseSource | June 25th 2012 | http://eclipsesource.com/munich

24

Option 2: Pure Compatibility Layer

• Benefits:

• Clean design

• Reuse existing UI components

• Reuse external UI componentes

• Disadvantages:

• Concepts such as dependency injection, modeled

workbench are not available

• Potential instability

Page 25: Eclipse 4 (e4) the next generation of RCP - JUG · Eclipse 4 (e4) – the next generation of RCP ... • e4 is an incubator Eclipse project to produce ... Adding a little Zest to

© 2012 EclipseSource | June 25th 2012 | http://eclipsesource.com/munich

25

Option 3: Mixing e4 and 3.x

• Benefits:

• Use all concepts such as dependency injection, modeled

workbench for new components

• Reuse existing UI components

• Reuse external UI componentes

• Disadvantages:

• Almost no proof of concept

• Mix of technologies

Page 26: Eclipse 4 (e4) the next generation of RCP - JUG · Eclipse 4 (e4) – the next generation of RCP ... • e4 is an incubator Eclipse project to produce ... Adding a little Zest to

© 2012 EclipseSource | June 25th 2012 | http://eclipsesource.com/munich

26

Ways of mixing e4 with 3.x

The compatibility layer mocks org.eclipse.ui and

translates all calls and extensions to an Application

Model in the background

Option 1: Add contributions to this model. Not well

supported yet

Option 2. Register contributions as in 3.x but use a

warpper for an e4 POJO

Page 27: Eclipse 4 (e4) the next generation of RCP - JUG · Eclipse 4 (e4) – the next generation of RCP ... • e4 is an incubator Eclipse project to produce ... Adding a little Zest to

© 2012 EclipseSource | June 25th 2012 | http://eclipsesource.com/munich

27

Single Sourcing

Keep your application independant from technologies

YourWrapper

execute()

Interface

execute()

YourPOJO

execute()

Page 28: Eclipse 4 (e4) the next generation of RCP - JUG · Eclipse 4 (e4) – the next generation of RCP ... • e4 is an incubator Eclipse project to produce ... Adding a little Zest to

© 2012 EclipseSource | June 25th 2012 | http://eclipsesource.com/munich

28

More Information

• E4 Wiki

• E4 Newsgroup

• Blogs

• Tutorial: eclipsesource.com/eclipse4tutorial

• Professional Training => eclipsesource.com/munich

[email protected]

Page 29: Eclipse 4 (e4) the next generation of RCP - JUG · Eclipse 4 (e4) – the next generation of RCP ... • e4 is an incubator Eclipse project to produce ... Adding a little Zest to

© 2012 EclipseSource | June 25th 2012 | http://eclipsesource.com/munich

29

Dependency Injection

e4