e4 – modeled workbench › 2009 › 07 › slides.pdf · usage of servicelocator and...

31
E4 – Modeled Workbench Tom Schindl - BestSolution.at / Platform UI Copyright Tom Schindl – BestSolution.at - Made available under EPL

Upload: others

Post on 01-Jul-2020

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: E4 – Modeled Workbench › 2009 › 07 › slides.pdf · Usage of ServiceLocator and Dependency-Injection ... RIA-Frameworks like Flex, Silverlight, JavaFX ... No E4 dependency

E4 – Modeled WorkbenchTom Schindl - BestSolution.at / Platform UI

Copyright Tom Schindl – BestSolution.at - Made available under EPL

Page 2: E4 – Modeled Workbench › 2009 › 07 › slides.pdf · Usage of ServiceLocator and Dependency-Injection ... RIA-Frameworks like Flex, Silverlight, JavaFX ... No E4 dependency

Copyright Tom Schindl – BestSolution.at - Made available under EPL

E4 – About me

● CSO BestSolution.at

Committership on● E4 ● Platform UI ● EMF

ProjectLead on● Nebula● UFaceKit

● Eclipse Ecosystem

Page 3: E4 – Modeled Workbench › 2009 › 07 › slides.pdf · Usage of ServiceLocator and Dependency-Injection ... RIA-Frameworks like Flex, Silverlight, JavaFX ... No E4 dependency

● 2008

E4 – Some (historic) facts

● Short before EclipseCon 2008: Annoucement of a new project idea

● First mock up presentations at Eclipse 2008● E4-Summit in Ottawa (22nd /23rd May)

● Project groups formed● The modeled workbench was born

Copyright Tom Schindl – BestSolution.at - Made available under EPL

Page 4: E4 – Modeled Workbench › 2009 › 07 › slides.pdf · Usage of ServiceLocator and Dependency-Injection ... RIA-Frameworks like Flex, Silverlight, JavaFX ... No E4 dependency

● It started with a mail„A radical approach to explore new paths for e4“

E4 – May 20th 2008

● Key points● Completely backed up by an live Ecore-Model● No statics and singleton● Usage of ServiceLocator and Dependency-

Injection

● Published a Platform designed from Scratch

Copyright Tom Schindl – BestSolution.at - Made available under EPL

Page 5: E4 – Modeled Workbench › 2009 › 07 › slides.pdf · Usage of ServiceLocator and Dependency-Injection ... RIA-Frameworks like Flex, Silverlight, JavaFX ... No E4 dependency

● 2009

E4 – Some (historic) facts

● Release of E4 0.9 in Summer (tech-preview)● Evaluation of overlapping technologies and

draw a decision

Copyright Tom Schindl – BestSolution.at - Made available under EPL

Page 6: E4 – Modeled Workbench › 2009 › 07 › slides.pdf · Usage of ServiceLocator and Dependency-Injection ... RIA-Frameworks like Flex, Silverlight, JavaFX ... No E4 dependency

● The current code is hard and is getting harder to maintain

E4 – Why? Why now?

Copyright Tom Schindl – BestSolution.at - Made available under EPL

Shell

MenuBar

CTabFolder

PackageExplorerHierarchy

Shell

MenuBar

CTabFolder

PackageExplorerHierarchy

● Different MVC implementations● Legacy code because of historic

platform limitations

Page 7: E4 – Modeled Workbench › 2009 › 07 › slides.pdf · Usage of ServiceLocator and Dependency-Injection ... RIA-Frameworks like Flex, Silverlight, JavaFX ... No E4 dependency

● The platform code uses outed patterns

E4 – Why? Why now?

Copyright Tom Schindl – BestSolution.at - Made available under EPL

● Usage of Statics and SingletonsPlatformUI.getWorkbench()

● Too much usage of inheritance

Page 8: E4 – Modeled Workbench › 2009 › 07 › slides.pdf · Usage of ServiceLocator and Dependency-Injection ... RIA-Frameworks like Flex, Silverlight, JavaFX ... No E4 dependency

● The core platform suffers from a vast number of API and API that overlaps each other● Preference APIs● Commands vs. Actions● Different notification systems

