introduction to eclipse rcp

26
Introduction to Eclipse RCP | © 2008 by William Bath Introduction to Eclipse Rich Client Platform William Bath

Upload: whbath

Post on 19-May-2015

4.793 views

Category:

Technology


8 download

DESCRIPTION

An introductory presentation to the Eclipse RCP architecture, what it is, what it can do for you, where you can get started.

TRANSCRIPT

Page 1: Introduction To Eclipse RCP

Introduction to Eclipse RCP | © 2008 by William Bath

Introduction to Eclipse Rich Client Platform

William Bath

Page 2: Introduction To Eclipse RCP

Introduction to Eclipse RCP | © 2008 by William Bath2

What should you get out of this presentation?

What is Eclipse RCP?

Why should you use it?

Core technologies

Understand its structure Plug-ins, Features and Products

IApplication and Co.

Extension Registry

Understand the makeup of the UI Perspectives, Views, Editors and the Workbench

What you need to get started

Page 3: Introduction To Eclipse RCP

Introduction to Eclipse RCP | © 2008 by William Bath3

What is Eclipse RCP?

This is Eclipse, world famous Java IDE and generally cool tool. This is Eclipse RCP, SPOT THE DIFFERENCE?

Page 4: Introduction To Eclipse RCP

Introduction to Eclipse RCP | © 2008 by William Bath

What is Eclipse RCP?

Can be though of as: stripping out the IDE specific components of Eclipse and reusing the generic components with your own custom plug-ins

Is in fact: A generic extensible scalable GUI(?) client that facilitates extremely rapid and sustainable development.

Translation: A set of generic components that can be customised to create your application.

4

Page 5: Introduction To Eclipse RCP

Introduction to Eclipse RCP | © 2008 by William Bath5

What is Eclipse RCP? - Examples

Page 6: Introduction To Eclipse RCP

Introduction to Eclipse RCP | © 2008 by William Bath6

Why should you use it? – Sell it to the managers Well supported by industry with over 170 members

Well known RCP applications (but did you know they were RCP?)

Azureus/VuzeBitTorrent Client

IBM Lotus Expeditor/Symphony

Apache Directory Studio

NASA C/C for Mars Rovers, Phoenix etc

Page 7: Introduction To Eclipse RCP

Introduction to Eclipse RCP | © 2008 by William Bath

Why should you use it? – The good reasons

Plug-in based Modular design, easy breakup of work, encapsulated, reusable

Manages GUI layout Persistent layouts, and sizing, user configurable layouts (perspectives)

Extensible Interface The main menu, tool bar, status bar can be incrementally added to from plug-ins

Code reuse Commands, menus, command handlers, core expressions, re-targetable actions etc.

Update support

7

Page 8: Introduction To Eclipse RCP

Introduction to Eclipse RCP | © 2008 by William Bath

Why should you use it? – The good reasons

Branding Splash screens, intro screen, icon sets, cheat sheets, No need to have anything

“Eclipse” about it

Extensible help

Manages the mundane Preference store, update manager, tips and tricks, navigation

Access to a world of plug-ins Leverage other plug-ins, your application is improved as Eclipse improves (force

multiplier!)

Much more, just ask, look and find; chances are if it is not application specific it is in Eclipse!

8

Page 9: Introduction To Eclipse RCP

Introduction to Eclipse RCP | © 2008 by William Bath

Core Technologies

OSGI Provides the plug-in based environment for Eclipse

Is a standard of which Equinox is the implementation Eclipse uses

Permits lazy-loading of plug-ins

Permits multiple versions of the same plug-ins/packages to coexist

Every Eclipse Plug-in is an OSGI plug-in

Every OSGI plug-in can be treated as a standard JAR outside OSGI

9

Page 10: Introduction To Eclipse RCP

Introduction to Eclipse RCP | © 2008 by William Bath

Core Technologies

SWT/JFace SWT is a Platform independent Widget toolkit that wraps

native Widgets offering native feel and performance.

JFace provides Model-View-Controller wrapping for SWT widgets such as TreeViewer, TableViewer etc.

Swing is arguably the main competing framework with SWT. Many religious arguments with no clear winner in performance.

Widgets must be disposed – in practice not a big deal

10

Page 11: Introduction To Eclipse RCP

