|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
【Teamcenter胖客户端开发】teamcenter菜单添加图文教程<1>
9 D5 W1 l; [, K( u这部分内容实际上是eclipse的插件开发的功能, 这里做个简单分类,菜单文件的扩展点都是 <extensionpoint="org.eclipse.ui.menus">,添加菜单就是在这里面添加内容。这里只要注意location即可!. g9 I# S7 }! Z+ l- f
(1)在主工具条上添加菜单。" l' f1 t+ `3 I8 s5 o; i' _
<menuContribution+ G/ y4 T9 d# S$ W0 S/ l
locationURI="menu:org.eclipse.ui.main.menu?after=additions">: Q1 n$ e! Y" m" P* f: n
<menu id="com.plmhome.plmhomeTool" label="PLMHome ToolKits">1 X+ T3 T0 Z3 s9 }3 i+ a" W* X
<command
8 J3 I3 L/ r* m: @ commandId="com.plmhome.createFolder.commands.sampleCommand") C& w) ?& L4 {: Y9 e
mnemonic="S"9 W" `9 x% g9 k) Z0 e$ J' F
id="com.plmhome.createFolder.menus.sampleCommand">7 [ J0 O1 K% c$ G; o
</command>
! l4 t% X y9 D1 o9 J. J </menu>4 G: t( U6 `' n p" t( C7 V
</menuContribution>
6 B0 t8 d2 o) w" f' @) C$ u( t) Q6 w m5 |& e
(2)在工具功能的后面添加按钮。
) P: `! @ B' t) C0 j- r" r <menuContribution2 ^+ Z8 e: Z" g6 J9 l) D
locationURI="menu:tools?after=additions">
3 \. D4 ~6 ^* h- ~" \ <command
2 k- c+ f+ D9 _! M% z commandId="com.plmhome.createFolder.commands.sampleCommand"
6 B( [6 e8 {) d- S3 q& d$ {% Y mnemonic="S"9 T; m+ N a( x
id="com.plmhome.createFolder.menus.sampleCommand">
, n& [8 p# k* |0 ^ </command>; T. [- g0 E/ K2 ]+ N5 b& @
</menuContribution>
; ]' {0 t+ W ?$ L \1 ^: R. A2 t* s( y
(3)在右键弹出菜单加按钮
+ l8 o f9 b5 s) B% X/ {: o6 B( B <menuContribution" k' x' Y' N. i
locationURI="popup:org.eclipse.ui.popup.any?after=additions">
4 U, v! o) s4 Q3 N- z <command+ ]2 a+ S2 B; y' G" L- O
commandId="com.plmhome.createFolder.commands.sampleCommand"7 |! A4 A9 t/ u. s( H/ ~
mnemonic="S"" }) m" Y `& }. t! `
id="com.plmhome.createFolder.menus.sampleCommand">5 n" C% G7 R/ D- v" Z( j% K; X/ ]
</command>- g8 ~2 Y+ m# n. _
</menuContribution>! C# b3 \: Y: f; G3 Q8 S5 i
(4)在具体的菜单后面加功能按钮
# K+ T3 @/ F3 G* T% J$ U. D$ D <menuContribution# [3 C( ^! c3 {- [
locationURI="menu:com.teamcenter.rac.ui.views.DetailsView?after=group4">
8 [; F! _+ X. \1 ]; Q <menu0 w$ Y( ] ]& w4 B3 V# R, Z! g/ P
label="PLMHomeToolKits"
1 A2 C& S8 @, b" V/ x+ K: C mnemonic="M"
" {/ N7 U7 p" X id="com.plmhome.createFolder.menus.sampleMenu">
' B# S; W u' J7 @ <command
# n# u( h% i* U; s8 { i! Z; v2 i commandId="com.plmhome.createFolder.commands.sampleCommand"1 R5 w. D: I% F; q+ H7 C
mnemonic="S"
8 n7 | `2 u. W; I; z$ q: ] id="com.plmhome.createFolder.menus.sampleCommand">
' n j \, K$ T- l6 U9 X7 t </command>, s) l' m5 B; ?7 I* N+ v+ R1 m
</menu>
3 E; M& x: y+ g; ?- v) [; ? </menuContribution>2 V8 @2 R# I- C, Q8 A2 G- x! V
) v, a* s8 G7 R4 O( h- M6 A(5)指定位置,直接加按钮
' o, h+ ~# ?9 s( x <menuContribution
; c/ t& w7 @6 h' a. |" w locationURI="toolbar:com.teamcenter.rac.ui.views.DetailsView">) p2 K7 V2 E& D8 ?$ S1 j
<command2 d, d: ?* V4 k* f& `+ g" m
commandId="com.plmhome.createFolder.commands.sampleCommand"
: h2 I1 e$ Z }; {& ^) i3 L* \ icon="icons/sample.gif"
) K" y8 a+ j- r$ h9 h$ ~" U tooltip="Say hello world"( m) t% [5 v- U3 M6 w
id="com.plmhome.createFolder.toolbars.sampleCommand">
4 f6 \+ W3 w- z9 h, U; [ </command>
7 r0 z# C! w" T/ z </menuContribution>, Y; |% ^! h. u4 B( q
( v! j) J4 S# q3 x(6)加工具条按钮
" N+ W9 J [& z" ?- f <menuContribution6 S2 s) m1 h: C$ [
locationURI="toolbar:navigator_Toolbar?after=additions">
$ p' Z' f0 d6 h7 k+ Z, T <toolbar( J' P# U1 t( K; j0 h( O0 _
id="com.plmhome.createFolder.toolbars.sampleToolbar">; b4 s+ ~8 o9 H, f
<command T; {: ~7 U/ \& ` O! K9 Y
commandId="com.plmhome.createFolder.commands.sampleCommand"
6 p: V7 }; N- \ icon="icons/sample.gif"
7 g* v. F- t+ f% V0 ^) S6 c. g tooltip="Say hello world"; q6 U( e4 [) h- b
id="com.plmhome.createFolder.toolbars.sampleCommand">
4 W+ Q8 n5 @: k" ? Y$ Y5 Q </command>
# s* F! L4 A% A; h </toolbar>
( k) a1 h: [+ B </menuContribution>) g" Y2 a6 F9 \) ~5 Q4 z
0 `) }3 V$ Y- C7 ?. I
4 ^ M' Q! @# H" D+ I) E
完整的例子如下:
# R: j. U- B2 ?3 ?
9 b3 u2 x. J7 y<?xml version="1.0" encoding="UTF-8"?>& _" z4 v$ B0 {, [9 o: T
<?eclipse version="3.4"?>& T0 Q7 m. \3 w: F0 ?0 e* y
<plUGin>
) A- P5 M1 ?6 A4 E0 H' t. o' s0 ]
8 Z1 }2 _( m* m) G4 A <extension
; j+ | f% T) H. P* T point="org.eclipse.ui.commands">; J- s+ Q7 X& b4 m7 G0 y; E
<category
* h, e5 l( k0 a# |- m name="Sample Category"
* ~/ S4 [# w# p( Z5 E0 T0 a id="com.plmhome.createFolder.commands.category">
# p, ]; j: Q& X8 g& L </category>
# f2 x; c4 v- U, ]# U* U0 R( R
) s6 T5 T+ K/ [: B% A) m <command
% t3 w' @' y+ C$ N& i name="PLMHome CreateFolder"" Y+ Y+ h' g. r; {: i) T9 m
categoryId="com.plmhome.createFolder.commands.category"* P. x" F# Z$ R$ J% c1 w
id="com.plmhome.createFolder.commands.sampleCommand">' f3 z" c' @. F" t" E3 s r
</command>
/ K7 ~' o% l% R. f
1 G0 n3 @) w+ M1 V6 a. I </extension>
. u# E3 C! g3 u# f' \( n6 w <extension" _0 S6 M: e( K+ L& B
point="org.eclipse.ui.handlers">
4 b2 ?- J' c4 ` B, D \ <handler+ |; _ j) u K$ Z; v2 j# B1 U& J5 a5 n
commandId="com.plmhome.createFolder.commands.sampleCommand"
6 k N5 M! q, o3 E, T class="com.plmhome.createfolder.handlers.SampleHandler">
& e) P% a1 r" Q </handler>
7 C1 Z' d( _" w0 O# U </extension>
1 B- |1 T/ y- r <extension2 m9 P/ @% {# b4 y
point="org.eclipse.ui.bindings">8 X. u# X) i+ x+ Z
<key) d- [/ o2 T5 v. P S* {
commandId="com.plmhome.createFolder.commands.sampleCommand"9 t, I0 r' W1 R) f3 P( x
contextId="org.eclipse.ui.contexts.window"
/ S. V" x, P5 e: p/ \ sequence="M1+6"3 {1 H4 F) y# U) ]( l/ J7 M& h
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">! |% [ L& c' V+ ]
</key>- y+ g( F M1 q" W6 N
</extension>
" Y5 ?6 T6 m. w- Q3 \ <extension
7 X8 H. V3 d; D | point="org.eclipse.ui.menus">' H& q! d' w+ J9 O
' V4 T9 ^7 d' ]9 U1 _ <menuContribution
) G2 v9 a" W* H& g+ X) ]! w* E locationURI="menu:org.eclipse.ui.main.menu?after=additions">
- S) Q' h* C4 @! v* g <menu id="com.plmhome.plmhomeTool" label="PLMHome ToolKits">( i0 G! e9 _/ m- a+ V
<command0 f" K, u8 k5 N, x& v/ q8 y4 R# K
commandId="com.plmhome.createFolder.commands.sampleCommand"8 V0 E; ^; |/ Q0 B1 i
mnemonic="S"
" b+ u$ b, Z' W id="com.plmhome.createFolder.menus.sampleCommand">
1 ^1 ?; O8 p9 a0 U3 `3 M </command>
4 Z, d/ _& _/ O6 n, a </menu>
" f* B' B3 D" y* |9 f( C. { </menuContribution>8 H! g' C. T! d" Z, i
6 K7 \6 J! A/ A9 Q3 b) p# H* j% Z0 T' C! R& c( j1 I
* M/ \1 N+ @: W+ v S
<menuContribution* z* W% Y1 z! m' A9 b5 w+ M, R* y R
locationURI="menu:tools?after=additions">' t& I4 j9 h. [
<command
8 k6 [2 B J }- d2 x: K2 k% q7 f commandId="com.plmhome.createFolder.commands.sampleCommand"
% @: u o( Y. p6 \5 S0 T. P- W mnemonic="S"
! h5 S6 r9 c/ Y; V! V! ? id="com.plmhome.createFolder.menus.sampleCommand">
4 ?8 ~: s I; X! A! X6 Y' i </command>0 ^' f1 `- x- I" }6 T
</menuContribution>
5 T2 D1 e5 A8 U; o) K4 R0 N: I6 A& M+ S. L# V3 \/ K8 |
; ?- N. N. ^( Y& ^# Y; v7 O, n0 A+ A
<menuContribution
t) i; p& n& z0 \( a i# K- L locationURI="popup:org.eclipse.ui.popup.any?after=additions">
) B& g% T- ~$ u. ^4 `0 S+ V3 o <command0 W, e8 G) O, X, e
commandId="com.plmhome.createFolder.commands.sampleCommand"
3 f T( b$ Z0 f mnemonic="S"/ P6 [% P5 o" L3 } }# \
id="com.plmhome.createFolder.menus.sampleCommand">8 T9 c' g' Q3 A2 f2 f% R
</command>
/ H' ?8 }/ V! n6 k& V0 D </menuContribution>8 M5 Q, \. G8 ]; W3 \% y
4 X. W. h/ R# s <menuContribution2 v) T2 L6 A t* f, {+ M7 @
locationURI="menu:com.teamcenter.rac.ui.views.DetailsView?after=group4">
" n5 w. I+ Q, n; a. R0 e <menu
- n$ E+ B8 K5 s* u: ?* |; o/ ] label="PLMHomeToolKits"
1 t1 c" t. N" k+ Y& M( E; V) W mnemonic="M": [; ?: y6 j; I6 @7 `
id="com.plmhome.createFolder.menus.sampleMenu">
" Z/ I/ G6 F* F6 {& N <command' H' ~. x5 E& N# Q8 Z1 B
commandId="com.plmhome.createFolder.commands.sampleCommand" ^; U1 Y9 j- b4 l0 S3 J( L" h
mnemonic="S"
- F% ^5 d& x/ k2 P! s; j. K id="com.plmhome.createFolder.menus.sampleCommand">
2 P$ \8 t. y6 D" a </command>
% b# t3 @% X! U </menu>
, e- f0 S2 q5 H- L# r </menuContribution>
- ~% x i7 V( B+ S: b; G: C4 l5 L* A* c# @
<menuContribution- l& N3 K; r* m+ C# L
locationURI="toolbar:com.teamcenter.rac.ui.views.DetailsView">
! f5 k3 G u, ?8 }# D8 J <command1 y% ~! k( g% |+ i3 A' h8 e
commandId="com.plmhome.createFolder.commands.sampleCommand"
& d- I& f6 h8 Y" |+ T icon="icons/sample.gif"; P0 ?) Q2 R' C6 W2 a3 d
tooltip="Say hello world"6 [: R" E& b, C' p/ A9 I0 H8 B) X
id="com.plmhome.createFolder.menus.sampleCommand">
9 H q+ N) C; A# x </command>8 Y/ B& m* N4 R0 f$ U! ~. Q1 ]1 I, q
</menuContribution>: k+ h# k8 Y- l8 h- v/ U
1 w: ~ m: e9 d4 F( ]! D- k) C& Z1 y* ]; X Y
<menuContribution
, W- g D. V& G4 y* Z( c4 z; D+ k locationURI="toolbar:navigator_Toolbar?after=additions">
! ?" p M( J0 H( k9 S4 i <toolbar
/ D- k- i$ t# b6 [: {8 } id="com.plmhome.createFolder.toolbars.sampleToolbar">
* H- w. D6 R1 E# M6 _ <command) ]5 z! ]3 {5 S0 D A; R
commandId="com.plmhome.createFolder.commands.sampleCommand"
! M$ U1 V u5 R( U& w! \) a4 ?( g icon="icons/sample.gif"
8 V. [' @, R2 [9 B/ \% d tooltip="Say hello world"
8 T( |9 o) N4 b5 i4 Y id="com.plmhome.createFolder.toolbars.sampleCommand">1 ?8 U5 J2 ?* g4 y9 w9 b
</command>
4 i& ^# ]7 o" D) ~ </toolbar>
8 d- b- C( i% r' g4 j" J( {0 f </menuContribution>- ? T* E+ B6 P# m
% H( B0 G5 A7 ~$ P8 \* o% o2 ^! ^. y) X0 s, @0 a
</extension>
- `' e/ r* g" h3 O4 _
( B, j1 H$ J q1 M% y: ?</plugin>/ r% b; b' I R3 x# m. S0 {
1 |6 k! @2 m2 d: h4 a3 [& q }4 U
$ n( j. q' W$ Z
- s! ~ p; c4 l1 h+ r& k3 u
|
|