eclipse e4
DESCRIPTION
A presentation I gave at the AustinJUG.TRANSCRIPT
![Page 1: Eclipse e4](https://reader035.vdocuments.site/reader035/viewer/2022081718/554f5b31b4c905b9508b53ca/html5/thumbnails/1.jpg)
Eclipse 4.0and e4
Chris AniszczykPrincipal Software [email protected]://aniszczyk.orghttp://twitter.com/caniszczyk
![Page 2: Eclipse e4](https://reader035.vdocuments.site/reader035/viewer/2022081718/554f5b31b4c905b9508b53ca/html5/thumbnails/2.jpg)
Howdy!• Hack Eclipse/OSGi/Git• Evangelist at Red Hat• Involved heavily at Eclipse
– Eclipse Foundation Board of Directors– Co-lead PDE and EGit
• Hacking on open source for a decade– Gentoo Linux, Eclipse, Fedora...
• I like running (5K @ ~18min)
![Page 3: Eclipse e4](https://reader035.vdocuments.site/reader035/viewer/2022081718/554f5b31b4c905b9508b53ca/html5/thumbnails/3.jpg)
Agenda
Why e4?
Eclipse 3.X and e4
e4 workbench model
Styling and Services
Compatibility Layer
Conclusion and Q&A
![Page 4: Eclipse e4](https://reader035.vdocuments.site/reader035/viewer/2022081718/554f5b31b4c905b9508b53ca/html5/thumbnails/4.jpg)
Lexicone4 is an Eclipse.org project for platform-related incubation, it’s not a product!
Eclipse 4.0 is a release that contains some technology from the e4 project
![Page 5: Eclipse e4](https://reader035.vdocuments.site/reader035/viewer/2022081718/554f5b31b4c905b9508b53ca/html5/thumbnails/5.jpg)
Why e4?• Innovate or become irrelevant• Use e4 technologies as a
basis for Eclipse 4.X (some will show up in the 3.x stream)
• Engage the open source community
• Build a better Eclipse– Make it more flexible– Prepare for the web– Dynamic languages– Fix our mistakes
![Page 6: Eclipse e4](https://reader035.vdocuments.site/reader035/viewer/2022081718/554f5b31b4c905b9508b53ca/html5/thumbnails/6.jpg)
Eclipse Competition...
![Page 7: Eclipse e4](https://reader035.vdocuments.site/reader035/viewer/2022081718/554f5b31b4c905b9508b53ca/html5/thumbnails/7.jpg)
Why change?
“We’ve already built all our plug-ins.
The most important thing is don’t break us.”
(Yes, there is a compatibility layer.)
![Page 8: Eclipse e4](https://reader035.vdocuments.site/reader035/viewer/2022081718/554f5b31b4c905b9508b53ca/html5/thumbnails/8.jpg)
Eclipse is mature and huge...
8
![Page 9: Eclipse e4](https://reader035.vdocuments.site/reader035/viewer/2022081718/554f5b31b4c905b9508b53ca/html5/thumbnails/9.jpg)
Eclipse Competition...
Francois Schnell, http://www.flickr.com/photos/frenchy/30217773/
Foundations need to evolve...
![Page 10: Eclipse e4](https://reader035.vdocuments.site/reader035/viewer/2022081718/554f5b31b4c905b9508b53ca/html5/thumbnails/10.jpg)
Eclipse 4.0 SDKEarly Adopter Release
July 2010
![Page 11: Eclipse e4](https://reader035.vdocuments.site/reader035/viewer/2022081718/554f5b31b4c905b9508b53ca/html5/thumbnails/11.jpg)
11
![Page 12: Eclipse e4](https://reader035.vdocuments.site/reader035/viewer/2022081718/554f5b31b4c905b9508b53ca/html5/thumbnails/12.jpg)
12
![Page 13: Eclipse e4](https://reader035.vdocuments.site/reader035/viewer/2022081718/554f5b31b4c905b9508b53ca/html5/thumbnails/13.jpg)
e4 ExampleApplications
![Page 14: Eclipse e4](https://reader035.vdocuments.site/reader035/viewer/2022081718/554f5b31b4c905b9508b53ca/html5/thumbnails/14.jpg)
![Page 15: Eclipse e4](https://reader035.vdocuments.site/reader035/viewer/2022081718/554f5b31b4c905b9508b53ca/html5/thumbnails/15.jpg)
![Page 16: Eclipse e4](https://reader035.vdocuments.site/reader035/viewer/2022081718/554f5b31b4c905b9508b53ca/html5/thumbnails/16.jpg)
So, what’s wrong with Eclipse 3.X?
![Page 17: Eclipse e4](https://reader035.vdocuments.site/reader035/viewer/2022081718/554f5b31b4c905b9508b53ca/html5/thumbnails/17.jpg)
Problems with Eclipse 3.x
• Complex• Lots of API• Platform functionality
via singletons• Not easy to test• Not a consistent way to
define the UI• UI makes assumptions,
e.g. Editors / Views• Easy Skinning
• The browser is more powerful now... RIAs...
![Page 18: Eclipse e4](https://reader035.vdocuments.site/reader035/viewer/2022081718/554f5b31b4c905b9508b53ca/html5/thumbnails/18.jpg)
8
If only Eclipse application development would be easier...
![Page 19: Eclipse e4](https://reader035.vdocuments.site/reader035/viewer/2022081718/554f5b31b4c905b9508b53ca/html5/thumbnails/19.jpg)
Eclipse e4 – Building blocks
Declarative Styling
Modeled Workbench
Rendering Engine
Dependency Injection
IEclipseContext
Core Services
![Page 20: Eclipse e4](https://reader035.vdocuments.site/reader035/viewer/2022081718/554f5b31b4c905b9508b53ca/html5/thumbnails/20.jpg)
The Modeled Workbench
![Page 21: Eclipse e4](https://reader035.vdocuments.site/reader035/viewer/2022081718/554f5b31b4c905b9508b53ca/html5/thumbnails/21.jpg)
The e4 Workbench ModelEach application has its live model... think of the browser DOM...
• Built using EMF• Workbench window
– Menu with menu items – Window Trim, e.g.
toolbar with toolbar items
– Parts Sash Container• Parts
– Part Stack (CTabFolder)• Parts
– Handlers– Key Bindings– Commands
![Page 22: Eclipse e4](https://reader035.vdocuments.site/reader035/viewer/2022081718/554f5b31b4c905b9508b53ca/html5/thumbnails/22.jpg)
The Model is FlexibleNo distinction between View/ Editor
Perspectives are optional
Stack / Sash are optional
Several windows easily possible
Flexible Toolbars
![Page 23: Eclipse e4](https://reader035.vdocuments.site/reader035/viewer/2022081718/554f5b31b4c905b9508b53ca/html5/thumbnails/23.jpg)
Parts in e4
Plain Old Java Objects (POJO‘s)
![Page 24: Eclipse e4](https://reader035.vdocuments.site/reader035/viewer/2022081718/554f5b31b4c905b9508b53ca/html5/thumbnails/24.jpg)
Before e4... inheritance ruled...
VIEW
VIEWPART
WORKBENCHPART
EVENTMANAGER
OBJECT
![Page 25: Eclipse e4](https://reader035.vdocuments.site/reader035/viewer/2022081718/554f5b31b4c905b9508b53ca/html5/thumbnails/25.jpg)
How is this model translated into UI components?
![Page 26: Eclipse e4](https://reader035.vdocuments.site/reader035/viewer/2022081718/554f5b31b4c905b9508b53ca/html5/thumbnails/26.jpg)
Model and UI Renderers
• The Workbench model is independent of a specific UI toolkit
I don’t care who draws me
Model
![Page 27: Eclipse e4](https://reader035.vdocuments.site/reader035/viewer/2022081718/554f5b31b4c905b9508b53ca/html5/thumbnails/27.jpg)
RenderersRenderer Factory
Eclipse default is the SWT Renderer
Can be selected at Startup via parameter
![Page 28: Eclipse e4](https://reader035.vdocuments.site/reader035/viewer/2022081718/554f5b31b4c905b9508b53ca/html5/thumbnails/28.jpg)
RenderersWidget RendererRenderer Factory
Returns for every model element
![Page 29: Eclipse e4](https://reader035.vdocuments.site/reader035/viewer/2022081718/554f5b31b4c905b9508b53ca/html5/thumbnails/29.jpg)
Widget Renderer• Each UI elements gets a renderer • Renderer manage Lifecycle of the UI-
Element– Creation– Model to widget binding– Rendering– Disposal
![Page 30: Eclipse e4](https://reader035.vdocuments.site/reader035/viewer/2022081718/554f5b31b4c905b9508b53ca/html5/thumbnails/30.jpg)
e4 and Styling
![Page 31: Eclipse e4](https://reader035.vdocuments.site/reader035/viewer/2022081718/554f5b31b4c905b9508b53ca/html5/thumbnails/31.jpg)
Styling in Eclipse 3.x
• UI styling via– The Presentation API– Custom Widgets
• Very limited
![Page 32: Eclipse e4](https://reader035.vdocuments.site/reader035/viewer/2022081718/554f5b31b4c905b9508b53ca/html5/thumbnails/32.jpg)
In reality all RCP apps look like the an IDE
![Page 33: Eclipse e4](https://reader035.vdocuments.site/reader035/viewer/2022081718/554f5b31b4c905b9508b53ca/html5/thumbnails/33.jpg)
Eclipse 3.X - IDE feeling
Eclipse e4 – CSS Styling
Example from Kai Toedter
Some elements cannot currently not be styled:
• Menu bar background• Table headers
e4 supports theme switching during runtime
![Page 34: Eclipse e4](https://reader035.vdocuments.site/reader035/viewer/2022081718/554f5b31b4c905b9508b53ca/html5/thumbnails/34.jpg)
How to enable CSS StylingProperty "applicationCSS” in extension point org.eclipse.core.runtime.products
<extension id="product" point="org.eclipse.core.runtime.products"> <product application="org.eclipse.e4.ui.workbench.swt.application" name="E4 Contacs Demo"> <property name="applicationCSS" value="platform:/plugin/contacts/css/dark.css"> </property> </product></extension>
![Page 35: Eclipse e4](https://reader035.vdocuments.site/reader035/viewer/2022081718/554f5b31b4c905b9508b53ca/html5/thumbnails/35.jpg)
Example CSSLabel { font: Verdana 8px; color: rgb(240, 240, 240);}
Table { background-color: gradient radial #575757 #101010 100%; color: rgb(240, 240, 240); font: Verdana 8px;}
ToolBar { background-color: #777777 #373737 #202020 50% 50%; color: white; font: Verdana 8px;}
![Page 36: Eclipse e4](https://reader035.vdocuments.site/reader035/viewer/2022081718/554f5b31b4c905b9508b53ca/html5/thumbnails/36.jpg)
• Java
Label label = new Label(parent, SWT.NONE); label.setData("org.eclipse.e4.ui.css.id", "SeparatorLabel");
• CSS
#SeparatorLabel { color: #f08d00;}
Assign custom attributes
![Page 37: Eclipse e4](https://reader035.vdocuments.site/reader035/viewer/2022081718/554f5b31b4c905b9508b53ca/html5/thumbnails/37.jpg)
The e4 Programming Model
![Page 38: Eclipse e4](https://reader035.vdocuments.site/reader035/viewer/2022081718/554f5b31b4c905b9508b53ca/html5/thumbnails/38.jpg)
Dependency Injection• Inversion of control: The necessary
functionality is injected into the class
Java Class
![Page 39: Eclipse e4](https://reader035.vdocuments.site/reader035/viewer/2022081718/554f5b31b4c905b9508b53ca/html5/thumbnails/39.jpg)
Dependency Injection in e4
• JSR 330 compatible injection implementation (think Google Guice)– @javax.inject.Inject – Field,
Constructor and Method injection– @javax.inject.Named – Specify a custom
qualifier to context object (default is fully qualified classname of the injected type)
• e4 specific annotations... @Optional
![Page 40: Eclipse e4](https://reader035.vdocuments.site/reader035/viewer/2022081718/554f5b31b4c905b9508b53ca/html5/thumbnails/40.jpg)
public class ListView {
@Inject private IEclipseContext context; @Inject private Logger logger;
@Inject public ListView(Composite parent) { // ...
Services are injected via the the e4 framework
Java Class
![Page 41: Eclipse e4](https://reader035.vdocuments.site/reader035/viewer/2022081718/554f5b31b4c905b9508b53ca/html5/thumbnails/41.jpg)
CODE EXAMPLESrs-photo, http://www.flickr.com/photos/rs-foto/2129343084/sizes/l/
![Page 42: Eclipse e4](https://reader035.vdocuments.site/reader035/viewer/2022081718/554f5b31b4c905b9508b53ca/html5/thumbnails/42.jpg)
4.x
3.x
Access preference values
IPreferenceStore store = IDEWorkbenchPlugin.getDefault() .getPreferenceStore();
boolean saveBeforeBuild = store .getBoolean(SAVE_BEFORE_BUILD);
@Inject@Preference(SAVE_BEFORE_BUILD)boolean saveBeforeBuild;
![Page 43: Eclipse e4](https://reader035.vdocuments.site/reader035/viewer/2022081718/554f5b31b4c905b9508b53ca/html5/thumbnails/43.jpg)
4.x
3.x
Associate help context with control
getSite() .getWorkbenchWindow() .getWorkbench() .getHelpSystem().setHelp( viewer.getControl(), some_id);
@Inject
IWorkbenchHelpSystem helpSystem;
...
helpSystem.setHelp( viewer.getControl(), some_id);
![Page 44: Eclipse e4](https://reader035.vdocuments.site/reader035/viewer/2022081718/554f5b31b4c905b9508b53ca/html5/thumbnails/44.jpg)
Services
![Page 45: Eclipse e4](https://reader035.vdocuments.site/reader035/viewer/2022081718/554f5b31b4c905b9508b53ca/html5/thumbnails/45.jpg)
Eclipse Application Services (“Twenty Things”)
Long-running operations
Progress reporting Error handling Navigation model Resource management Status line Drag and drop Undo/Redo Accessing preferences
Editor lifecycle Receiving input Producing selection Standard dialogs Persisting UI state Logging Interface to help
system Menu contributions Authentication Authorization
Don‘t forget: OSGi services are also available via dependency injection
![Page 46: Eclipse e4](https://reader035.vdocuments.site/reader035/viewer/2022081718/554f5b31b4c905b9508b53ca/html5/thumbnails/46.jpg)
Compatibility Layer
![Page 47: Eclipse e4](https://reader035.vdocuments.site/reader035/viewer/2022081718/554f5b31b4c905b9508b53ca/html5/thumbnails/47.jpg)
Compatibility Layer
• Compatibility layer centers around org.eclipse.ui.workbench– Contains code to host 3.x API on e4
• Note: The 3.x workbench API with some exceptions...– org.eclipse.ui.presentations– org.eclipse.ui.themes– Activities and Capabilities
• API clean plug-ins will run fine
![Page 48: Eclipse e4](https://reader035.vdocuments.site/reader035/viewer/2022081718/554f5b31b4c905b9508b53ca/html5/thumbnails/48.jpg)
Eclipse 4.0 SDK
![Page 49: Eclipse e4](https://reader035.vdocuments.site/reader035/viewer/2022081718/554f5b31b4c905b9508b53ca/html5/thumbnails/49.jpg)
Thanks for listening!For further questions:[email protected]://aniszczyk.orghttp://twitter.com/caniszczyk
![Page 50: Eclipse e4](https://reader035.vdocuments.site/reader035/viewer/2022081718/554f5b31b4c905b9508b53ca/html5/thumbnails/50.jpg)
Where to go from hereEclipse e4 Website
http://www.eclipse.org/e4
Eclipse e4 Wikihttp://wiki.eclipse.org/E4
Eclipse e4 Whitepaper http://www.eclipse.org/e4/resources/e4-whitepaper.php
Eclipse 4.1 will most likely shipas part of the Indigo release...
![Page 51: Eclipse e4](https://reader035.vdocuments.site/reader035/viewer/2022081718/554f5b31b4c905b9508b53ca/html5/thumbnails/51.jpg)
License & Acknowledgements• This work is licensed under:
– http://creativecommons.org/licenses/by-nc-nd/3.0/de/deed.en_US
• Thank you...– Boris Bokowski, IBM– Tom Schindl, BestSolution– Kai Tödter, Siemens AG– Lars Vogel, SAP AG