|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
【Teamcenter胖客户端开发】teamcenter菜单添加图文教程<1>, ]1 E$ i* z- E( {" F
这部分内容实际上是eclipse的插件开发的功能, 这里做个简单分类,菜单文件的扩展点都是 <extensionpoint="org.eclipse.ui.menus">,添加菜单就是在这里面添加内容。这里只要注意location即可!
- Z% ~7 N" P2 n5 ?! h(1)在主工具条上添加菜单。' x3 \( Q" F2 T6 g [0 s
<menuContribution& z4 ~5 M0 X, Q4 V* _
locationURI="menu:org.eclipse.ui.main.menu?after=additions">& f9 r: f0 `$ S2 z; y: F" ^ {* o
<menu id="com.plmhome.plmhomeTool" label="PLMHome ToolKits">
+ t$ {* R9 [. x. H0 D4 w <command
- J6 C% A# E* d, a2 J% W commandId="com.plmhome.createFolder.commands.sampleCommand"+ o! H7 s' S6 ]( @- c
mnemonic="S"
* _# I* r6 Q& C+ Y6 F, \) ` id="com.plmhome.createFolder.menus.sampleCommand">
/ ^. }" R- J- L( S0 v </command># X- @4 M3 N, K _ t
</menu>( |" h# q. ~( X# |
</menuContribution>6 {6 w- ~1 U' s3 l
5 l; Y7 h6 j0 [
(2)在工具功能的后面添加按钮。 }8 y( I: V) @* A
<menuContribution( t$ M; e- W$ [' A' z1 I8 y* w7 Y
locationURI="menu:tools?after=additions">" \8 x" D& y9 U
<command! r: \) ^; z4 Y2 Z
commandId="com.plmhome.createFolder.commands.sampleCommand"+ Q) @, B+ A3 ]. |5 l
mnemonic="S"9 S& u( u2 s6 [8 M
id="com.plmhome.createFolder.menus.sampleCommand">
$ |0 o. F: y, S, F" j </command>
3 \5 p" @) x! ]) B% ` </menuContribution>" m4 m5 T* G& W( `3 d5 ^6 p; P
( \4 W9 h/ b3 }# s
(3)在右键弹出菜单加按钮
+ F9 d. d7 z v3 B <menuContribution
7 j5 c9 P$ u% t/ P: R locationURI="popup:org.eclipse.ui.popup.any?after=additions">9 K" Q, W* m0 `0 d+ G. Y
<command- d. } b u" y( t
commandId="com.plmhome.createFolder.commands.sampleCommand"4 a# B8 F( k, L& i! }2 O
mnemonic="S"1 s# y6 V" z% z+ T1 W, p
id="com.plmhome.createFolder.menus.sampleCommand">
y; m" l! v4 }4 F! x B" w) o$ ? </command>. P& m# B0 ?$ t& ~6 B* v
</menuContribution>) N& T4 `0 {5 g2 w9 F
(4)在具体的菜单后面加功能按钮( P0 R8 V, j( Y' W
<menuContribution3 M: C4 k& m7 p# N$ n; z( A
locationURI="menu:com.teamcenter.rac.ui.views.DetailsView?after=group4">, ?! o8 ~+ u+ s# @- K) G* e# ~
<menu
! h( |% U8 |0 f. `* x: M label="PLMHomeToolKits"* N# X. z& {( ~% q# u
mnemonic="M"4 Y" _8 W+ T/ `5 V7 ^
id="com.plmhome.createFolder.menus.sampleMenu">
$ Q8 O R8 c, I& B <command
* V6 Z/ X) ~ ]; @7 ? commandId="com.plmhome.createFolder.commands.sampleCommand"
~4 P7 n; B$ O" a mnemonic="S"
; n0 i7 E1 V) H1 [- j1 M id="com.plmhome.createFolder.menus.sampleCommand">
, O8 x B2 o4 Z( V4 F </command>
, s# S& L* l6 v; t: o </menu>
- m* y; [- B: u# q! i2 s </menuContribution>
1 D' n! `3 m: O. N# Q. [% x' P2 @, c- C
(5)指定位置,直接加按钮
& y. D% n& D: q' n2 [! @ <menuContribution
4 g6 K& h. l& s U# [4 Z, s locationURI="toolbar:com.teamcenter.rac.ui.views.DetailsView">, E9 `: n8 H/ B# `- A6 h
<command. h- G% T! W3 E B; [; w' p8 h! l
commandId="com.plmhome.createFolder.commands.sampleCommand"; t, I; M) V% f- d' j
icon="icons/sample.gif"2 L5 U$ Y; R7 s
tooltip="Say hello world"/ j* p) \. l( i2 m$ O
id="com.plmhome.createFolder.toolbars.sampleCommand">! M: f6 m5 o/ b
</command>, B z! v2 P7 e5 P- _
</menuContribution>
# [. Q4 i/ A) V
/ v; y' m8 s- P8 B9 P) C(6)加工具条按钮# u2 ^ p* h) a3 I
<menuContribution0 o& M+ K T. i8 k& f
locationURI="toolbar:navigator_Toolbar?after=additions">2 {' Z$ Y% }8 Q! @
<toolbar" F) e/ K% c' f% ?$ f8 B
id="com.plmhome.createFolder.toolbars.sampleToolbar">
7 g3 G7 k; o6 p2 o <command" {2 N, F: w ?2 j. ` U
commandId="com.plmhome.createFolder.commands.sampleCommand"% R! ~% W& d* @+ h* r) |# N. M
icon="icons/sample.gif"1 o/ r( Q) T/ d$ k5 _; ]$ p
tooltip="Say hello world"; e7 G9 X9 _8 E4 n0 G
id="com.plmhome.createFolder.toolbars.sampleCommand">
+ _% h! E& n% a- q </command>
0 L( {1 [; \: G </toolbar>5 \8 }/ \7 @% O
</menuContribution>
/ B! |# j V2 G" P, }1 C9 w9 W' c, w
5 P* J, X- h# d1 i7 {% z# s( i+ a8 L
' P! R" {* [, r1 m% o. M3 p- W3 [8 X# L完整的例子如下:
0 W! U; v6 X: g, G0 {5 u+ v% Z% i5 n' V- [& L/ C
<?xml version="1.0" encoding="UTF-8"?>2 f8 N6 J! ^, o
<?eclipse version="3.4"?> d( ~; D) K z; k8 W
<plUGin> f# @/ i ~$ Z% V( }
9 P1 j* D' |- o
<extension) n* s0 ]1 Q9 S; ^* P, @
point="org.eclipse.ui.commands">
d2 [1 Y2 \3 ?0 x' a; Q <category6 Y5 Z4 J$ z. G- C# c" X3 [) l w
name="Sample Category"
' |+ `6 `/ N7 Q id="com.plmhome.createFolder.commands.category">3 P: N; O: F9 O6 O; Y, ]: }
</category>
6 U$ m- \$ L( l \1 ]# g5 R, x: J1 g' E0 A" u% C
<command% D- Z& s# Q4 B2 p" b% o, I
name="PLMHome CreateFolder"$ Y) O; Z3 `' C% e; p
categoryId="com.plmhome.createFolder.commands.category"
# ?2 Q3 G8 r0 h! n- [ id="com.plmhome.createFolder.commands.sampleCommand">
- w8 B$ c6 y' X2 g1 V </command>
' K7 e4 y7 t- z, k" R* |
( G1 O, Z0 S4 c7 }' J1 p, [ </extension>9 ]1 d+ Q% R% o
<extension
. N* i, t5 Y' s6 L point="org.eclipse.ui.handlers">
' A m$ k' c6 I0 K) [) j' o! r( l <handler
# n# _* H* ]8 F7 [9 H commandId="com.plmhome.createFolder.commands.sampleCommand"9 ^; V2 T! M' n1 V9 q9 z. _
class="com.plmhome.createfolder.handlers.SampleHandler">' i% r3 A- ?- E2 { P) S
</handler>0 u+ y9 U% r N4 y, s1 z
</extension>9 K6 ]- P6 N9 l
<extension
# }! y0 A- W$ w! M point="org.eclipse.ui.bindings">
/ Q! a4 c, P: t) n" \/ c& L <key
" }( i. }$ T( ~# E commandId="com.plmhome.createFolder.commands.sampleCommand"* _+ X2 ~8 f: a! Z4 {, s0 \
contextId="org.eclipse.ui.contexts.window"; k8 `+ b. g7 n7 y. n/ p
sequence="M1+6"$ r! x% G. n' g+ L7 H
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
$ A/ e I1 L, p U; c! M </key>
& V0 y4 E8 F! V0 u* L+ O5 [ </extension>4 X3 i* |, p& b) f8 U
<extension
& v& a, K$ O* j+ U* B/ w point="org.eclipse.ui.menus">
) {! e" b1 b: g( ^2 J6 {$ ?+ X& l9 Z2 G( d
<menuContribution. X3 P# o- P* {# k% R
locationURI="menu:org.eclipse.ui.main.menu?after=additions">
8 F5 R; h/ r% V3 z- h$ L <menu id="com.plmhome.plmhomeTool" label="PLMHome ToolKits">
% w+ ~! J# m! i6 Q" z/ g" P6 K <command, [% h) V2 L& ]; `3 W! N8 Q
commandId="com.plmhome.createFolder.commands.sampleCommand"
]% h3 ~" P3 [: q0 u# B9 V) V2 \& J mnemonic="S"
& l6 f; F) ]; J4 s2 e: X& z& K2 Y id="com.plmhome.createFolder.menus.sampleCommand">; v1 ?/ p: @5 ] \- W- Y1 D: L. a
</command>8 n; t4 N6 r: x" u! u
</menu>% ^) f: \ C3 _, u$ J; ]
</menuContribution>, S# u* _! [" H( P \) u
0 b3 v# y3 R' \: v" r Y, s
+ B" D" J6 t3 M( u/ I1 H3 d/ d6 ]2 e3 z2 ]( \
<menuContribution
( H% l7 A q& [0 {6 P9 M/ ?5 R locationURI="menu:tools?after=additions">
2 e% \+ t$ G& v <command
- O; U" N1 b+ e9 G$ F2 l% S+ ? commandId="com.plmhome.createFolder.commands.sampleCommand"
8 M3 [9 t- P! Y& b u9 c1 k mnemonic="S") Q0 q u6 Z( o' N: A) M
id="com.plmhome.createFolder.menus.sampleCommand">' o0 Z0 [& x& H: T) D
</command>
. y$ |* G0 u" _! B </menuContribution>
) h, `" L: ?8 [9 D1 a5 `% K) Z4 H8 s% T* S
# R8 U' K* N2 E; q ~2 ^5 f# M0 u( l5 ^, K% q/ P' E. L* G1 ^
<menuContribution
: ?2 \; o9 L0 Q0 e locationURI="popup:org.eclipse.ui.popup.any?after=additions">1 V8 Y" t" _9 T' O+ ^ Q* p1 U# D k
<command
+ _+ e( v* H/ F8 Q3 g commandId="com.plmhome.createFolder.commands.sampleCommand"0 c- }# F; S# D6 T( g2 I
mnemonic="S"% L6 f9 o: \" O# U9 y6 {1 D6 ^
id="com.plmhome.createFolder.menus.sampleCommand">2 |2 g" x) R2 Y& [: {
</command>+ \3 ? C1 r6 N2 v3 e: ~
</menuContribution>
) G) u6 u8 ^' D2 s5 S1 B- U" v& _6 D* }8 x, m; o& A
<menuContribution e: o8 e' X* V8 E# U- e
locationURI="menu:com.teamcenter.rac.ui.views.DetailsView?after=group4">0 B0 J9 a' J L4 Y' \) W0 D
<menu
& k& D* `+ y$ o( A label="PLMHomeToolKits"6 W: J' m% a3 `" z9 ~5 G! s7 G. J: C
mnemonic="M"5 j0 m# g! X6 h* M+ Y
id="com.plmhome.createFolder.menus.sampleMenu">. M1 S( J# m3 _# m
<command
) k6 @: z$ n. K; G commandId="com.plmhome.createFolder.commands.sampleCommand"
+ O0 Z2 t# r# e8 P( V$ _, K) O$ O mnemonic="S"# g, M7 K( s/ o8 ^7 B
id="com.plmhome.createFolder.menus.sampleCommand">( b. K5 {% }' a
</command>
5 E+ H$ \! ~! _/ V </menu>
6 |5 |6 C9 o, I# v! K) D) s </menuContribution>
$ N& {+ G, |7 {4 v. |/ t' x) O M( h
% T: {3 L; J! W( W! E# _+ T. } <menuContribution
! o" t% w7 i% O: c* A/ M( W locationURI="toolbar:com.teamcenter.rac.ui.views.DetailsView">9 c/ b6 J7 J( x) L/ k5 N) G T
<command
; v( |- _3 ?' h4 {8 W commandId="com.plmhome.createFolder.commands.sampleCommand"
3 J7 B) i5 l& t* |. T icon="icons/sample.gif"
5 X% N: i1 v) K$ { tooltip="Say hello world"- L" g6 n. e% {9 T# ?
id="com.plmhome.createFolder.menus.sampleCommand">7 S( ?( U, l- ] _4 S# @2 q
</command>
3 |: E- r' ]) q6 o </menuContribution>- V5 k: ]0 [5 L1 L4 ^4 y% \
# j0 L3 Z. Q. v4 C
. Z8 P5 u4 c) T7 N <menuContribution4 ]3 t9 [2 K' h- m
locationURI="toolbar:navigator_Toolbar?after=additions">; K ]3 H i \ t
<toolbar. e1 {& a7 l: m' _1 m3 g. s8 I: j
id="com.plmhome.createFolder.toolbars.sampleToolbar">
% u" Q+ K$ l& e* Q: Y- a. ?5 A$ t& | <command1 L/ t* t: t& l Q" Y1 k- _
commandId="com.plmhome.createFolder.commands.sampleCommand"( l1 s1 A: A, G8 C6 k
icon="icons/sample.gif"& G* b1 n& g' o, B
tooltip="Say hello world"' Z! S; a) Q. G3 |8 R
id="com.plmhome.createFolder.toolbars.sampleCommand">% Q' A# l/ `& m# u! n4 g/ W) M) T! o7 E- L1 Z
</command>
+ q2 s/ u E9 Z' j3 A& z8 B </toolbar>
/ I( r. `6 F, p+ q </menuContribution>
" e; F3 S$ t: a' y$ g, x- K/ v3 l
* g* y9 Y5 V& g* _! u9 a, T
</extension>
; l0 x5 P& |0 c# a3 \' }. ^6 z0 B4 W% O8 X
</plugin>
/ ]* H' P+ ~2 P# \ P1 E3 ?* v/ X+ P# N% U2 R+ H/ ^$ D
! q/ C( H1 Z( A1 x; j
3 p( u8 S- o. a
|
|