You are on page 1of 84

Pow Lo WrlLe ?

our Cwn
Lcllpse lug-lns
8eLh 1lbblus
l8M
ubblus[us.lbm.com
"This material is based upon work supported by the Defense Advanced Research Projects Agency (DARPA)
under its Agreement No. HR0011-07-9-0002
CSCCn 2009, !une 2009
7/13/09 1
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
8efore Auendlng
! Make sure you have a !ava !8L
! AL leasL 3 (aka 1.3)
! l8M or Sun's (noL CC! lncluded wlLh Llnux)
! uownload Lcllpse closslc for your plauorm
! ecllpse.org/downloads
! Save Lhe archlve le, you'll need lL agaln ln Lhe LuLorlal
! CurrenL release Callleo" ls Lcllpse 3.3
7/13/09 2
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
!ava
! Llnux: make sure you have Sun or l8M !ava:
!ava PoLSpoL == Sun
! LlLher !ava 1.3 or 1.6 ls ok (Not gcj!)
7/13/09
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
3
CuLllne
1.! Lcllpse overvlew and lnsLallauon
2.! lnsLalllng exLenslons (lug-lns") vla updaLe Manager
3.! new lug-ln ro[ecL Wlzard, creaLe an Acuon buuon
! lug-ln componenL Lour: ManlfesL, code, resources, eLc.
! Launchlng (self-hosung") - Lesung your plug-ln
4.! More exLenslons: addlng a vlew . modlfy code . run debugger
3.! Wrlung Pelp for your plug-ln, lncludlng P1ML and xML edlung
6.! ackaglng your plug-ln(s): Lcllpse feaLures, updaLe SlLes & Lesung
7.! Pandmade exLenslon: Word CounLer ln edlLor Loolbar -- lf ume permlLs
8.! Source code analysls: C/C++ example - and ecllpse.org source code
reposlLory explorlng -- lf ume permlLs
9.! Summary, 8eferences, Where Lo go from here
nlots ooJ 1lps Alooq tbe woy
7/13/09 4
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
Lcllpse: Cvervlew
! Cpen Source luL & uevelopmenL lauorm
! lauorm-lndependenL
! Crlglnally donaLed by l8M ln 2001, loundauon esL. ln 2004
! now over 180 vendor members (more Lhan l8M)
! 13 SLraLeglc members - slL on Lcllpse loundauon 8oard
! hup://www.ecllpse.org/membershlp/showMembersWlLh1ag.php?1aglu=sLraLeglc
! now over 33 Lcllpse pro[ecLs ln slmulLaneous release
! Cver 100 pro[ecLs overall, more from lndependenLs
! luL (develop wltb Lcllpse)
! AoJ lloqotm (Jevelop ooJ Jellvet yoot Appllcouoo oo top of cllpse)
7/13/09 3
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
lauorms & 8eleases
! 8eleases
! 2006: 3.2 CalllsLo
! 2007: 3.3 Luropa
! 2008: 3.4 Canymede
! 2009: 3.3 Callleo
7/13/09 6
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
Lcllpse ackages
http://eclipse.org/downloads
7/13/09 7
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
arallel 1ools lauorm
My commluer sLaLus lnvolvemenL wlLh Lcllpse:
! Lcllpse.org/pLp
! 1ools for Plgh erformance Compuung
! l8M fundlng from uA8A
! uevelop, Analyze, 8un, MonlLor, uebug, 1une,
8epeaL
7/13/09 8
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
9
8ulldlng
Launchlng
MonlLorlng
Eclipse and PTP: Parallel Tools Platform
http://eclipse.org/ptp
Parallel Debugging
Coding &
Analysis
Performance Tuning
External Tools Framework (ETFw)
!! Bring richness of commercial development tools to the parallel programmer
!! Open and extensible platform to encourage further development
CDT: C/C++
Photran: Fortran
X10DT: X10
Productivity of
Dev. On local
machine
Remote
Host
Lcllpse lnsLallauon
! uownload from ecllpse.org/downloads
! ?ou need a !ava !8L (aL leasL !8L 3)
! Not CcI JlsttlboteJ wltb lloox! Cet 5oo ot l8M.
! 1hls LuLorlal ls based on Lcllpse 3.3 (Callleo")
! Many dlsLrlbuuons - we'll use Lcllpse Classlc"
! CLher dlsLros LargeL dlerenL dev. Audlences
! C/C++, Web, !ava, !ava LL, eLc.
! uownload and unzlp/unLar
! 1haL's lL!
! LxecuLable: ecllpse or ecllpse.exe
7/13/09 10
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
PlnLs and ups:
Muluple lnsLallauons
oo coo eoslly bove moluple lostollouoos of ecllpse.
cllpse exttocts loto o sloqle Jlt. ecllpse
lot tbot wbetevet yoo woot
! /usets/betb/ecl/ecllpse-J.5/ecllpse
! /usets/betb/ecl/ecllpse-J.4/ecllpse
! /usets/betb/ecl/ecllpse-J.J/ecllpse
! klqbt oow l bove ___ (bow mooy?) oo my mocbloe
! wbot coo l soy, lm o pock tot !
7/13/09 11
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
PlnLs and ups: ecllpse.lnl
8efote looocbloq
! nlots ooJ 1lps
! Jlt tbe ecllpse.lol fle to set Jefoolts.
5oqqesuoos.
! cbooqe beop slze ftom
-\ms256m to -\mx512m
! 5et -sbowlocouoo to sbow
wotkspoce oome lo utle bot
! uoot spllt oootbet otq/voloe polt!
! cllpse.lol locouoo
! Moc. ecllpse/cllpse.opp/cooteots/
MocO5/ecllpse.lol
! wlo/lloox. ecllpse/ecllpse.lol
7/13/09 12
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
See next slide for Windows/Linux
PlnLs and ups: ecllpse.lnl
Linux
Windows
7/13/09 13
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
-Xmx512m
Launch Lcllpse
! ./ecllpse or double-cllck execuLable
! Warnlng: Lo assure envlronmenL ls LranslaLed Lo
Lhe execuLable, you may wanL Lo run from
command llne (e.g. Mac CS x)
! Cr edlL: envlronmenL.pllsL
! WhaLever your envlronmenL, make sure !ava ls ln
your paLh
7/13/09 14
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
Launch Lcllpse
! Launch ecllpse, defaulL workspace probably Ck
! Welcome page appears, go Lo workbench
!Close Welcome tab
or
!Select Go to workbench icon
7/13/09 13
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
I usually change it
Lcllpse Workbench
Editor
Stacked views
Project/
Package
Explorer
view
View
Perspectives
7/13/09 16
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
lnsLalllng exLenslons
! lnsLall oLher ecllpse
Lools
! Pelp > lnsLall new
Soware..
! no need Lo do
anyLhlng now.
7/13/09 17
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
! Llnux
updaLe Mgr
! Manual
lnsLallauon:
! droplns/ folder
7/13/09
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
18
lnsLalllng exLenslons
WhaL ls a plug-ln?
! An Lcllpse plug-ln ls a unlL of ecllpse funcuon
! lL exLends" Lhe ecllpse workbench.
! Pas a speclal Lype of manlfesL and (usually) a
plugln.xml le
! May depend on oLher plug-lns
! Can (usually does) conLrlbuLe Lo oLher plug-lns
! LoLs of plug-lns already exlsL (LC1S)
! hup://www.ecllpsepluglncenLral.com/
! hup://ecllpse-pluglns.lnfo ooJ on hup://ecllpse.org
7/13/09
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
19
Lcllpse examples
! We wlll develop Lcllpse plug-lns ln Lhls LuLorlal
vla Lhe bullL-ln example wlzards
! Pow much can you learn from hello world" ?
! A loL, acLually
! 8aslc plug-ln sLrucLure, how Lo hook ln, where Lo
puL your code, whaL your code can do
! 1hen we'll go from Lhere.
7/13/09
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
20
new lug-ln pro[ecL
! llle > new > ro[ecL.
! under lug-ln uevelopmenL
! SelecL lug-ln ro[ecL, nexL >
7/13/09 21
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
Hints and tips:
Make the project name the base package
name - Helps with linking up IDs
(can be difficult to get right later)
Give it a name, e.g.
! com.myco.helloplugin
Next >
new lug-ln pro[ecL (2)
! ConLenL page
! uefaulLs are Ck
! nexL >
7/13/09 22
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
lug-ln LemplaLes
! Choose Pello, World Command" 1emplaLe
!Hit Finish (or Next > then Finish)
7/13/09 23
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
SwlLch erspecuves
! AccepL swlLch Lo lug-ln uevelopmenL erspecuve
! lf you were already ln Lhe lug-ln uevelopmenL erspecuve,
you won'L see Lhls dlalog.
7/13/09
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
24
erspecuves
erspecuves provlde comblnauons of
vlews and edlLors LhaL are sulLed Lo
erformlng a parucular seL of Lasks.
nlots ooJ ups.
oo coo eoslly swltcb
betweeo petspecuves vlo.
1.! wloJow > Opeo letspecuve, ot
2.! cllck tbe Opeo letspecuve bouoo
oo tbe sbottcot bot, ot
J.! cllck ooe of tbe petspecuve lcoos
lo tbe sbottcot bot
oo moy oeeJ to Jtoq tbe sbottcot bots lef eJqe to moke lt wlJet, lo otJet
to sbow oll tbe petspecuve lcoos tbot bove beeo ocuve.
7/13/09
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
23
Shortcut bar
Slmple lug-ln creaLed
! LdlL Lhe plug-ln
manlfesL:
MAnllLS1.Ml
boslcs
plugln.xml
exteosloos
! See xML of manlfesL
! CSCl vs plug-ln
exLenslons
Hints and Tips:
To link current editor with location in project:
Link with editor
7/13/09 26
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
lug-ln source code
! AcuvaLor conLrols
plug-ln llfe cycle
! !ava code for
Pello world"
acuon
! uouble-cllck le Lo open ln edlLor
Lnough of a Lour. LeL's run wlLh our new
exLenslon!
7/13/09 27
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
8unnlng/1esung plug-lns
! Self-hosung"- launch anoLher lnsLance of Lcllpse
! 8unume workbench launches wlLh (usually) everyLhlng ln Lhe
developmenL workbench, plus Lhe new plug-lns belng developed
7/13/09
28
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
Launch
Configuration
Your plug-in code is here
In your workspace
Your users workspace
Development
workbench
Runtime
workbench
8un
! 8un > 8un Congurauons.
! new Lcllpse Appllcauon
On Plug-ins tab
Default selection is what we want:
Launch with all plugins
Run!
7/13/09 29
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
Or use Run icon menu
8unnlng your new plug-ln
! AnoLher lnsLance of Lcllpse ls launched
! Co Lo workbench
LxecuLe:
! 1oolbar lcon
or
Menu
7/13/09 30
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
8aslc plug-ln Lour
! ManlfesL
! MAnllLS1.Ml and plugln.xml
! !ava code
! usually under /src
! CLher resources
! Many are opuonal
! lcons, hLml les, eLc.
7/13/09
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
31
?ou're done!
! ?ou have now wrluen your rsL Lcllpse
plug-ln!
! ?ou're done!
! . !usL klddlng!
! Close Lhe runume workbench
7/13/09
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
32
nexL pro[ecL
! LeL's make anoLher plug-ln LhaL creaLes an
ecllpse vlew
! 1hls wlll use more of Lhe
! Lcllpse exLenslon polnLs (how ecllpse calls yoot
code) and
! Als (Lhe [ava code you wrlLe LhaL does ecllpse
sLu ln your plug-ln)
! And we'll modlfy Lhe [ava code
7/13/09
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
33
new pro[ecL
! new ro[ecL, lug-ln pro[ecL
! name:
com.myco.vlewplugln
! ltoject oome = pockoqe toot
= ploq-lo lJ. Cemoq tbls set
op ot ptoject stott wlll sove
yoo beoJocbes lotet.
! nexL, nexL
! Choose lug-ln wlLh a vlew"
! nexL, llnlsh
7/13/09
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
34
8un
! 8un wlLh jost Lhe new plugln
! 8un > 8un Congurauons
! new Lcllpse appllcauon
! luglns Lag: Launch wlLh: pluglns selecLed.only
! under Workspace, selecL Lhe vlewplugln
(See nexL sllde)
7/13/09
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
33
8un congurauon for launchlng
ooly Lhe vlew plug-ln
7/13/09
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
36
Run with just the
new plugin
!Run >
Run Configurations
!New Eclipse application
!Plugins tab:
!Launch with: plugins
selectedonly
!Under Workspace,
select the viewplugin
Run
8rlng up new vlew
! ln new Lcllpse LhaL launches,
! Wlndow
> Show vlew
> CLher.
7/13/09
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
37
Cur new vlew
! WhaL funcuons
does lL do?
! Cllck on sLu
! Close Lhe
runume
workbench
7/13/09
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
38
Runtime workbench
Look aL code
! Samplevlew lncludes !face frameworks:
! ConLenLrovlder: Lhe ob[ecLs LhaL represenL lLems
ln Lhe vlew
! Label rovlder: Pow Lo dlsplay Lhe ob[ecLs
! vlewarL: Lhe subwlndow
! vlewer: Lhe wldgeL for dlsplaylng ob[ecLs
! 1ablevlewer used here
! Iovo coJe lospecuoo
! novet, bypetllok, cttl-spoce (Moc cmJ-spoce)
7/13/09
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
39
Back in the Development workbench
See next
slide
Code for new vlew
7/13/09
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
40
new Class
! ln ackage Lxplorer under Lhe new pro[ecL,
SelecL package com.myco.vlewplugln"
(1hls makes Lhe new class wlzard
auLomaucally ll ln some values)
! llle, new, Class
! name: lnsLrumenL
! ackage: com.myco.vlewplugln.ob[
! CeneraLe commenLs
! ConsLrucLors from superclass
! llnlsh
7/13/09
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
41
LdlL code for lnsLrumenL
! Add name, numSLrlngs
! Add geuers/seuers:
! SelecL 'lnsLrumenL.[ava' le
! ConLexL menu:
! Source >
CeneraLe geuers and seuers
7/13/09
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
42
!Select all
!Insertion point
last member
!Generate method
comments; OK
LdlL code for lnsLrumenL
Add SLrlng arg Lo consLrucLor, seL name
public Instrument(String name) {
this.name=name;
}
! Save le
! 1he ouLllne so far
7/13/09
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
43
lnsLrumenL.[ava
so far
7/13/09
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
44
// w/o comments:
package com.myco.viewplugin.obj;
public class Instrument {
private String name;
private int numStrings;
public Instrument(String name) {
this.name=name;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getNumStrings() {
return numStrings;
}
public void setNumStrings(int numStrings) {
this.numStrings = numStrings;
}
}
use new ob[ecLs ln ConLenLrovlder
! LdlL Samplevlew.[ava (lL's under com.myco.vlewplugln.vlews package)
! ln vlewConLenLrovlder modlfy geLLlemenLs() add 'lnsLrumenL mandolln,'
! Pover over error marker (red x) Lo see lnsLrumenL cannoL be resolved Lo a Lype"
! 1he code needs a lmporL sLaLemenL Lo resolve lL.
! See nexL sllde on how Lo geL Lcllpse Lo x lL for you!
7/13/09
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
43
use Culck llx - Lo x lmporL
! roblem: lnsLrumenL cannoL be resolved Lo a Lype"
! Soluuon: need Lo add an lmporL sLaLemenL for Lhe new class ln dlerenL package
! Slngle cllck on LlghL 8ulb / roblem marker - or
use conLexL menu (rlghL mouse): Culck llx - or -
(Wlndows CLrl-1) (Mac: Command-1) Lo see suggesuons:
! Adds lmporL Lo Lop of le:
! 5ctoll op to see lt
tbeo, to qo bock.
7/13/09
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
46
CompleLe geLLlemenLs()
! use compleuon/conLenL asslsL, LemplaLes, eLc Lo help wlLh codlng
! Change references Lo auLomaucally posluon semlcolon (see nexL sllde)
public Object[] getElements(Object parent) {!
Instrument mandolin = new Instrument("mandolin");!
Instrument fiddle = new Instrument("fiddle");!
Instrument banjo = new Instrument("banjo");!
return new Instrument[] { mandolin, fiddle, banjo };!
}!
7/13/09
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
47
references
7/13/09
! Lcllpse
references allow
a lot of
cusLomlzauon
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
48
Modlfy Lhe 1able vlew
! Sull ln com.myco.vlewplugln
! Launch agaln. Pmmm . noL a very lnLeresung vlew
! Modlfy Lhe Labelrovlder Lo provlde Lhe lnsLrumenL name
! 8elaunch, see nlce names
! now leL's add columns Lo Lhe Lable
7/13/09
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
49
Modlfy Lhe 1able vlew
Add columns Lo Lhe Lable
! Add Lo Lop of creaLearLConLrol():
! use Culckllx (cllck,l1)
Lo x lmporLs:
org.ecllpse.swL.wldgeLs
! noLe you don'L wanL
Lhe [avax.swlng
classes LhaL Culckllx
wlll also suggesL!
new code down Lo here
7/13/09
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
30
Pave columns, buL.
! 1here are now Lwo columns
! llx geLColumn1exL()
Lo reLurn label
by colomo
7/13/09
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
31
Make columns nlcer
! Also change geLColumnlmage Lo only
reLurn lmage for rsL column
! Launch agaln, we now have:
7/13/09
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
32
More lf ume permlLs
! Add number of sLrlngs Lo lnsLrumenL ob[ecLs
! Add selecuon llsLener Lo col 1: open ln debugger (Cllck on col headlng Lo lnvoke/
geL excepuon. WhaL Lo caLch? Surround wlLh Lry/caLch. ClassCaLchLxcepuon!
Show code LemplaLes LhaL auLomaucally appear for Lhe requlred lnLerfaces.)
! Close runume workbench, LdlL manlfesL, change vlew name and caLegory name,
relaunch
! Cpuonal 1oplc: hook up Lo model Lo recelve changes
7/13/09
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
33
uebugglng
! SeL breakpolnL:
uouble-cllck
aL le edge
! Launch Lcllpse debugger
! 8un and sLep Lhru code
7/13/09
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
34
Run
Debug
Lcllpse debugger
7/13/09
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
33
A Pelp lug-ln
! llrsL, brlng up Lcllpse help Lo see whaL lL does
! Pelp > Pelp ConLenLs
! lor more lnfo: See help, lauorm lug-ln developer gulde
>programmer's gulde > user asslsLance supporL > Pelp
! LeL's make a help plug-ln pro[ecL, and use Lhe
wlzard as an example
7/13/09
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
36
Pelp lugln ro[ecL
! new plugln pro[ecL
! name: com.myco.help,
nexL >, nexL >
! lug-ln wlLh sample help conLenL,
llnlsh
! ro[ecL ls creaLed, manlfesL opens
! eruse pro[ecL conLenLs:
hLml, xml, eLc.
7/13/09
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
37
lnsLall xML/P1ML LdlLors
7/13/09
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
! We need hLml/xml edlLor: lnsLall Lhem!
! Pelp >lnsLall new soware
! Work wlLh: Callleo slLe
! under Web, xML, and !ava LL uev.
! Choose Lcllpse xML LdlLors and 1ools"
and
! Web age LdlLor"
! nexL >, nexL >
AccepL, llnlsh
8esLarL
38
Ldlung P1ML
! P1ML LdlLor:
synLax hlghllghung, ouLllne,
compleuon, eLc.
7/13/09
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
39
!Web page editor:
!2-pane with
wysiwyg
Select file, rightMouse,
Open With
Ldlung xML
! Cpen WlLh > xML LdlLor - ueslgn and Source Labs
7/13/09
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
60
You dont really need the
XML editor for editing
Eclipse manifests, however.
There are special editors for
these.
8un Lhe Pelp lug-ln
! Launch Lhe runume workbench -- as before
! Make sure Lhe new plug-ln ls lncluded ln Lhe plug-lns lncluded ln Lhe
launch congurauon
(lL probably ls)
! ln runume workbench:
! Pelp > Pelp ConLenLs
! See your new conLenL!
! CLher componenLs of Lcllpse Pelp"
! CheaLsheeLs - walk user Lhru sLeps
! Welcome" page conLenL
! .eLc
7/13/09
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
61
ackaglng
! ?ou wanL oLhers Lo be able Lo lnsLall your
plug-ln(s)
! SLeps:
1.! CreaLe a feaLure Lo llsL Lhe plug-lns
2.! CreaLe an updaLe slLe pro[ecL wlLh your
feaLure(s)
3.! 8ulld lL, LesL Lhe lnsLall, and dlsLrlbuLe
! Zlp archlve, or
! Cn web slLe
7/13/09
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
62
CreaLe a feaLure pro[ecL
! An Lcllpse feotote encapsulaLes one or more
plug-lns. lL's Lhe unlL whlch ls lostolleJ by users.
! llle > new ro[ecL,
lug-ln uevelopmenL >
leaLure ro[ecL
nexL >
! ro[ecL name: e.g.
com.myco.Lhlng.feaLure
nexL >
7/13/09
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
63
Add pluglns Lo feaLure
7/13/09
! Add plug-lns
Check all Lhe plug-lns you made
! llnlsh
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
64
leaLure verslons
7/13/09
! ?ou are edlung Lhe
feaLure manlfesL,
feaLure.xml
! Cn Lhe lug-lns Lab:
! verslons.
! Copy verslons from plug-lns
! llnlsh
! Save Lhe feaLure.xml
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
63
updaLe SlLe
7/13/09
! CreaLe updaLe slLe pro[ecL
new ro[ecL, lug-ln uev, updaLe SlLe ro[ecL
name lL e.g.: updaLe"
! ?ou're edlung Lhe slLe.xml le
! Add your new feaLure Lo Lhe SlLe Map" page.
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
66
Add lndex.hLml
7/13/09
! nlots ooJ ups.
! AJJ oo loJex.btml fle lf yoo ploo to bost tbe opJote slte oo o setvet.
! 1beo lf osets qo to yoot opJote slte ukl lo o btowset, tbey woot see oo ettot.
! 1bese Jltecuoos tell tbem to ose tbe ukl wltblo cllpse, oot o btowset.
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
67
8ulld Lhe updaLe SlLe
7/13/09
! 8ulld Lhe updaLe slLe
! Cllck 8ulld All"
! Cr: slLe.xml > rlghLMouse >
uL 1ools > 8ulld slLe
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
68
updaLe slLe: whaL goL bullL
7/13/09
! 1hls pro[ecL conLalns Lhe updaLe slLe :
! slLe.xml
! lndex.hLml
! feaLures dlr
! pluglns dlr
! noLes:
! ln verslons, qualler" was replaced wlLh umesLamp
! Move Lhese Lo a web/le server and you have an
updaLe slLe!
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
69
updaLe slLe: 1esL lnsLall
7/13/09
! LxLracL a clean Lcllpse Suk
! 1ar or unzlp . launch . use new workspace name
$ mkdir test-install!
$ cd test-install!
$ tar -xzf ~/downloads/eclipse-SDK-3.5-macosx-cocoa.tar.gz !
$ cd eclipse!
$ ./eclipse !
! Pelp > lnsLall new
Soware.
! Add . Local any name wlll do
! olnL aL your updaLe slLe pro[ecL locauon
! Check your feaLure, nlsh lnsLall, resLarL Lcllpse ..
! volla! new buuon ln Loolbar, new vlew Loo.
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
70
(Cpuonal) 1weak feaLure/lnsLall
7/13/09
! Add a named CaLegory
! updaLe SlLe pro[ecL: edlL slLe.xml, on SlLe Map"
Lab, cllck new CaLegory", glve lL a name, drag
your feaLure under lL
! 8ebulld slLe slLe.xml > uL 1ools > 8ulld SlLe
! CreaLe new empLy ecllpse Suk (unzlp agaln)
! 8e-lnsLall: may noL see Lhe changes you made.
8emove updaLe slLe pro[ecL & re-add, re-bulld.
! Cachlng makes Lhls awkward!!
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
71
(Cpuonal) Pandmade new LxLenslon
ConLrlbuung Lo an LdlLor's Loolbar - acuon Lo counL words ln
edlLor selecuon
! ln a new plugln pro[ecL, or an exlsung one: LdlL plugln.xml: ManlfesL edlLor, exLenslons Lab
! Add: org.ecllpse.ul.edlLorAcuons
! 1argeL ld: org.ecllpse.ul.uefaulL1exLLdlLor (use browse .. 1o nd lL )
! new > acuon label: M?CC: word counL "
! lcon: selecL Lhe lcons/sample.glf already ln pro[ecL
! 1oolup: M?CC: show word counL of selecLed LexL"
! enableslor: +" (one or more selecLed lLems, Lhls ls edlLor so an lLem ls a characLer ln Lhe edlLor)
! 1oolbarpaLh: addluons"
! ld: (opuonal) change Lo com.example.helloworld.wordcounL ([usL for sanlLy)
! Class: cllck underscored class*:" Lo creaLe wlLh wlzard
! name: WordCounLer
! LnLer code.. (see nexL sllde or provlded sample les for run() and selecuonchanged() meLhods
! ManlfesL: Add dependency on org.ecllpse.ul.edlLors Lo resolve 1exLLdlLor"
! Add dependency on org.ecllpse.[face.LexL Lo resolve l1exLSelecuon"
! Show Culck llx, Crganlze lmporLs. Lo x Lhe lmporLs
! 1esL plugln! Launch runume workbench.
! SelecL LexL ln edlLor, run new Acuon. noLe ooy selecuon works. 8emalnder ls Cpuonal:
! Change Lo only enable on edlLor LexL selecuon - close runume workbench.
! LxLenslons, rlghLmouse on M?CC: word counL (acuon)" new > selecuon and browse for l1exLSelecuon"
! lnspecL Lhe plugln.xml LhaL was generaLed. See how Lhe xML changed.
! 8elaunch, noLe acuon buuon ls greyed ouL lf LexL lsn'L selecLed ln Lhe edlLor
7/13/09
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
72
(parL of) WordCounLer.[ava
asL Lhls lnslde Lhe class [}
!"#$%&'()'*&+,#&-"(&'*&+,#&-".(
/&%01(23%4(5&"#36(!"#$%$&'()(*&#+,-,.,/0123456789:;;<=>?@ABCDEFGHI%J-;K;L.5,
!784#1($-#,(/'&910$'+,#&-":;910-3(%10-3<(;+,#&-"=%"&(&%"6'&+,#&-">(?(
LexLLdlLor = (1exLLdlLor) LargeLLdlLor,
}(
!784#1($-#,("73:;910-3(%10-3>(?(
luocumenL documenL = LexLLdlLor.geLuocumenLrovlder().geLuocumenL(LexLLdlLor.geLLdlLorlnpuL()),
l1exLSelecuon Ls = (l1exLSelecuon) LexLLdlLor.geLSelecuonrovlder().geLSelecuon(),
((#3&(&-@'3A-73&.(
&"B(?(
SLrlng LexL = documenL.geL(Ls.geLCseL(), Ls.geLLengLh()),
LokenCounL = 3'C(5&"#36)-@'3#D'":&'*&<(!"#$%$&'()(*&#+H/MNOKP*NQRKSGH5,
} 1%&1E(:F%,G-1%0-3+*1'!0-3('>(?(
LokenCounL = 0,
}
Messageulalog.opeolofotmouoo(KOTT0,.U$VW&6,!NLX,YNOKP.0,.ZO[\RL,N],^NLXS6,.,J,PNQRKYNOKPH5,
}
!784#1($-#,(/'4'10-3AE%36',:;910-3(%10-3<(;5'4'10-3(/'4'10-3>(?(
#H(:/'4'10-3(IJ(3744(KK(/'4'10-3(#3/&%31'-H(;)'*&5'4'10-3>(?(
l1exLSelecuon sel = (l1exLSelecuon) selecuon,
#H(:/'4L6'&G'36&E:>(JJ(M>(?(
acuon.seLLnabled(H%4/'>.(
} '4/'(?(
acuon.seLLnabled(&"7'>.(
}
} '4/'(?(
acuon.seLLnabled(H%4/'>.(
}
}
7/13/09
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
73
SA: Source Code Analysls
.. And some source code reposlLory fun [ dev.ecllpse.org
. And some plug-ln dependency debugglng
! We wlll do some source code analysls on C/C++ code
! llrsL geL Cu1 (Lcllpse C/C++ uevelopmenL 1ools) : Pelp > lnsLall new soware, Callleo slLe
! Callleo SlLe > rogrammlng Languages, Lcllpse C/C++ uevelopmenL 1ools - geLs Lhe baslcs
Cr: Add SlLe: hup://download.ecllpse.org/Lools/cdL/releases/gallleo - LoLs more lncl. alL. parsers,
uC
! noLe: you musL have gcc/gdb/make eLc. Lo acLually bollJ/too C code - buL noL requlred for Lhls
LuLorlal
! lnsLall and 8esLarL ecllpse
! Check ouL a plugln pro[ecL from dev.ecllpse.org reposlLory:
! Wlndow > Cpen erspecuve > CLher . CvS 8eposlLory Lxplorlng
! ln CvS 8eposlLorles vlew, rlghLMouse, new > 8eposlLory Locauon.
! PosL: dev.ecllpse.org
! 8eposlLory paLh: /cvsrooL/Lools
! user: anonymous, hlL llnlsh
! under Lhe repo locauon, under PLAu, open org.ecllpse.pLp, open Lools folder, open samples folder
! Check ouL org.ecllpse.pLp.pldL.sampleCu1sLaucAnalysls (rlghLMouse, Check CuL)
! Co back Lo uL erspecuve
7/13/09
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
74
SA2: Source Code Analysls
! Look aL pro[ecL org.ecllpse.pLp.pldL.sampleCu1sLaucAnalysls you [usL checked ouL from ecllpse.org
! noLe red x's - open roblems vlew
! lL seems we are mlsslng some requlred
plug-lns
! uL1Cu8: resL of Lhls page ls opuonal
! 1ry Lo see lf we can do wlLhouL Lhem:
! LdlL ML1A-lnl/MAnllLS1.Ml
! uependencles Lab, 8emove:
7/13/09
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
73
!Save manifest.
!Errors are still there. Darn.
!Get MANIFEST.MF back as we found it:
!rightMouse, replace with,
Latest from HEAD
SA3: Source Code Analysls
! LeL's check ouL Lhe pro[ecLs we need Lo correcL Lhe dependency errors.
! 8ack Lo CvS 8eposlLory Lxplorlng erspecuve
! Check ouL org.ecllpse.pLp.pldL.common
and org.ecllpse.pLp.pldL.mpl.analysls.cdL
! 8esolve errors: lorce a rebulld:
! ro[ecL > Clean.
Clean pro[ecLs selecLed below
Check Lhe sampleCu1sLaucAnalysls pro[ecL
! 1here ls sull one error:
! 8uL noLe LhaL Lhere are no complle errors, leL's assume Lhls
dependency lsn'L necessary
! LdlL MAnllLS1.Ml, uependencles Lab, 8emove mpl.analysls,
save manlfesL
! Lrrors gone!
7/13/09
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
76
If you still get dependency errors, and you are sure you shouldnt, try (1)
rebuilding project, or (2) removing and re-adding the dependencies
SA4: Source Code Analysls
! Launch runume Lcllpse workbench wlLh new pluglns
! Cpen C/C++ erspecuve
! Wlndow >Cpen erspecuve > CLher. and selecL C/C++ erspecuve
! ll lL's noL Lhere: LeL's lnspecL
! Close runume workbench
! Cpen Launch cong, lug-lns 1ab, 1argeL lauorm
! Make sure all Lhe Cu1 pluglns are checked
! Lasler: Check all aL Lhe Lop of 1argeL lauorm
! 8elaunch: 1A-uA! Cpen C/C++ erspecuve
! We expecL Lo see more Loolbar buuons. Where are Lhey?
! Cpen Lhe Lrror Log vlew: Wlndow > Show vlew > CLher
! no news.
! Close 8unume workbench. Cpen Launch Cong.
! Cn pluglns Lab, cllck valldaLe lug-lns" (lower rlghL)
Mlsslng plugln!! ls pldL.common checked ln Lhe plug-lns llsL under Workspace? lf no, check lL.
7/13/09
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
77
SA3: Source Code Analysls
! 8e-launch runume Lcllpse workbench wlLh all Lhe changes
! ?ou should now see Lhe lcons for Lhe analysls
! now make a Cu1 ro[ecL
! new C ro[ecL - Pello World AnSl C ro[ecL
7/13/09
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
78
CeL source samples from cdL analysls
plugln, under 'samples' dlr
!Copy and pasLe from one Lcllpse
workbench Lo anoLher!
!See
hup://www.ecllpsecon.org/2008/?
page=sub/&ld=373 - presenLauon
SLauc Analysls ln 1 wlLh Cu1"
SA6: Source Code Analysls
7/13/09
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
79
!Walkast.c
!Select Walkast.c file in
Project Explorer
!Select Walk AST icon in
editor toolbar
!See text output in (dev. Workbench) console
!Note: tree walk includes header files
(its long!)
!See src to this plug-in for examples of
C/C++ manipulation
Summary
7/13/09
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
80
Summary
7/13/09
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
81
Summary
7/13/09
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
82
Summary
! Lcllpse developmenL has a sLeep learnlng curve
! swlmmlng pool of Legos"
! lL's worLh Lhe lnvesLmenL!
! CreaL seL of Lools, greaL communlLy
! 1hls LuLorlal ls really [usL a LasLe" of Lcllpse developmenL
! 1ake advanLage of resources
! 8ooks, slLes, help..
! newsgroups and malllng llsLs
7/13/09
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
83
8eferences
! Coogle
! Lcllpse Pelp - ln your workbench and hup://help.ecllpse.org
! Arucles on ecllpse.org and l8M
ueveloperworks
! 8ooks
! Lcllpse plug-lns by Clayberg and 8ubel (3
rd
ed.)
! !ava ueveloper's Culde Lo Lcllpse (u'An[ou,
McCarLhy eL.al.)
7/13/09
Pow Lo WrlLe ?our Cwn Lcllpse lug-lns :
CSCCn 09
84

You might also like