Eclipse e4




Chris Aniszczyk
Principal Software Engineer, Red Hat
http://aniszczyk.org
http://www.twitter.com/caniszczyk
Agenda


Why e4?

Eclipse 3.X and e4
                  l
e4 workbench mode

Styling and Services

Compatibility Layer
The e4 project

e4 is an Eclipse.org project for
platform-related incubation, it’s not a
product! The Eclipse Platform nee...
Why e4?
• Innovate or become
  irrelevant
• Use e4 technologies as
  a basis for Eclipse 4.0
  (some will show up in
  the...
So, what’s wrong with
Eclipse 3.X?
Problems with Eclipse 3.x

• Complex
• Lots of API
• Platform functionality
  via singletons
• Not easy to test
• Not a co...
Eclipse Competition...
If only Eclipse application
development would be
easier...




                              8
Eclipse e4 – Building blocks
        Declarative Styling



          Rendering Engine


             Modeled Workbench


...
Eclipse e4 – Add-ons


 XWT

         Open
         Social
        Gadgets
                  Toolkit
                  Mod...
The Modeled Workbench
The e4 Workbench Model
Each application has its live model... think of the browser DOM...



                             ...
Why the Eclipse Modeling Framework (EMF)?



             Standard modeling technology in Eclipse
 IfIf I only had a consi...
The Model is Flexible
No distinction between View/ Editor

Perspectives are optional

Stack / Sash are optional

Several w...
Attention:

  IfIf I only had a consistent
     I only had a consistent
In viewandcontext the e4
  view and behavior ofof
...
Defining the model

   User changes
                      Base Model provided by:
                      Application.e4xmi

...
Limits of an e4 application

• Only models the Application (frame)


             Modeled
            Workbench
Limits of an e4 application

• Only models the Application (frame)


             Modeled
            Workbench



       ...
Parts in e4


Plain Old Java Objects
(POJO‘s)
Before e4... inheritance ruled...




OBJECT



    EVENTMANAGER



         WORKBENCHPART

                   VIEWPART

 ...
How is this model
translated into UI
components?
Model and UI Renderers
Model

              I don’t care
             who draws me




            • The Workbench model
 ...
Renderers
Renderer Factory

Eclipse default is the
SWT Renderer

Can be selected at
Startup via parameter
Renderers
Renderer Factory                          Widget Renderer




                      Returns for every
          ...
Widget Renderer
• Each UI elements gets a renderer
• Renderer manage Lifecycle of the UI-
  Element
  – Creation
  – Model...
e4 and Styling
Styling in Eclipse 3.x

• UI styling via
  – The Presentation API
  – Custom Widgets
• Very limited
In reality all
RCP apps look
like the an IDE
Eclipse 3.X - IDE                             Eclipse e4 – CSS Styling
feeling




 Example from Kai Toedter

 Some elemen...
How to enable CSS Styling
Property "applicationCSS” in extension point
  org.eclipse.core.runtime.products

<extension
   ...
Example CSS
Label {
   font: Verdana 8px;
   color: rgb(240, 240, 240);
}

Table {
   background-color: gradient radial #5...
Assign custom attributes
• Java

  Label label =
     new Label(parent, SWT.NONE);
  label.setData("org.eclipse.e4.ui.css....
New Look & Feel for Eclipse e4 – SDK




https://bugs.eclipse.org/bugs/show_bug.cgi?id=293481
The e4 Programming
       Model
Dependency Injection
• Inversion of control: The necessary
  functionality is injected into the class



                 ...
Dependency Injection in e4

• JSR 330 compatible injection
  implementation
  – @javax.inject.Inject – Field,
    Construc...
s
             va Clas
           Ja
                                        
 Services are
                              ...
IEclipseContext

– Stores information of possible Injection
  Values
– Hierarchical data structure
– OSGi Services part of...
Services
Eclipse Application Services (“Twenty
                  Things”)

   Editor lifecycle                Long-running
   Re...
Compatibility Layer
Compatibility Layer

• Compatibility layer centers around
  org.eclipse.ui.workbench
  – Contains code to host 3.x API on ...
Eclipse 4.0 SDK
Thanks for listening!
For further questions:
caniszczyk@gmail.com
http://aniszczyk.org
http://twitter.com/caniszczyk
e4: Where to go from here
Eclipse e4 Website
   http://www.eclipse.org/e4
Eclipse e4 Wiki
   http://wiki.eclipse.org/E4
Ec...
License & Acknowledgements
• This work is licensed under:

  –   http://creativecommons.org/licenses/by-nc-nd/3.0/de/deed....
Eclipse e4
Eclipse e4
Eclipse e4
Eclipse e4
Eclipse e4
Upcoming SlideShare
Loading in …5
×

Eclipse e4

11,213 views

Published on

A presentation I gave at the AustinJUG.

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
11,213
On SlideShare
0
From Embeds
0
Number of Embeds
40
Actions
Shares
0
Downloads
68
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide













































  • Eclipse e4

    1. 1. Eclipse e4 Chris Aniszczyk Principal Software Engineer, Red Hat http://aniszczyk.org http://www.twitter.com/caniszczyk
    2. 2. Agenda Why e4? Eclipse 3.X and e4 l e4 workbench mode Styling and Services Compatibility Layer
    3. 3. The e4 project e4 is an Eclipse.org project for platform-related incubation, it’s not a product! The Eclipse Platform needs to innovate to remain viable.
    4. 4. Why e4? • Innovate or become irrelevant • Use e4 technologies as a basis for Eclipse 4.0 (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 – Fix our mistakes
    5. 5. So, what’s wrong with Eclipse 3.X?
    6. 6. 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...
    7. 7. Eclipse Competition...
    8. 8. If only Eclipse application development would be easier... 8
    9. 9. Eclipse e4 – Building blocks Declarative Styling Rendering Engine Modeled Workbench Dependency Injection IEclipseContext Core Services
    10. 10. Eclipse e4 – Add-ons XWT Open Social Gadgets Toolkit Model
    11. 11. The Modeled Workbench
    12. 12. The e4 Workbench Model Each 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
    13. 13. Why the Eclipse Modeling Framework (EMF)? Standard modeling technology in Eclipse IfIf I only had a consistent I only had a consistent view and behavior of the Proven domain model technology view and behavior of the Eclipse workbench optimized runtime (1.5 MB) Eclipse workbench Small and Tooling available Tap in to the EMF and modeling ecosystem
    14. 14. The Model is Flexible No distinction between View/ Editor Perspectives are optional Stack / Sash are optional Several windows easily possible Flexible Toolbars
    15. 15. Attention: IfIf I only had a consistent I only had a consistent In viewandcontext the e4 view and behavior ofof the behavior of the a view and an Eclipse workbench editor are both so called Parts. Eclipse workbench
    16. 16. Defining the model User changes Base Model provided by: Application.e4xmi Contributions possible via extension point org.eclipse.e4.workbench.model Model Components Model can be dynamically changed by User or Code Application.e4xmi User model changes can be stored Application.e4xmi
    17. 17. Limits of an e4 application • Only models the Application (frame) Modeled Workbench
    18. 18. Limits of an e4 application • Only models the Application (frame) Modeled Workbench Content of the view not part of the e4 model
    19. 19. Parts in e4 Plain Old Java Objects (POJO‘s)
    20. 20. Before e4... inheritance ruled... OBJECT EVENTMANAGER WORKBENCHPART VIEWPART VIEW
    21. 21. How is this model translated into UI components?
    22. 22. Model and UI Renderers Model I don’t care who draws me • The Workbench model is independent of a specific UI toolkit
    23. 23. Renderers Renderer Factory Eclipse default is the SWT Renderer Can be selected at Startup via parameter
    24. 24. Renderers Renderer Factory Widget Renderer Returns for every model element
    25. 25. Widget Renderer • Each UI elements gets a renderer • Renderer manage Lifecycle of the UI- Element – Creation – Model to widget binding – Rendering – Disposal
    26. 26. e4 and Styling
    27. 27. Styling in Eclipse 3.x • UI styling via – The Presentation API – Custom Widgets • Very limited
    28. 28. In reality all RCP apps look like the an IDE
    29. 29. Eclipse 3.X - IDE Eclipse e4 – CSS Styling feeling Example from Kai Toedter Some elements cannot currently not be styled: • Menu bar background • Table headers e4 supports theme switching during runtime
    30. 30. How to enable CSS Styling Property "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>
    31. 31. Example CSS Label { 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; }
    32. 32. Assign custom attributes • Java Label label = new Label(parent, SWT.NONE); label.setData("org.eclipse.e4.ui.css.id", "SeparatorLabel"); • CSS #SeparatorLabel { color: #f08d00; }
    33. 33. New Look & Feel for Eclipse e4 – SDK https://bugs.eclipse.org/bugs/show_bug.cgi?id=293481
    34. 34. The e4 Programming Model
    35. 35. Dependency Injection • Inversion of control: The necessary functionality is injected into the class s va Clas Ja
    36. 36. Dependency Injection in e4 • JSR 330 compatible injection implementation – @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
    37. 37. s va Clas Ja Services are injected via the the e4 framework public class ListView { @Inject private IEclipseContext context; @Inject private Logger logger; @Inject public ListView(Composite parent) { // ...
    38. 38. IEclipseContext – Stores information of possible Injection Values – Hierarchical data structure – OSGi Services part of the Context – Dynamic context information: Possibility to contribute an IContextFunction through DS to construct Objects on the fly
    39. 39. Services
    40. 40. Eclipse Application Services (“Twenty Things”)  Editor lifecycle  Long-running  Receiving input operations  Producing selection  Progress reporting  Standard dialogs  Error handling  Persisting UI state  Navigation model  Logging  Resource management  Interface to help  Status line system  Drag and drop  Menu contributions  Undo/Redo  Authentication  Accessing preferences  Authorization  Don‘t forget: OSGi services are also available via dependency injection
    41. 41. Compatibility Layer
    42. 42. 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
    43. 43. Eclipse 4.0 SDK
    44. 44. Thanks for listening! For further questions: caniszczyk@gmail.com http://aniszczyk.org http://twitter.com/caniszczyk
    45. 45. e4: Where to go from here Eclipse e4 Website http://www.eclipse.org/e4 Eclipse e4 Wiki http://wiki.eclipse.org/E4 Eclipse e4 Whitepaper http://www.eclipse.org/e4/resources/e4-whitepaper.php
    46. 46. 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

    ×