+ All Categories
Home > Documents > The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$...

The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$...

Date post: 04-May-2020
Category:
Upload: others
View: 2 times
Download: 0 times
Share this document with a friend
84
Budapesti Műszaki és Gazdaságtudományi Egyetem Méréstechnika és Információs Rendszerek Tanszék The New Generation of the Eclipse Platform
Transcript
Page 1: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Budapesti  Műszaki  és  Gazdaságtudományi  Egyetem  Méréstechnika  és  Információs  Rendszerek  Tanszék

The  New  Generation  of the  Eclipse  Platform

Page 2: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Eclipse  RCP▪ For  developing  client  applications  

o Based  on  the  Eclipse  workbench  model  o But  without  IDE  functionality  • Or  possibly  including  a  limited  function  set  

▪ Since  Eclipse  3.0  (2004)  o Eclipse  IDE  is  a  specific  Eclipse  application

Page 3: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Eclipse  Application  Platform  4.x▪ Rework  of  Eclipse  RCP  platform  ▪ Goals  

o Easier  programming  o Better  reuse  o Compatibility  • Using  a  compatibility  layer

3

Page 4: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Eclipse  Application  Platform  4.x▪ Most  important  new  functions  

o Context  handling  • Platform  service  access  • Dependency  Injection  

o EMF-­‐based  workbench  model  • Editor  and  view  are  not  separate  entities  

o CSS  based  theming  • RCP  application  should  look  different  to  IDE

Page 5: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Glossary▪ e4  

o Incubation  project  at  eclipse.org  o Collection  of  new  generation  techniques  o Eclipse  4.x  Application  Platform  started  here  

▪ Eclipse  4.x  o New  release  of  the  platform  o New  services  o Can  be  used  a  stable  base  software

Page 6: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Accessing  services

Based  on  the  “What’s  the  context?”  talk  from  EclipseCon  2009

6

Page 7: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Service  access  -­‐  3.x

Custom  view,  editor

Selection

Lifecycle

Extension  handling

Resources

Workbench  access

Page 8: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Service  access  -­‐  3.x

Custom  view,  editor

Selection

Lifecycle

Extension  handling

Resources

Workbench  access

Base  class#getSite()  .getSelectionProvider()

Page 9: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Service  access  -­‐  3.x

Custom  view,  editor

Selection

Lifecycle

Extension  handling

Resources

Workbench  access

Base  class#createPartControl(),  

save(),  …

Page 10: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Service  access  -­‐  3.x

Custom  view,  editor

Selection

Lifecycle

Extension  handling

Resources

Workbench  access

Platform  .getExtensionRegistry()

Page 11: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Service  access  -­‐  3.x

Custom  view,  editor

Selection

Lifecycle

Extension  handling

Resources

Workbench  access

PlatformUI  .getWorkbench()

Page 12: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Service  access  -­‐  3.x

Custom  view,  editor

Selection

Lifecycle

Extension  handling

Resources

Workbench  access

ResourcesPlugin  .getWorkspace()

Page 13: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Service  access  -­‐  3.x

Custom  view,  editor

Selection

Lifecycle

Extension  handling

Resources

Workbench  access

Page 14: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Singleton  service  providers

Page 15: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Singleton  service  providers▪ Accessing  common  services  

o Not  always  provided  by  the  Platform  itself

Page 16: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Singleton  service  providers▪ Accessing  common  services  

o Not  always  provided  by  the  Platform  itself

▪ Nice  and  comfortable  solution  o Simple  client  code  o Information  hiding:  returning  service  interface  

▪ …At  first  glance  oWhat  is  the  problem?

Page 17: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Singleton  service  providers▪ Alternative  providers?  

o Service  stub  for  testing  o Remote  services  

▪ Reuse  services  at  different  locations  o Using  editor  (or  view)  inside  a  dialog  • E.g.  textual  editor  in  a  Preference  page

Page 18: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Singleton  service  providers▪ Alternative  providers?  

o Service  stub  for  testing  o Remote  services  

▪ Reuse  services  at  different  locations  o Using  editor  (or  view)  inside  a  dialog  • E.g.  textual  editor  in  a  Preference  page

Environment  hard-­‐coded  in  a  single  plug-­‐in  

Page 19: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Hardcoded  environment  -­‐  example▪ Eclipse  IDE  

o Exactly  one  IWorkspace  o Client:  ResourcesPlugin.getWorkspace()  

