Académique Documents
Professionnel Documents
Culture Documents
com
CONTENTS INCLUDE:
n
About Eclipse Plug-ins
lib/junit.
until the user requests some functionality residing in the plug-in. of directories and jar jar,lib/
files used to extend this xerces.jar
bundle’s functionality.
the osgi manifest
Bundle-Activator: com.dzone.tests.myplugin.Activator
n Bonus content online
Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime
Bundle-ActivationPolicy: lazy n New issue every 1-2 weeks
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle A comma-separated list of rg.eclipse.ui, Eclipse- This allows you to set Eclipse-
symbolic names of other org.eclipse. PlatformFilter particular rules for your PlatformFilter: (&
bundles required by this core.runtime bundle before it can start. (osgi.ws=win32)
plug-in. (osgi.os=win32)
osgi.nl for language (osgi.arch=x86))
Bundle- Manifest header identifying Lazy
osgi.os for operating
ActivationPolicy the bundle’s activation system
policy. This replaces the osgi.arch for
deprecated Eclipse- architecture
LazyStart directive. osgi.ws for windowing
Bundle-Required Manifest header identifying JavaSE-1.6 system
ExecutionEnvironment the required execution
environment for the All entries in the manifest can be internationalized by moving
bundle. The platform them to a separate plugin.properties file.
may run this bundle if
any of the execution
environments named in this the plug-in manifest
header match one of the
execution environments it
implements.
With the Manifest.MF file looking after the runtime
dependencies, plugin.xml deals with the plug-in extensions
Export-package A list of the packages that com.dzone.
this bundle provides for tests.api and extension points.
export to other plug-ins.
An extension allows you to extend the functionality of another
Plug-in Runtime plug-in in your system. An extension can be added through the
The Require-bundle manifest header has some extra plug-in editor’s Extensions tab, or to your plugin.xml.
functionality to help you manage your runtime dependencies. <extension point=”org.eclipse.ui.preferencePages”>
Bundles can be marked as optional dependencies by <page
class=”com.dzone.tests.myplugin.preferences.
annotating the bundle with �;resolution:=optional. SamplePreferencePage”
id=”com.dzone.tests.myplugin.preferences.
SamplePreferencePage”
You can also manage which version of the bundle your name=”Sample Preferences”>
dependent on needs to be present using the ;bundle- </page>
</extension>
version=”<values>” annotation. Here, the <values> that we
refer to are a range of versions where you can specify minimum Each extension point has a XML schema which specifies the
and maximum version ranges. The syntax of this range value is elements and attributes that make up the extension. As you
illustrated through these examples: can see in the listing above, each extension point has a unique
identifier. The <page> element above is specified in the XML
Example Meaning schema for the org.eclipse.ui.preferencesPages extension.
3.5 Dependent only on version 3.5 of this bundle
Plug-ins and extension points are expected to have
[3.5, 3.5.1] Must be either version 3.5 or 3.5.1
Hot the same unique identifiers following the Java
[3.0, 4.0] Must be a version of 3.0 or over, but not 4.0 Tip
package naming pattern.
Additional Eclipse Bundle Headers
Eclipse provides a number of addition bundle headers and You can also define your own extension points, and we will
directives. These extra headers are not part of the OSGi R4.1 detail that process in a later section.
specification, but allow developers to use additional Eclipse
OSGi Framework functionality. Plug-in model
Manifest Entry Use Example The plug-in class is a representation of your plug-in running in
Export-Package Additional directives Export-Package: the Eclipse platform. A plug-in class in Eclipse must extend org.
are available to manage org.eclipse. eclipse.core.runtime.Plugin, which is an abstract class that
the access restriction of foo.internal;
exported packages.
provides generic facilities for managing plug-ins. When using
x-internal:=true
the project wizard in the PDE, this class typically gets assigned
x-internal Export-Package:
Activator as its default name. Whatever name you assign to
org.eclipse.foo.
The default value for this formyfriends; this plug-in class, it must be the same as that mentioned in the
property is false. When x-friends:=”org. Bundle-Activator directive of your MANIFEST.MF.
internal packages are eclipse.foo.
specified as true using this friend1” The class has start and stop methods that refer to the
option, the Eclipse PDE
discourages their use. BundleContext and are provided by the BundleActivator
interface. These methods allow you to deal with the plug-ins
x-friends
lifecycle, so that you can do both initialization and cleanup
This option is similar to activities at the appropriate times. When overriding these
x-internal, but allows
certain bundles to use the
methods be sure to always call the superclass Implementations.
exported packages that
have this option. Other Plug-ins that contribute to the UI will have activators
bundles are discouraged. Hot that extend AbstractUIPlugin, while non-UI plug-ins
The x-internal option
takes precedence over
Tip
x-friends.
will extend Plugin.
Bundle Context Here we will run through some useful extension points in the
A BundleContext is associated with your plug-in when it is Eclipse platform. Note, that to make some of these available
started. As well as providing information about the plug-in, the for your plug-in, you will usually need to add dependencies.
BundleContext can provide information about other plug-ins
in the system. By providing a listener to BundleEvent, you can Example Meaning
monitor the lifecycle of any other plug-in. org.eclipse.core.runtime Allows plug-ins to use the Eclipse
.preferences preferences mechanism, including the
Bundle setting of default preference values.
The terms Bundle and Plug-in may be used interchangeably org.eclipse.core.runtime A plug-in that wishes to use the
when discussing Eclipse. The Bundle class provides us with the .applications platform but control all aspects of its
execution is an application.
OSGi unit of modularity. There are six states associated with
bundles: org.eclipse.core.resources Useful for IDE builders who wish to
.builders provide an incremental project builder,
State Meaning processing a set of resource changes.
In your plugin.xml you take this extension point and provide For identifying your extension point you need to provide a
extra information to help it run. You will usually need to provide unique identifier and a human readable name. At this point
some class that implements a particular interface in order to do you can also point to a schema file and edit it afterwards. An
this. extension point schema must have .exsd as its suffix.
Once you have created your elements and attributes for the
extension point, the element can be added to a sequence
for this extension. You can control the multiplicity of your
extension here.
Useful Tools
Attribute Use
Name The name of the extension point attribute.
Deprecated Whether the attribute is deprecated or not.
Use Whether the attribute is optional, required or
default. Default allows you to specify a value for
the attribute if it hasn’t been used.
Figure 3: The Dependencies Tab
From here you can investigate the plug-in dependency By adding some extra functionality over this simple
hierarchy, starting with your plug-in as the root. You can also implementation, you can leverage p2 to add extra meta data
see which plug-ins are dependent on your own plug-in, as well to your update site, which will make the installation experience
as find any unused dependencies. This can be useful if you faster for end users.
previously added a dependency to use an extension point, but
have found that it is since no longer required. Finally, and most p2 Update Site Publisher
importantly, the tab provides a utility for investigating for cyclic The UpdateSite Publisher application is provided by p2 to
dependencies. generate an artifact.xml and content.xml files for your standard
update site. You can run this application in headless mode
Another useful tool for plug-in development is the Plug-in using org.eclipse.equinox.p2.publisher.UpdateSitePublisher.
Registry view. This can be accessed from the Window>Show The following shows an example of how to run this application,
View>Other..>Plug-in Development category. This view will taken from the p2 wiki.
display all the plug-ins that are currently available in your java -jar <targetProductFolder>/plugins/org.eclipse.equinox.
Eclipse installation. launcher_*.jar
-application org.eclipse.equinox.p2.publisher.UpdateSitePublisher
-metadataRepository file:/<some location>/repository
-artifactRepository file:/<some location>/repository
-source /<location with a site.xml>
-configs gtk.linux.x86
-compress
-publishArtifacts
BIRT provides both programmatic access to report creation, as Rich Ajax Platform
well as functionality to create your own report template within http://eclipse.org/rap
the Eclipse IDE. While BIRT allows you to generate reports in
file formats such as PDF, it is also possible to use BIRT on an With the emergence of the web as a real platform for rich
application server to serve reports through a web browser. applications, the Rich Ajax Platform allows you to take a
standard RCP project, and with some minor modifications,
Equinox make it deployable to the web. This idea of single-sourcing is
http://eclipse.org/equinox
key to the RAP project, and reduces the burden for developers
As we have described in this card, Equinox is the Eclipse to make an application ready for either the desktop or the
implementation of the OSGi R4 core framework specification, web.
and provides the real runtime for all your plug-ins. However, as
well as running your plug-ins on the desktop on an instance of The same programming model is used, while qooxdoo is
Eclipse, you can take Equinox and run it on a server, allowing used for the client side presentation of your SWT and JFace
your plug-in to run on browsers as well as the desktop. widgets.
A BOUT t he A u t h o r
James Sugrue is a software architect at Pilz Ireland, a company using many Eclipse
technologies. James is also editor at both EclipseZone and Javalobby. Currently he is
working on TweetHub, a Twitter client based on RCP and ECF. James has also written
previous Refcardz covering EMF and Eclipse RCP.
Zone Leader: EclipseZone, Javalobby
Twitter: @dzonejames
R E COMM E N D E D b o o k s
This book presents In Eclipse Rich Client
detailed, practical Platform, two leaders
coverage of every of the Eclipse RCP
aspect of plug-in project show exactly
development--with how to leverage Eclipse
specific solutions for the for rapid, efficient,
challenges you’re most cross-platform desktop
likely to encounter. development.
Bro
ugh
t to
you
by...
Professional Cheat Sheets You Can Trust
tt erns “Exactly what busy developers need:
n Pa
ld
ona
sig son
McD
simple, short, and to the point.”
De
Ja
By
#8
ired
Insp e
by th
GoF ller con
tinu
ed
ndle
r doe
sn’t
have
to
in tab
Cha d ultip ecific o should cep pat
this if the m up the
man
n M
an ac
z.co
n
sp s ents
be a ject ime. d is see passed
Download Now
Com reter of ob at runt handle plem ks to de to
...
n
uest som tion proces e no m
Itera tor ore req
n A g in metho
d
cep
dm ndlin
e e ar
tho e to ptio th
Exce ion is sm to ha up th tered or
e ca
n
Ob
se Me S renc ral
Refcardz.com
plate RN refe listed in mp
le ce pt ni
echa n pa ssed co un avio
Beh
TTE
n
ex
is en
ick
Agile Adoption 3 Windows Powershell
am
Tem Exa he .
A s has ack. W tion uest to ject
NP a qu s, a ct- cep Ob
it
n
st q
IG e s e rn b je call e ex e re
vid patt able O le th nd th
DES
! V is
pro s, hand s to ha
UT ard ign us ram .
des diag
F# Dependency Injection with EJB 3
ct
ABO refc oF) f Re le obje
erns ts o lass exa
mp oke
r
Patt ur (G lemen es c Inv
arz
n F o d rl d h
Des
ig go
f s: E inclu al w
o suc
Th is G a n
l 23 sign Pa
tt e rn e rn
patt , and a
re je ts
t ob mentin
c g AN
D
WPF Netbeans IDE JavaEditor
c
a h c M M
ef
in c u
orig kD
e
re.
Ea tion ons
tr ple CO ma
nd
boo Softwa rma to c their im om
Blaze DS Getting Started with Eclipse
re R
( low
e x p o n la rg cute is al ch
ati an b rm ts. +exe . Th
bject nship
s su
Cre y c fo je c an o
t th
e
ed
to ob ms, d as ed rela
tio
Get
nsh
ips
that
can psu
Enca quest
the
re
late
sa
and
e ha
to b llbacks
ca
.
nalit
y.
riant
times
or in
varia
ling
the
invo
catio
ing
n.
DZone, Inc. ISBN-13: 978-1-934238-62-2
ra o pose uing nctio led at va hand
io n ti ct cess be
av ,a la P ur
as q
ue
ack
fu je pro
Beh nships t re
1251 NW Maynard
ob
e
ISBN-10: 1-934238-62-7
nd the to
je c a n b callb b e ha eded. m ro nous nality ed
tio ob at c
ed
You ne s need
to ne
sts is couple
d fro
ynch nctio y ne
rela with s th st que
n
e th
e as the fu
itho
ut an is
eals
it
ship Reque y of re de ar
ld be litat pattern ssing w tation articul
e: D tion faci
50795
or
e. Use
n
A hist shou d ce en p
ed to mman for pro implem ents its ting.
cop runtim rela type
ker
Cary, NC 27513
n
S s Whe invo y us
n
s co al m pec
jec t at cla Pro
to Th e
w id el th e ue ue
ac tu
d im
p le ex
are utilizing a job q of the ue is
Ob ged with
n
C ues ueue e que
han eals me.
y dge enq
que s. B en to th
e c : D P roxy Job orithm be giv knowle that is terface
b e ti
cop
g n ct
pile r S in
rato er mp
le of al ed ca to have d obje of the
ss S at com serv
888.678.0399
Exa ut
Deco nes
an
.com
919.678.0300
one
Abst tory
C C
Fac
B
State
t
pte
r eigh y
teg
Ada Flyw Stra od
z
Meth
more than 3.3 million software developers, architects and decision
S S r B
w. d
e rp rete plate
ridg
Refcardz Feedback Welcome
B B
Inte Tem
S B
er tor or
ww
C B r B
NSIB
ILIT
Y B
S
Com
po si te
P O succ
ess
or Sponsorship Opportunities 9 781934 238622
RES
“DZone is a developer’s dream,” says PC Magazine.
F
CH
AIN
O
ace
>> sales@dzone.com
terf r
<<in andle
H st ( )
re
ndle
+ha
ern
1 ki ng
ler by lin .c o
m
and uest one
teH req z
cre () le a w.d
Con uest hand | ww