E4 – Why? Why now?

Copyright Tom Schindl – BestSolution.at - Made available under EPL

Page 9: E4 – Modeled Workbench › 2009 › 07 › slides.pdf · Usage of ServiceLocator and Dependency-Injection ... RIA-Frameworks like Flex, Silverlight, JavaFX ... No E4 dependency

● New competitors in RCP● RIA-Frameworks like Flex, Silverlight,

JavaFX● GWT, Ajax-Frameworks (Qooxdoo, Ext-Js, ...)

E4 – Why? Why now?

● New UI-Philosophies● Shift away from native looking UIs

Copyright Tom Schindl – BestSolution.at - Made available under EPL

Page 10: E4 – Modeled Workbench › 2009 › 07 › slides.pdf · Usage of ServiceLocator and Dependency-Injection ... RIA-Frameworks like Flex, Silverlight, JavaFX ... No E4 dependency

● Programming model too complex for many RCP-Applications

E4 – Why? Why now?

● Perspectives are often useless in RCP-Applications so why do I need one?

● We do I have to contribute my views through those extension points?

● Why can I not define the menu-item order?● ...

Copyright Tom Schindl – BestSolution.at - Made available under EPL

Page 11: E4 – Modeled Workbench › 2009 › 07 › slides.pdf · Usage of ServiceLocator and Dependency-Injection ... RIA-Frameworks like Flex, Silverlight, JavaFX ... No E4 dependency

● One coherant model below the platform

E4 – The design ideas

Copyright Tom Schindl – BestSolution.at - Made available under EPL

Page 12: E4 – Modeled Workbench › 2009 › 07 › slides.pdf · Usage of ServiceLocator and Dependency-Injection ... RIA-Frameworks like Flex, Silverlight, JavaFX ... No E4 dependency

● Why is the model an EMF-Model?● It's here, it's mature and has a vibrant

community and it's an Eclipse-Project● It has tooling which will make it easy to

create models● It has fantastic code generation facilities● Foundation for interesting stuff like CDO

E4 – The design ideas

Copyright Tom Schindl – BestSolution.at - Made available under EPL

Page 13: E4 – Modeled Workbench › 2009 › 07 › slides.pdf · Usage of ServiceLocator and Dependency-Injection ... RIA-Frameworks like Flex, Silverlight, JavaFX ... No E4 dependency

● Why is the model an EMF-Model

E4 – The design ideas

● Isn't EMF bloat?

Copyright Tom Schindl – BestSolution.at - Made available under EPL

Installation vs Runtime bloat● EMF adds (in its current packageing) 1.5 MB to

the download size● Runtime size of EMF-Models highly optimized and

(storage of booleans using bitmasks) ● Benefits of upstream changes (EMF Ultra Slim Diet

save 108 bytes / instance) in 3.5

Page 14: E4 – Modeled Workbench › 2009 › 07 › slides.pdf · Usage of ServiceLocator and Dependency-Injection ... RIA-Frameworks like Flex, Silverlight, JavaFX ... No E4 dependency

● The idea of an IEclipseContext● Sits between application and framework● Brokers interaction between like service

registration and lookup● Hierarchical

E4 – The design ideas

Page 15: E4 – Modeled Workbench › 2009 › 07 › slides.pdf · Usage of ServiceLocator and Dependency-Injection ... RIA-Frameworks like Flex, Silverlight, JavaFX ... No E4 dependency

● Useage of Dependency Injection

E4 – The design ideas

Eclipse 3.x E4

Copyright Tom Schindl – BestSolution.at - Made available under EPL

Flatten the level of inheritance

Page 16: E4 – Modeled Workbench › 2009 › 07 › slides.pdf · Usage of ServiceLocator and Dependency-Injection ... RIA-Frameworks like Flex, Silverlight, JavaFX ... No E4 dependency

● A clean split between the platform code and the presentation/rendering

E4 – The design ideas

● Unlimited possibilities to customize the UI● Programming happens against the model not the

rendered UI – everything in the UI is accessible● Support other programming languages to