▪ Bespin  IDE  o Experimental  project  from  2009  (Mozilla)  o IDE  in  the  web  o Goal:  different  IWorkspace  instances  for  each  user  o Client  • Removing  singleton  references  is  a  lot  of  work

10

Page 20: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Defining  custom  services▪ Singleton  provider  

o Such  as  Eclipse  3.x  platform  

▪ OSGi  service  o Easier  to  integrate  • Manager  classes  for  service  access  • OSGi  code  written  by  hand  

o Declarative  services  • Direct  integration  problematic  • Instantiation  by  DS  or  Eclipse?

11

Page 21: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Event  Handling  –  I.▪ Event  

o If  a  data  is  interesting,  usually  its  changes  as  well!  

▪ Many  event  types  o Service  appearance/disappearance  o Service  specific  listener  • Resource  changes  • Selection  Service  

o User  interface  • Data  binding  • Editor/view  lifecycle  events

12

Page 22: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Example:  Workbench  window  change▪ Several  thousand  events  

oMain  cause:  Complex  event  chains  (event  storm)

13

Page 23: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Event  Handling  –  II.▪ Problems  

oMultiple  event  handling  o Complex,  implicit  effects  between  listeners  • Unnecessary  event  handling  in  inconsistent  states  • Event  storm  

o For  simple  cases  • Many,  repeated  code  • Easy  to  miss  something

Page 24: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Base  problem▪ Problem  

o Extension  knows  service  provider  

▪ Solution:  indirection  o Service  provider  is  a  parameter  of  a  class  o On  extension  instantiation  • Collect  services  • Set  up  parameters  

o Platform  can  do  all  of  this  • If  it  knows  the  list  of  available  services

Page 25: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Service  access  –  3.x

16

Custom  view,  editor

Selection

Lifecycle

Extension  handling

Resources

Accessing  Workbench

Page 26: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Service  access  –  4.x

Custom  view,  editor

Selection

Lifecycle

Extension  handling

Resources

Accessing  Workbench

Page 27: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Service  access  –  4.x

Custom  view,  editor

Selection

Lifecycle

Extension  handling

Resources

Accessing  Workbench

Context

Page 28: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Context▪ Platform  service  access  

o Built-­‐in  services  • Resources,  selection,  etc.  

o Properties  • Preferences  • Hierarchic  key-­‐value  pairs  

o OSGi  services  o Common  event  handling!

18

Page 29: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Service  access  –  I.▪ Context  is  accessed  via  

o Dependency  injection  (@inject  annotation)  