Introduction to Eclipse RCP | © 2008 by William Bath11

Under the hood…

Plug-ins

Features

Product

Plug-in

Feature

Plug-in Plug-in

Feature

Plug-in

Feature

Product

Page 12: Introduction To Eclipse RCP

Introduction to Eclipse RCP | © 2008 by William Bath

Plug-ins

Holds code

Resources

Three magical files: build.properties

MANIFEST.MF

plugin.xml

12

source.. = src/output.. = bin/bin.includes = plugin.xml,\ META-INF/,\ .,\ icons/,\ contexts.xml

Manifest-Version: 1.0Bundle-ManifestVersion: 2Bundle-Name: Myplugin Plug-inBundle-SymbolicName: org.osdc.myplugin; singleton:=trueBundle-Version: 1.0.0Bundle-Activator: org.osdc.myplugin.ActivatorRequire-Bundle: org.eclipse.ui, org.eclipse.core.runtimeBundle-ActivationPolicy: lazyBundle-RequiredExecutionEnvironment: JavaSE-1.6

<?xml version="1.0" encoding="UTF-8"?><?eclipse version="3.2"?><plugin>

<extension point="org.eclipse.ui.views"> <category name="Sample Category" id="org.osdc.myplugin"> </category> <view name="Sample View" icon="icons/sample.gif" category="org.osdc.myplugin" class="org.osdc.myplugin.views.SampleView" id="org.osdc.myplugin.views.SampleView"> </view> </extension></plugin>

Page 13: Introduction To Eclipse RCP

Introduction to Eclipse RCP | © 2008 by William Bath

Features

Groups Plug-ins

Groups Features

Specifies Versions

Two magical files: build.properties

feature

13

bin.includes = feature.xmlsrc.includes = feature.xml

<?xml version="1.0" encoding="UTF-8"?>

<feature id="org.osdc.myfeature" label="Myfeature Feature"

version="1.0.0">

<description url="http://www.example.com/description"> [Enter Feature Description here.] </description>

<copyright url="http://www.example.com/copyright"> [Enter Copyright Description here.] </copyright>

<license url="http://www.example.com/license"> [Enter License Description here.] </license>

<requires> <import plugin="org.eclipse.ui"/> <import plugin="org.eclipse.core.runtime"/> </requires>

<plugin id="org.osdc.myplugin" download-size="0" install-size="0"

version="0.0.0" unpack="false"/>

<plugin id="org.osdc.myapplication" download-size="0" install-size="0" version="0.0.0" unpack="false"/>

</feature>

Page 14: Introduction To Eclipse RCP

Introduction to Eclipse RCP | © 2008 by William Bath

<?xml version="1.0" encoding="UTF-8"?><?pde version="3.4"?>

<product name="My RCP Product" id="org.osdc.myapplication.product" application="org.osdc.myapplication.application" version="1.0.0" useFeatures="true">

<aboutInfo> <image path="product_lg.gif"/> <text> RCP Mail template created by PDE </text> </aboutInfo>

<configIni use="default"> </configIni>

<launcherArgs> <programArgs>-console -consolelog -debug</programArgs> <programArgsWin>-console</programArgsWin> <vmArgs>-Xmx512m</vmArgs> <vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts</vmArgsMac> </launcherArgs>

<windowImages i16="icons/sample2.gif"/>

<launcher> <solaris/> <win useIco="false"> <bmp/> </win> </launcher> <vm> </vm>

<plugins> </plugins>

<features> <feature id="org.osdc.myfeature" version="1.0.0"/> <feature id="org.eclipse.rcp" version="3.4.0.v20080324a-989JERhEk-jWnd5IY8K5tjxB"/> </features>

</product>

Product

One XML file: myapplication.product

14

Page 15: Introduction To Eclipse RCP

Introduction to Eclipse RCP | © 2008 by William Bath15

The GUI centre of Eclipse

I want a custom email/chat client program to help me work more efficiently I will write the

XMPP/IRC Chat component

And I will write the email client component

Indra Bruce Phil

Page 16: Introduction To Eclipse RCP

Introduction to Eclipse RCP | © 2008 by William Bath16

The GUI centre of Eclipse

Business Logic Plug-in

I will write the XMPP/IRC Chat component

And I will write the email client component