write your UI-Plugins, Handlers, …● Declarative Styling

Copyright Tom Schindl – BestSolution.at - Made available under EPL

Page 17: E4 – Modeled Workbench › 2009 › 07 › slides.pdf · Usage of ServiceLocator and Dependency-Injection ... RIA-Frameworks like Flex, Silverlight, JavaFX ... No E4 dependency

● The EMF-ModelSplit in two: 1 Core for RCP and 1 Extended one for Workbench

E4 – The implementation

Copyright Tom Schindl – BestSolution.at - Made available under EPL

Page 18: E4 – Modeled Workbench › 2009 › 07 › slides.pdf · Usage of ServiceLocator and Dependency-Injection ... RIA-Frameworks like Flex, Silverlight, JavaFX ... No E4 dependency

● The EMF-Model

E4 – The implementation

Copyright Tom Schindl – BestSolution.at - Made available under EPL

Page 19: E4 – Modeled Workbench › 2009 › 07 › slides.pdf · Usage of ServiceLocator and Dependency-Injection ... RIA-Frameworks like Flex, Silverlight, JavaFX ... No E4 dependency

● Application Development with EMF-Tools

E4 – The implementation

Copyright Tom Schindl – BestSolution.at - Made available under EPL

Page 20: E4 – Modeled Workbench › 2009 › 07 › slides.pdf · Usage of ServiceLocator and Dependency-Injection ... RIA-Frameworks like Flex, Silverlight, JavaFX ... No E4 dependency

● Photo Demo

E4 – The implementation

Copyright Tom Schindl – BestSolution.at - Made available under EPL

Page 21: E4 – Modeled Workbench › 2009 › 07 › slides.pdf · Usage of ServiceLocator and Dependency-Injection ... RIA-Frameworks like Flex, Silverlight, JavaFX ... No E4 dependency

● The Perspective Problem

E4 – The implementation

Shell

MenuBar

CTabFolder

PackageExplorerHierarchy

A standard UI is a Tree An UI with Perspectives is a Tree with LinksShell

MenuBar

CTabFolder

PackageExplorerHierarchy

Java

PDE

CTabFolder

PackageExplorerHierarchyPlug-ins

(visible=true)

(visible=false)

Shell

MenuBar

CTabFolder

PackageExplorerHierarchy

Java

PDE

CTabFolder

PackageExplorerHierarchyPlug-ins

(visible=false)

(visible=true)

Copyright Tom Schindl – BestSolution.at - Made available under EPL

Page 22: E4 – Modeled Workbench › 2009 › 07 › slides.pdf · Usage of ServiceLocator and Dependency-Injection ... RIA-Frameworks like Flex, Silverlight, JavaFX ... No E4 dependency

● The usage of DI and IEclipseContextExample the Workbench-Selection

E4 – The implementation

● Reacting on selection changes

Copyright Tom Schindl – BestSolution.at - Made available under EPL