@Injectpublic void execute(@Named(IServiceConstants.SELECTION) @Optional IResource file) { // do something  }

19

Page 30: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Service  access  –  I.▪ Context  is  accessed  via  

o Dependency  injection  (@inject  annotation)  

@Injectpublic void execute(@Named(IServiceConstants.SELECTION) @Optional IResource file) { // do something  }

19

Lets  inject...

Page 31: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Service  access  –  I.▪ Context  is  accessed  via  

o Dependency  injection  (@inject  annotation)  

@Injectpublic void execute(@Named(IServiceConstants.SELECTION) @Optional IResource file) { // do something  }

19

Lets  inject...

...  the  selection  variable,  ...

Page 32: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Service  access  –  I.▪ Context  is  accessed  via  

o Dependency  injection  (@inject  annotation)  

@Injectpublic void execute(@Named(IServiceConstants.SELECTION) @Optional IResource file) { // do something  }

19

Lets  inject...

...  the  selection  variable,  ...

...  that  might  be  empty  ...

Page 33: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Service  access  –  I.▪ Context  is  accessed  via  

o Dependency  injection  (@inject  annotation)  

@Injectpublic void execute(@Named(IServiceConstants.SELECTION) @Optional IResource file) { // do something  }

19

Lets  inject...

...  the  selection  variable,  ...

...  that  might  be  empty  ...

and  has  a  type  of  IResource.

Page 34: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Service  access  –  II.▪ What  happens  in  the  background?  

o Find  variables  from  context  o If  matches  parameters,  it  is  transferred  o If  not,  and  • Optional  =>  null  value,  callee  handles  this;  • Not  optional  =>  inject  error  

o Used  annotations  based  on  JSR-­‐330  specification  • JSR  330:  Dependency  Injection  for  Java  • http://jcp.org/en/jsr/detail?id=330

Page 35: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Event  Handling▪ Base  class  

o Queried  value  changes  o Solved  by  dependency  injection  • In  case  of  changes  framework  recalls  method  • Much  fewer  event  handler  required  

▪ Internal  optimalization  o Notification  only  in  consistent  context  states

Page 36: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Model-­‐based  Workbench

Page 37: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Workbench  stucture▪ Strict  hierarchy  

oWindow  o Site  o Perspective  o Editors  and  views  

▪ In  3.x,  defined  in  code  o New  instances  set  up  via  extensions

Page 38: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Inheritance  hierarchy▪ Common  behaviour  

o Defined  in  base  classes  o Not  required  to  code  all  the  time  o Same  behaviour  all  the  time

24

Page 39: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Inheritance  hierarchy▪ Common  behaviour  

o Defined  in  base  classes  o Not  required  to  code  all  the  time  o Same  behaviour  all  the  time

24

View

Page 40: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Inheritance  hierarchy▪ Common  behaviour  

o Defined  in  base  classes  o Not  required  to  code  all  the  time  o Same  behaviour  all  the  time

24

View

Editor

Page 41: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Inheritance  hierarchy▪ Common  behaviour  

o Defined  in  base  classes  o Not  required  to  code  all  the  time  o Same  behaviour  all  the  time

24

View

Editor

Textual  editor

Page 42: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

New  approach▪ Application  model  

o Describing  the  workbench  structure  • Does  not  contain  the  entire  GUI  (on  the  widget  level)  • Widget  set  independent  

o Available  during  runtime  • AND  modifiable

Page 43: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Custom  model▪ Application  model  

o  Basically  one  for  an  RCP  application  o Structure  of  the  entire  application  

▪ Model  fragment  o Extensions  to  running  application  model  o A  single  fragment  replaces  a  large  set  of  extensions  • More  understandable  than  scattered  extensions  

▪ Registration  of  models  and  fragments  o Using  a  single  extension  point

Page 44: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Application  Models  Extensibility

27

Page 45: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Application  Models  Extensibility▪ Model  fragments  

o Contributed  parts  to  application  model  oModels  are  merged  • Fragments  reusable  in  different  applications

27

Page 46: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Application  Models  Extensibility▪ Model  fragments  

o Contributed  parts  to  application  model  oModels  are  merged  • Fragments  reusable  in  different  applications

▪ Model  processors  o Programmed  modifications  of  application  model

27

Page 47: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Application  model▪ Technology:  EMF  model  

oMetamodel  available  o Extensions  possible  

▪ Contains  o Application  window  o Views  and  editors  (commonly  referred  to  as  Part)  • +layout  

o Commands,  menu  

▪ Detailed  documentation  o http://wiki.eclipse.org/E4/UI/Modeled_UI  

28

Page 48: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Application  model▪ Live  model  

o Synchronized  with  the  GUI  • User  interactions  are  reflected  here  • Changes  update  the  user  interface  

– E.g.  programmatic  opening  of  a  View  

oModel  is  serialized  on  save  • State  restore  • Processed  using  basic  EMF  tools

29

Page 49: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Workbench  metamodel  –  not  up  to  date!

30Forrás:  http://dev.eclipse.org/mhonarc/lists/eclipse-­‐incubator-­‐e4-­‐dev/msg00222.html

Page 50: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Workbench  metamodel  –  not  up  to  date!

30Forrás:  http://dev.eclipse.org/mhonarc/lists/eclipse-­‐incubator-­‐e4-­‐dev/msg00222.html

Page 51: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Workbench  metamodel  –  not  up  to  date!

31Forrás:  http://dev.eclipse.org/mhonarc/lists/eclipse-­‐incubator-­‐e4-­‐dev/msg00222.html

Workbench  window

Views  and  Editors

Menus  and  other  elements

Page 52: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Application  model  editor  (e4  tools)

32

Page 53: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Annotation  based  API▪ Implementing  classes  

o Free  inheritance  hierarchy  o Lifecycle  events  via  annotations  o JSR  250:  Common  Annotations  for  the  JavaTM  Platform

33

Page 54: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

View  example    –  3.xpublic class SampleView extends ViewPart {  

@Overridepublic void createPartControl(Composite parent) {  

// TODO Auto-generated method stub}  

@Overridepublic void setFocus() {  

// TODO Auto-generated method stub}  

@Overridepublic void dispose() {  

// TODO Auto-generated method stub}  

}

34

Page 55: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

View  example  –  4.xpublic class SampleView extends ViewPart {  

@Override@PostConstructpublic void createPartControl(Composite parent) {  

// TODO Auto-generated method stub}  

@Override@Focuspublic void setFocus() {  

// TODO Auto-generated method stub}  

@Override@PreDestroypublic void dispose() {  

// TODO Auto-generated method stub}  

}

Page 56: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

View  example  –  4.xpublic class SampleView extends ViewPart {  

@Override@PostConstructpublic void createPartControl(Composite parent) {  

// TODO Auto-generated method stub}  

@Override@Focuspublic void setFocus() {  

// TODO Auto-generated method stub}  

@Override@PreDestroypublic void dispose() {  

// TODO Auto-generated method stub}  

}

No  inheritance

Page 57: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

View  example  –  4.xpublic class SampleView extends ViewPart {  

@Override@PostConstructpublic void createPartControl(Composite parent) {  

// TODO Auto-generated method stub}  

@Override@Focuspublic void setFocus() {  

// TODO Auto-generated method stub}  

@Override@PreDestroypublic void dispose() {  

// TODO Auto-generated method stub}  

}

No  inheritance

SzövegSzövegSemantic  annotations

Page 58: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

View  example  –  4.xpublic class SampleView extends ViewPart {  

@Override@PostConstructpublic void createPartControl(Composite parent) {  

// TODO Auto-generated method stub}  

@Override@Focuspublic void setFocus() {  

// TODO Auto-generated method stub}  

@Override@PreDestroypublic void dispose() {  

// TODO Auto-generated method stub}  

}

No  inheritance

SzövegSzövegSemantic  annotations

What  are  the  benefits?

Page 59: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Annotation  based  API

Page 60: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Annotation  based  API▪ What  have  we  gained?  

o Free  inheritance  hierarchy  • Any  use  is  possible  

o Container  idependent  code  • Class  is  free  to  reuse  

– Even  outside  Eclipse  – Injection  needs  to  be  done

Page 61: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Annotation  based  API▪ What  have  we  gained?  

o Free  inheritance  hierarchy  • Any  use  is  possible  

o Container  idependent  code  • Class  is  free  to  reuse  

– Even  outside  Eclipse  – Injection  needs  to  be  done

▪ What  have  we  lost?  o Compatibility  with  previous  platform  • If  plug-­‐ins  not  working,  nobody  will  update

Page 62: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Compatibility  with  3.x  API▪ Re-­‐implement  the  base  classes  required  by  3.x  

o Use  the  new  API  

▪ Not  a  perfect  clone  o Smaller  issues  o API  compatibility  achieved  

▪ Using  3.x  and  4.x  GUI  parallel  o Not  supported  officially  (in  2012)  o BUT:  based  on  a  EclipseCon  ‘12  talk  possible

Page 63: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Compatibility  with  3.x  API▪ Re-­‐implement  the  base  classes  required  by  3.x  

o Use  the  new  API  

▪ Not  a  perfect  clone  o Smaller  issues  o API  compatibility  achieved  

▪ Using  3.x  and  4.x  GUI  parallel  o Not  supported  officially  (in  2012)  o BUT:  based  on  a  EclipseCon  ‘12  talk  possible

Page 64: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Model  processing  during  runtime

38Forrás:  Tom  Schindl,  Lars  Vogel,  Kai  Tödter:  Eclipse  e4  tutorial,  EclipseCon  2010  

Page 65: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Model  processing  during  runtime

38Forrás:  Tom  Schindl,  Lars  Vogel,  Kai  Tödter:  Eclipse  e4  tutorial,  EclipseCon  2010  

Complex  renderer

Page 66: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Model  processing  during  runtime

38Forrás:  Tom  Schindl,  Lars  Vogel,  Kai  Tödter:  Eclipse  e4  tutorial,  EclipseCon  2010  

Complex  renderer

Replaceable

Page 67: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Rendering  Engines▪ SWT  Presentation  Engine  

o Bundled  with  Eclipse  o Relies  on  SWT  o Compatible  with  old  API  

▪ JavaFX  Renderer  o Provided  by  e(fx)clipse  project  o Relies  of  JavaFX  (requires  Java  8)  o Incompatible  with  old  GUI  plug-­‐ins!  

▪ RAP  Renderer  o RCP  on  the  web  (http://eclipsesource.com/blogs/2014/04/10/getting-­‐started-­‐with-­‐eclipse4-­‐applications-­‐on-­‐rap/)  

o Details:  next  week

39

Page 68: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Compatibility  Layer▪ Application  model  implementation  

o Processed  extensions  from  3.x  API  o Creates  corresponding  models  

▪ Basically  full  API  compatibility  o Platform  works  as  expected

40

Page 69: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

CSS  based  theming

41

Page 70: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Application  theming▪ Eclipse  3.x  

o Partially  possible  • Colors,  formatting  stored  and  queried  • Basically  key-­‐value  pairs  

– Not  flexible  enough  

o How  serious  is  this  problem?  • IDE  

– Good  question  

• RCP  application  – “Must  not  look  like  the  IDE!”

42

Page 71: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Application  theming▪ Eclipse  3.x  

o Partially  possible  • Colors,  formatting  stored  and  queried  • Basically  key-­‐value  pairs  

– Not  flexible  enough  

o How  serious  is  this  problem?  • IDE  

– Good  question  

• RCP  application  – “Must  not  look  like  the  IDE!”

42

Page 72: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Theming  –  Contacts  demo

43Forrás:  Tom  Schindl,  Lars  Vogel,  Kai  Tödter:  Eclipse  e4  tutorial,  EclipseCon  2010  

Page 73: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Theming  –  Contacts  demo

43Forrás:  Tom  Schindl,  Lars  Vogel,  Kai  Tödter:  Eclipse  e4  tutorial,  EclipseCon  2010  

Page 74: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Theming  –  Contacts  demo

43Forrás:  Tom  Schindl,  Lars  Vogel,  Kai  Tödter:  Eclipse  e4  tutorial,  EclipseCon  2010  

Page 75: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Theming  –  Contacts  demo

43Forrás:  Tom  Schindl,  Lars  Vogel,  Kai  Tödter:  Eclipse  e4  tutorial,  EclipseCon  2010  

Page 76: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Theming  –  Eclipse  IDE▪ Styles  

o Based  on  products  oMore  possible  • Changes  possible  during  runtime  

▪ Unique  attributes  attached  to  widgets:  Label label = new Label(parent, SWT.NONE);

label.setData("org.eclipse.e4.ui.css.id”, "SeparatorLabel");

Page 77: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Theming  in  platform  4.x▪ Reasonably  wide  possibilities  ▪ Report  from  EclipseCon  ’12:  

o CSS  on  E4  o http://holistictendencies.wordpress.com/2012/03/31/css-­‐on-­‐e4-­‐eclipsecon/  

▪  

Page 78: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

New  problems

Page 79: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

New  Platform  –  New  problems▪ Are  there  any?

47

Page 80: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

New  Platform  –  New  problems▪ Are  there  any?

▪ Performance  problemso In  some  cases  noticeable  slowdowns• Platform  team  asks:  report  it  (reproducibly)!  ☺

47

Page 81: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

New  Platform  –  New  problems▪ Are  there  any?

▪ Performance  problemso In  some  cases  noticeable  slowdowns• Platform  team  asks:  report  it  (reproducibly)!  ☺

▪ Service  list  is  dynamico Exploration  based  learning• “How  can  I  get  the  current  selection?”

o Debugging• “Why  do  I  get  a  null  from  the  injector?”

47

Page 82: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Summary

Page 83: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Eclipse  Application  Platform  4.x▪ Platform  advances  

o Dependency  injection  o OSGi  services  as  first-­‐class  citizens  o New  services  • Theming  • Better  event  handling  

o Sadly:  new  bugs  • Sometimes  performance  issues  

▪ But  this  is  the  future  oWorth  learning  it

49

Page 84: The$New$Generation$of the$Eclipse$Platform...Eclipse$RCP For$developing$clientapplications$ oBased$on$the$Eclipse$workbench$model$ oButwithoutIDE$functionality $ • Or$possibly$including$alimited$function$set

Sources,  additional  materials▪ e4  wiki  

o http://wiki.eclipse.org/E4  ▪ Eclipse  4  wiki  

o http://wiki.eclipse.org/Eclipse4    ▪ John  Arthorne,  Paul  Webster,  Boris  Bokowski,  Oleg  Besedin:  What’s  the  context?  o http://www.eclipse.org/e4/resources/contexts.pdf  

▪ Wim  Jongman:  Why  Eclipse  4?  (the  Egg  Laying  WoolMilkPig)  o http://industrial-­‐tsi-­‐wim.blogspot.hu/2012/10/why-­‐eclipse-­‐e4-­‐egg-­‐laying-­‐woolmilkpig.html

50


Recommended