Business Logic Plug-in

GUI components Plug-in GUI components Plug-in

How do we get disparate GUI components to seamlessly integrate forming one application?

With the WORKBENCH!

Bruce Phil

Page 17: Introduction To Eclipse RCP

Introduction to Eclipse RCP | © 2008 by William Bath17

The Workbench

Main Menu bar

Main Cool/Toolbar

Perspective Bar

Editor Area

Statusbar

Fastview bar, progress bar, etc.

Everything here is designed to be contributed to!

Page 18: Introduction To Eclipse RCP

Introduction to Eclipse RCP | © 2008 by William Bath

GUI Goodness… Understanding the UI breakdown Editors

Edit resources

Provides hooks for saving, creating dirty checking etc.

E.g. text editors, image editors etc.

Views Provide insight into the resource being

edited and the problem space around it

E.g. Navigator, Properties, Help etc.

Perspectives Group editors, views, actions etc. into

a cohesive unit to facilitate performing a task

18

View View

ViewTabbed Views

Editor Area

Workbench

Perspective All can be dynamically contributed by plug-ins through the Extension Registry

Page 19: Introduction To Eclipse RCP

Introduction to Eclipse RCP | © 2008 by William Bath

The Extension Registry – What is it?

A repository of XML globally accessible and modifiable by plug-ins (typically through the Plugin.xml but also through code)

Broken up into Extension Points and Extensions

Extension Points are points which Plug-ins expose to permit other plug-ins to extend their functionality

Extensions are what Plug-ins contribute to Extension Points

19

Page 20: Introduction To Eclipse RCP

Introduction to Eclipse RCP | © 2008 by William Bath

The Extension Registry – An Example

20

<extension point="org.eclipse.ui.popupMenus"> <objectContribution adaptable="false" id="org.osdc.myapplication.objectContribution1" objectClass="org.osdc.emailplugin.Email"> <action class="org.osdc.myapplication.Action1" icon="icons/mail.ico" id="org.osdc.myapplication.openemailaction" label="Open Email" tooltip="Opens an email"> </action> </objectContribution> </extension>

<extension-point id="popupMenus" name="%ExtPoint.popupMenus" schema="schema/popupMenus.exsd"/>

org.eclipse.ui (plugin.xml)

org.osdc.myapplication (plugin.xml)

Plug-in org.eclipse.ui exposes extension “org.eclipse.ui.popupMenus” in its Plugin.xml

Plug-in org.osdc.myapplication uses it in its Plugin.xml

Page 21: Introduction To Eclipse RCP

Introduction to Eclipse RCP | © 2008 by William Bath

So you want to be an RCP developer…

Boy there is a lot of XML to be written/maintained

Dependency management/ identification

Bundling all those plug-ins into a application

Where to start?

Can be done with a Java compiler, text editor and libraries, but 9/10 nutritionalists recommend….

21

http://www.eclipse.org/downloads/Select Eclipse for RCP /Plug-in Developers

Page 22: Introduction To Eclipse RCP

Introduction to Eclipse RCP | © 2008 by William Bath

Plug-in Development Environment

Provides Editors to deal with Plug-in.xml, Feature.xml, products etc.

22

Page 23: Introduction To Eclipse RCP

Introduction to Eclipse RCP | © 2008 by William Bath

Plug-in Development Environment

Provides Wizards for creating everything.

23

Page 24: Introduction To Eclipse RCP

Introduction to Eclipse RCP | © 2008 by William Bath

Plug-in Development Environment

Compile time detection of dependency problems

XML issues/mismatch

Tools for creating new Extension Points etc.

Tools for building and bundling whole applications, including continuous integration through headless builds

Really makes development very easy

24

Page 25: Introduction To Eclipse RCP

Introduction to Eclipse RCP | © 2008 by William Bath

More Resources

Get the paper

http://www.eclipse.org/rcp/

http://www.eclipse.org/resources/ - Over 300 articles on everything to do with RCP and Eclipse

http://www.planeteclipse.org/planet/

http://live.eclipse.org/

http://www.eclipseplugincentral.com/

Contact me:

25

Page 26: Introduction To Eclipse RCP

Introduction to Eclipse RCP | © 2008 by William Bath26

That’s All, Folks!

Do try it…