public class SampleView extends ViewPart { public void createPartControl(Composite parent) { // ... getSite().getWorkbenchWindow().getSelectionService().addSelectionListener(new ISelectionListener() { @Override public void selectionChanged(IWorkbenchPart part, ISelection selection) { // Do something } }); }}

3.x

public class Preview { @In public void setInput(final IFile input) { // Do something }}

E4

Page 23: E4 – Modeled Workbench › 2009 › 07 › slides.pdf · Usage of ServiceLocator and Dependency-Injection ... RIA-Frameworks like Flex, Silverlight, JavaFX ... No E4 dependency

E4 – The implementation

● The usage of DI and IEclipseContextExample the Workbench-Selection

public class SampleView extends ViewPart { public void createPartControl(Composite parent) { TreeViewer viewer = ...; getSite().setSelectionProvider(viewer); }}

3.x

● Setting the workbench selection

public class Library { public Library(final Composite parent, final IWorkspace workspace, final IEclipseContext outputContext){ TreeViewer viewer = ...; viewer.addSelectionChangedListener(new ISelectionChangedListener(){ public void selectionChanged(SelectionChangedEvent event) { StructuredSelection selection = (StructuredSelection)event.getSelection(); outputContext.set( IServiceConstants.SELECTION, selection.size() == 1 ? selection.getFirstElement() : selection.toArray()); } }); }}

E4

Copyright Tom Schindl – BestSolution.at - Made available under EPL

Page 24: E4 – Modeled Workbench › 2009 › 07 › slides.pdf · Usage of ServiceLocator and Dependency-Injection ... RIA-Frameworks like Flex, Silverlight, JavaFX ... No E4 dependency

● Declarative Styling with CSS

E4 – The implementation

Shell shell = ...URL url = FileLocator.resolve(new URL("file://my.css"));

InputStreamReader streamReader = new InputStreamReader(url.openStream());engine.reset();engine.parseStyleSheet(streamReader);engine.applyStyles(shell, true, false);shell.layout(true, true);

Copyright Tom Schindl – BestSolution.at - Made available under EPL

● Keep UI-Code free of Styling informations● Apply styles on the fly without closing your

application

● No E4 dependency = Useable in 3.x!

Page 25: E4 – Modeled Workbench › 2009 › 07 › slides.pdf · Usage of ServiceLocator and Dependency-Injection ... RIA-Frameworks like Flex, Silverlight, JavaFX ... No E4 dependency

● Contacts Demo

E4 – The implementation

Copyright Tom Schindl – BestSolution.at - Made available under EPL

Page 26: E4 – Modeled Workbench › 2009 › 07 › slides.pdf · Usage of ServiceLocator and Dependency-Injection ... RIA-Frameworks like Flex, Silverlight, JavaFX ... No E4 dependency

● Workbench-Renderes„Renderes start where Declarative Styling ends“

E4 – The implementation

org.eclipse.ufacekit.ui.workbench.qt

org.eclipse.e4.ui.workbench

EMF-Workbench-Model

AbstractRenderer

QtRenderer

org.eclipse.e4.ui.workbench.renderer.swt

SWTRenderer

Contribute

Eclipse-DB

Copyright Tom Schindl – BestSolution.at - Made available under EPL

Page 27: E4 – Modeled Workbench › 2009 › 07 › slides.pdf · Usage of ServiceLocator and Dependency-Injection ... RIA-Frameworks like Flex, Silverlight, JavaFX ... No E4 dependency

● 1:n relation between model and renderer

E4 – The implementation

MWorkbenchWindow MStack

org.eclipse.swt.widgets.Shell CTabFolder PShelf

Copyright Tom Schindl – BestSolution.at - Made available under EPL

SWTShellRender SWTStackRender PShelfRender

Page 28: E4 – Modeled Workbench › 2009 › 07 › slides.pdf · Usage of ServiceLocator and Dependency-Injection ... RIA-Frameworks like Flex, Silverlight, JavaFX ... No E4 dependency

● Photo Demo

E4 – The implementation

Copyright Tom Schindl – BestSolution.at - Made available under EPL

Page 29: E4 – Modeled Workbench › 2009 › 07 › slides.pdf · Usage of ServiceLocator and Dependency-Injection ... RIA-Frameworks like Flex, Silverlight, JavaFX ... No E4 dependency

● What about my current plugins?

E4 – You are cool but ...

Copyright Tom Schindl – BestSolution.at - Made available under EPL

Page 30: E4 – Modeled Workbench › 2009 › 07 › slides.pdf · Usage of ServiceLocator and Dependency-Injection ... RIA-Frameworks like Flex, Silverlight, JavaFX ... No E4 dependency

● RAP doesn't need to patch the workbench

E4 – A „minor“ side effect

Copyright Tom Schindl – BestSolution.at - Made available under EPL

Page 31: E4 – Modeled Workbench › 2009 › 07 › slides.pdf · Usage of ServiceLocator and Dependency-Injection ... RIA-Frameworks like Flex, Silverlight, JavaFX ... No E4 dependency

● EclipseCon 09 Presentations● Wiki: http://wiki.eclipse.org/E4● My Blog:

http://tomsondev.bestsolution.at/

E4 – Resources about E4

Copyright Tom Schindl – BestSolution.at - Made available under EPL