|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
×
【Teamcenter胖客户端开发】teamcenter菜单添加图文教程<1>& b* o8 b. K: I
这部分内容实际上是eclipse的插件开发的功能, 这里做个简单分类,菜单文件的扩展点都是 <extensionpoint="org.eclipse.ui.menus">,添加菜单就是在这里面添加内容。这里只要注意location即可!6 E4 k1 o1 L. ?8 ]8 n& j" R9 W
(1)在主工具条上添加菜单。7 Q- B& d! ^, w
<menuContribution6 ?4 V$ n5 P7 t: D- X) {
locationURI="menu:org.eclipse.ui.main.menu?after=additions">
' p$ C; U8 p3 D6 Q- X2 l <menu id="com.plmhome.plmhomeTool" label="PLMHome ToolKits">
0 S4 R/ X5 U% Q4 _; ]6 j$ N <command
+ a3 m3 b+ H3 q8 z7 f/ r% q4 ]. d commandId="com.plmhome.createFolder.commands.sampleCommand"% q) h! s* P! I4 T
mnemonic="S"
% {2 u# U9 r9 t$ o9 u4 M8 ~% R id="com.plmhome.createFolder.menus.sampleCommand">
9 i% e8 m. j2 k. c </command>
( f7 K) J/ _4 z q- G </menu>/ N2 L D5 e4 _5 i$ p# K# Q
</menuContribution>
4 k% E- C: {! F! a* ` N: O6 }" g: i
(2)在工具功能的后面添加按钮。
- l' T' T$ t0 l0 E3 ~ <menuContribution
2 O6 w: p0 P$ U; O% l8 g locationURI="menu:tools?after=additions">
9 H2 I" E: e3 O1 W$ j( d" e <command
) c3 {4 K `! X( i9 n2 O! A commandId="com.plmhome.createFolder.commands.sampleCommand" N0 v! z! e: J/ O
mnemonic="S"2 S" f/ l1 C, G. P" _. n1 C
id="com.plmhome.createFolder.menus.sampleCommand">
$ e! n, r) Y8 Y+ l& L" Y- F </command>
( u, L6 K% M/ V E* q </menuContribution>
8 Z, t- ~8 i: `
/ V8 d, ]+ P" ?9 t) n(3)在右键弹出菜单加按钮
M+ ~) x1 N5 H: n; b <menuContribution& q5 @7 S* V) A( w0 W8 H# d
locationURI="popup:org.eclipse.ui.popup.any?after=additions">, @3 s" C( `6 L/ k$ Y
<command* x2 o8 a1 _1 e! E
commandId="com.plmhome.createFolder.commands.sampleCommand"# \# E. X4 B: m1 n* {- d; L( X
mnemonic="S"
1 E& G/ U2 m9 ]7 N) x' b8 Y id="com.plmhome.createFolder.menus.sampleCommand">9 K7 U& f/ S9 ^; f Q5 L; E
</command>
0 B4 ]! }$ z- t5 ]9 m </menuContribution>: X ], X' ]0 c+ O; E3 V6 Q
(4)在具体的菜单后面加功能按钮" a: ^4 t9 X! i8 T |1 a" l
<menuContribution& {! _2 @3 Z K
locationURI="menu:com.teamcenter.rac.ui.views.DetailsView?after=group4">1 i+ F- y- @. v8 `/ Q1 l- p9 l
<menu
+ j/ e# Y1 d' a# l' d/ \' ~ label="PLMHomeToolKits"
5 t0 T+ ~; z6 R: s9 m* F5 x5 P mnemonic="M"+ e6 Q1 A3 O: p
id="com.plmhome.createFolder.menus.sampleMenu">: }( c! s3 f2 I+ v9 V0 ~, t' `
<command9 i1 i7 x6 D9 [4 D- X
commandId="com.plmhome.createFolder.commands.sampleCommand"
6 a) T0 z6 G& |3 c& ]9 p mnemonic="S") N A5 M' }7 }. U) l G2 p6 t- w" }
id="com.plmhome.createFolder.menus.sampleCommand">
' `2 Y# R' E% T% s) r </command>
" ~" J. H* Y$ }! a8 x2 D) k! C </menu>
2 b. I" _4 y$ U% p# Q </menuContribution>
9 M3 O1 n5 Z5 H7 b9 l! X+ M4 y& \% }+ T: @, D
(5)指定位置,直接加按钮
( Z2 }% R1 X3 c. H0 K <menuContribution
) ~% G; k$ E! | locationURI="toolbar:com.teamcenter.rac.ui.views.DetailsView">5 B0 N! D' U+ R" ^7 X4 S8 {# H
<command
1 q$ Y# A& a& E2 r7 W! f commandId="com.plmhome.createFolder.commands.sampleCommand"
# Q% |0 h8 [. h s+ f4 r8 I! R icon="icons/sample.gif"* {: J4 I3 m3 i3 `2 b) g
tooltip="Say hello world"
+ F k/ B9 M0 E+ D id="com.plmhome.createFolder.toolbars.sampleCommand">3 d) |& s- E5 l# k. l. M$ X
</command>4 q% P2 V {9 D% y0 \4 \. N
</menuContribution>
- Q d* g. ^+ K" N/ \. C6 O1 R3 _; Q( M, _, c
(6)加工具条按钮
# R z$ i/ }1 A0 S5 m% I9 |. I9 ^ <menuContribution
. ^* `& X/ S2 g, K8 A locationURI="toolbar:navigator_Toolbar?after=additions">
P7 x1 E9 i5 v1 |2 A, I <toolbar5 ?4 ^ `3 s) h R: A* b6 Z
id="com.plmhome.createFolder.toolbars.sampleToolbar">- g) e2 k( q! K) o. [+ K1 h
<command
" m8 {) s. L, K5 s9 g commandId="com.plmhome.createFolder.commands.sampleCommand"! W' a/ W, r% m Q5 J& `
icon="icons/sample.gif", u. Y8 K$ A7 f1 f; B
tooltip="Say hello world"
$ k: [4 l9 ]: L3 @* u! r$ V id="com.plmhome.createFolder.toolbars.sampleCommand">- Y" }7 i" T$ J5 q9 t
</command>
6 y$ d9 z% S! c </toolbar>* E) r0 \8 T/ h8 W
</menuContribution>* T$ R2 e) S4 |4 D" h
/ d: w) Z& e' w2 P6 X
) k2 L7 x, G( I6 |/ v完整的例子如下:! V3 b3 i% T9 K" J4 N
C0 n. |5 {. J3 O2 a# F' X; Y2 i<?xml version="1.0" encoding="UTF-8"?>) G! d5 p: s& M* ^
<?eclipse version="3.4"?>
0 Q1 _8 a( Q1 I b9 n2 [<plUGin>
# E, L- q9 r. ^0 M( Y9 n/ I7 j7 ]; A+ A w* V' z" F
<extension
, H: M' p8 z: ^# ~6 q0 K' ` point="org.eclipse.ui.commands">
: H+ h2 X- b! x- {1 J. [+ F <category
; r" z1 ~. f+ P; f name="Sample Category"$ z' M9 `, r2 |* d: M, J/ V: Y
id="com.plmhome.createFolder.commands.category">
% O( o" G# ?, e9 k: X6 Y </category>+ U2 j6 L+ l2 Z
9 M t( S$ R% O* {+ A0 d. C
<command8 \: p. `/ s& M% B9 F
name="PLMHome CreateFolder"
! e- x1 c- H9 t; u) ` categoryId="com.plmhome.createFolder.commands.category"$ R, e$ ]+ o5 s I
id="com.plmhome.createFolder.commands.sampleCommand">
+ d* J0 X( ]. s/ B2 o) m </command>2 L5 O+ Q- G4 F
! [: P3 Q( N1 z+ G </extension>) @! r. r# c% d; u
<extension! f! x5 j0 t8 t6 O w, g
point="org.eclipse.ui.handlers">, ]! q1 W* J+ M( V% g9 Y0 N
<handler; }2 z8 G. c) D9 ]3 M
commandId="com.plmhome.createFolder.commands.sampleCommand"/ P' q# ~& n! z
class="com.plmhome.createfolder.handlers.SampleHandler">3 z. x4 l4 V( a2 I4 `3 V& G
</handler>
/ \' l6 v/ O3 f ]& L' D </extension>
, k# |7 v! ^8 O9 L$ { V5 x/ [ <extension% g; A4 q2 {/ R3 ?! t3 B% c. Q
point="org.eclipse.ui.bindings">
! k- g. ^/ d% [; I5 O- o# J/ S! s4 a <key
. Y4 E: b# V3 ?7 [4 Y8 b commandId="com.plmhome.createFolder.commands.sampleCommand"; R3 }9 V9 D% ~$ d2 |8 r! o3 z
contextId="org.eclipse.ui.contexts.window"
3 S* O" I- u7 E) _' R) N$ b, ~% t& z sequence="M1+6"
* K) r/ L0 q6 Q; Y4 ]8 F' g schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
8 Z) h% \# D ?' A! ^5 c </key>9 H2 e5 f. s! Q! ~6 q0 x
</extension>4 U9 ?) u* x9 U: d
<extension( M0 T7 L$ b1 c3 Z$ O+ U3 C
point="org.eclipse.ui.menus">
4 c8 C h: X8 B: c: Y# |: b+ O/ Q' Y+ U
<menuContribution
& m l! c8 f* N1 }" i, ?" V0 ?9 a1 q locationURI="menu:org.eclipse.ui.main.menu?after=additions">4 J" ?# [2 r" ^2 ]( a$ @5 y
<menu id="com.plmhome.plmhomeTool" label="PLMHome ToolKits">1 T' O5 m8 o% }! G
<command
^; ?- S# M) V* i7 q commandId="com.plmhome.createFolder.commands.sampleCommand"$ i3 W2 o1 c. C& }6 B/ D2 d
mnemonic="S"
- Y/ i5 D2 J; m id="com.plmhome.createFolder.menus.sampleCommand">
; z) C' D* I% T1 G; x/ m/ a5 M7 W </command>
; e" V( W- |, h M, K </menu>9 X( @; K2 s* j) r
</menuContribution>, ]6 u2 @5 ?7 k! ^: ]
7 {5 f' b5 l; L, J+ ]) b: _& i y
$ P( X7 ?) i$ {. ?
<menuContribution( M" M' {$ A. ~ C' p. ]
locationURI="menu:tools?after=additions">
' M$ S0 d3 G; [ <command/ a# M9 A& |4 H/ [0 x1 {
commandId="com.plmhome.createFolder.commands.sampleCommand"( L1 q0 f( X; ?- @" Z, o
mnemonic="S"
4 G" n- C( _; l2 A, l7 S id="com.plmhome.createFolder.menus.sampleCommand"> ~- x% Q' k( {
</command>& g& F- l% p) D7 a# ^1 L; q3 G \
</menuContribution>
# q' h% t) E' e3 R- T; g5 \1 {
) n0 i& w3 |, I
`1 ^0 |2 d0 F4 T& t1 m$ s
# I4 o( t/ B' M4 q9 [+ v <menuContribution
: c" r, F# F3 k3 n! U locationURI="popup:org.eclipse.ui.popup.any?after=additions">& g, X6 p5 ]- {6 L
<command6 ]8 A! J7 A( c5 p5 {
commandId="com.plmhome.createFolder.commands.sampleCommand"+ m9 @9 K$ y: U- U/ D) d! C! \
mnemonic="S"/ o- i$ N$ v5 C4 e
id="com.plmhome.createFolder.menus.sampleCommand">
. ]5 ^: x. X9 A+ K: a* H* H% N </command>
: \' L1 _( A6 o </menuContribution>! n& S! V8 [; b
5 @( j ~8 R7 B. H7 Z% U
<menuContribution
- e6 ]/ p& J& H4 z+ A locationURI="menu:com.teamcenter.rac.ui.views.DetailsView?after=group4">
7 d8 C8 z' D( @0 j+ ]) l <menu P0 M/ b2 P1 h5 j2 E" j: X
label="PLMHomeToolKits"
! u! [9 O9 | g, _2 p' [4 g9 Y mnemonic="M" `' Q& J0 x2 V. Y& t+ {- V$ B( y0 S
id="com.plmhome.createFolder.menus.sampleMenu">
" b4 p; y+ F. j: Y <command
+ d0 ^. F( P) M; R commandId="com.plmhome.createFolder.commands.sampleCommand"
; N0 Y$ a, B$ q2 _ mnemonic="S"5 X$ X1 ^# h" @& U, D# ]; F1 l
id="com.plmhome.createFolder.menus.sampleCommand">
, n. Q. N' n* m' B K6 Z; E </command>6 V* m) C! M% c0 [$ j! J) g: X& Y
</menu>
1 u: O" H$ C4 F </menuContribution>: Y8 }, H6 A v8 ^7 R
, _# y; P* ^7 v+ w* L' g8 ^/ k2 v" u
<menuContribution
- q: L6 \. }4 u5 ?3 X locationURI="toolbar:com.teamcenter.rac.ui.views.DetailsView">4 F( e9 X! R) o! r$ h
<command
/ D4 N4 s& q1 W. T: h& R commandId="com.plmhome.createFolder.commands.sampleCommand"
, ^, O+ x; H; q5 K icon="icons/sample.gif"& A5 ?9 p! R7 W7 j
tooltip="Say hello world"+ @. ~4 ^. Q8 t/ @& r/ e3 C& C
id="com.plmhome.createFolder.menus.sampleCommand">
( I, `6 H/ \2 {2 J( Y: l </command>
3 p' B1 N- t0 z" m, k) V% e# a- v8 W </menuContribution>
4 {4 j8 Y% l' u5 W& s0 Y& S$ U
8 Y0 V1 |- \+ }& S1 W
% k$ F; w/ t8 C. ` <menuContribution
8 V# E) s! @* K$ @# R$ i locationURI="toolbar:navigator_Toolbar?after=additions">( \' |7 z) ]" O: {& K$ R6 g
<toolbar8 ?: I; D& B) p8 S! e5 k
id="com.plmhome.createFolder.toolbars.sampleToolbar">* w* g# J$ K% r
<command
* k9 C& o+ @7 Q9 U commandId="com.plmhome.createFolder.commands.sampleCommand"
2 A4 }" t; P; C4 T5 h icon="icons/sample.gif"
& q$ c* V- [1 v4 L Y, s tooltip="Say hello world"( z, J8 L4 ^$ C2 o5 r0 }
id="com.plmhome.createFolder.toolbars.sampleCommand">
6 t; D9 q* B- P; K0 B6 y1 y) X* p </command>
# x) H: Z+ A0 W% J/ ~: L* E! @% B </toolbar>
0 `5 z5 ?3 i9 i# I% a1 R( F/ r </menuContribution>
! W4 r9 h- z2 H" z% d
: b" P% m7 X5 U" ~ _& i: }9 e) A7 z6 a+ |
</extension>4 D" y4 }5 D! f6 o
0 Y7 y. @ D. q: }- e
</plugin>
! V B3 d* e: G! p: @7 n# F1 E
3 E- u- O* b8 F \$ b
& d9 n, Q$ X8 z( v# c# d! `( O, s' {3 [; U" x5 r" ^$ J, F
|
|