320 likes | 879 Views
Eclipse Rich Client Platform (RCP). Introduction. Agenda – Introduction to Eclipse RCP. Who am I? Eclipse as a platform What is Eclipse RCP? Extension Points / Extensions Equinox SWT & JFace View coupeling Summary. Who am I ?. Lars Vogel
E N D
Eclipse Rich Client Platform (RCP) Introduction
Agenda – Introduction to Eclipse RCP • Who am I? • Eclipse as a platform • What is Eclipse RCP? • Extension Points / Extensions • Equinox • SWT & JFace • View coupeling • Summary
Who am I ? • Lars Vogel • Working for SAP AG as a product manager responsible for SAP Transportation Management • Open source enthusiastic • Active in the Java and Eclipse ecosystem
Software Requirements • Eclipse RCP distribution, via www.eclipse.org/downlods • Or installation of feature „Eclipse RCP“ via the Eclipse update manager
Eclipse IDE - Building a platform • Platform • Small runtime • Complex applications can be extensible without the need to adjust existing code Platform Extensible Application Application Runtime
Eclipse – Short History • Nov. 2001 – Code released as open Source • Juni 2004 – Eclipse 3.0 based on OSGi and enables Eclipse RCP • Current Eclipse 3.4.2 (aka Ganymede)
What is an Eclipse RCP application? • Local running application using the native widget toolkit • Based on the Eclipse runtime and technology • Eclipse RCP applications can be standalone or may require server communication
Why Eclipse RCP? • Component model • Rich user experience • Platform (OS) independent • Extensible • Re-use of existing Eclipse functionality • Helps avoiding writing boilerplate code, e.g. automatic update • Excellent community
Eclipse RCP application Application Calls PlattfromUI.createAndRunWorkbench ApplicationWorkbenchAdvisor Defines the initial perspective ApplicationWorkbenchWindowAdvisor Settings for the window, e.g. toolbar visible, etc ApplicationActionBarAdvisor Defines initial Actions (outdated)
Important configuration files • MANIFEST.MF – Defines OSGi bundle • plugin.xml – Defines Eclipse extensions and extension points • build.properties – property file for export • PDE (Plug-in Development Environement) provides editors for these files.
Extensions and Extension Points • Extension Points allow to add functionality to pre-defined points • Each plug-in can define it‘s own extension points allowing other to contribute • Each plug-in can define extensions, providing functionality to pre-defined extension points • RCP developer use primary the existing platfrom extension points to define their application
Extensions and Extension Points • plugin.xml contains description of all extensions and extension points • Contributions are only loaded when they are needed -> lazy loading to save memory and keep startup time small *Graphic Source: Internet
Example: Commands • A command in Eclipse is a declarative description of a component and is independent from the implementation details. • A command can be categorized • Key binding can be assigned to the command.
Key components of Eclipse RCP Other Plug-ins… Workbench … JFace … SWT Runtime / Equinox
Equinox Equinox – Modular Architecture • Reference implementation of OSGi • Dynamic module system • Wildly used, e.g. in application servers • Allows to • Define dependencies between Plug-ins • Hide plug-in internal implementation details • Eclipse plug-in is always an OSGi bundle and vice versa
Excursus: Visual Plug-in Dependencies • View available for plug-in dependency analysis • Graphical tool can be found on http://www.eclipse.org/pde/incubator/dependency-visualization/
“Typical” RCP Architecture • Plug-in(s) for the domain model • Plug-in(s) for the core functionality • Plug-in(s) for the UI functionality • Modularity allows you to grow as you go
SWT • SWT Standard Widget Toolkit • Thin layer upon the native GUI libraries • JNI calls • Not a lot of conviniant functionality *Screenshot from the Internet
JFace & Workbench • JFace • UI toolkit that provides helper classes for developing UI features • Tables / TreeViewer / Dialogs / • Can be based on models • Databinding • Workbench • multi-window environment • manages views, editors, perspectives
Example: JFace Viewer • Viewer: Table / Treeviewer: Responsible for the UI • LabelProvider: How is the domain model represented • ModelProvider: Delivery the domain model • ViewerSorter: Sorts values in the viewer • ViewerFilter: Filters values LabelProvider – Which data is represented how ContentProvider – „Dao“ for viewer Viewer – UI, shows data
ViewPartCoupeling • View / Viewer can be selection provider, e.g. getSite().setSelectionProvider(viewer); • Another view can register without knowing which view are responible for the changes • Needs to implement ISelectionListener • Must itself register as SelectionListener, via getSite().getWorkbenchWindow().getSelectionService().addSelectionListener(this) • Allows Loose Coupeling
Eclipse Product • Contains the branding, e.g. splashscreen, icons, „About“ dialog • Configuration for different operating systems • Used for exporting the final application
Excursus: Plug-in Spy • Find in Eclipse which parts you are looking at • Make coding analysis and re-use extremly easy • Shortcut Alt+Shift+F1 • Add org.eclipse.pde.runtime and org.eclipse.ui.forms as dependency to have Plug-in Spy in your own RCP application
Summary • Eclipse RCP is a powerful framework to develop native looking, modular, extensible applications. • „Billions“;-) of new API‘s to learn…. Very powerful but complex framework
Where is much more to Eclipse RCP… • The whole world of Eclipse projects is available for RCP • Modelling (EMF) • Reporting (BIRT) • Graphical Editors (GEF, GMF, Zest) • Automatic Updates (p2 Update) • Presentation Framework • PDE Build / PDE JUnit • Internationalization • Eclipse RCP in the Web -> Eclipse RAP • Eclipse RCP on the mobile device -> eRCP • Eclipse E4 • Styling of UI components via CSS • XWT -> allows declarative UI definition
Recommended Reading • Introduction to Eclipse RCP • http://www.vogella.de/articles/RichClientPlatform/article.html • Eclipse RCP podcast • http://www.eclipsezone.com/files/podcasts/9-RCP-Jeff.McAffer.mp3?source=podcasts • Book: Eclipse Rich Client Platform • By Jeff McAffer and Jean-Michel Lemieux • Addison-Wesley Professional • Attention: Second Edition planned for June 2009