|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
【Teamcenter胖客户端开发】teamcenter菜单添加图文教程<1>+ P1 |% A! _- j' @" E5 N* O
这部分内容实际上是eclipse的插件开发的功能, 这里做个简单分类,菜单文件的扩展点都是 <extensionpoint="org.eclipse.ui.menus">,添加菜单就是在这里面添加内容。这里只要注意location即可!1 U {3 J/ s/ l, J8 a6 t, h2 `8 o R
(1)在主工具条上添加菜单。7 R4 w! T. i X/ W( y/ q
<menuContribution
s! \* C3 `( j locationURI="menu:org.eclipse.ui.main.menu?after=additions">
$ J u& I( g0 X/ b. _3 A7 p& @ <menu id="com.plmhome.plmhomeTool" label="PLMHome ToolKits">, ]. z- m$ R' S& q+ Z) H
<command1 {2 R2 q: b7 g1 o; k+ h5 [6 W
commandId="com.plmhome.createFolder.commands.sampleCommand"
4 S/ b, C" p" `/ e* i mnemonic="S"7 Y1 M; `+ {' S5 `" I& P9 T3 }( a; V7 |
id="com.plmhome.createFolder.menus.sampleCommand">' \$ ~7 m9 G3 p- R' n0 |
</command> _" l! V7 ^4 W$ q r' @; C
</menu>
8 I" G# k( Q; y </menuContribution>( C; Y. l( }3 F; a4 [; [! H
+ I% a1 v' M, g4 N
(2)在工具功能的后面添加按钮。, ^& e- `3 K/ T7 K$ w1 w# s
<menuContribution3 m( E I) W7 a
locationURI="menu:tools?after=additions">* b% B7 e, n9 {
<command
! s1 R- M! M$ L% K2 b commandId="com.plmhome.createFolder.commands.sampleCommand"
) M) c9 D/ a. E* h9 o* E3 ?! ~ mnemonic="S". O5 V) u2 [5 y4 X
id="com.plmhome.createFolder.menus.sampleCommand">9 z# }7 ^( b8 {9 B% t" |0 K0 r
</command>, N) _& @; y: L% N5 \ z- B4 L0 d
</menuContribution>
+ ?$ l5 {4 s/ a' \* a$ s) L
" E+ P! n+ D- b+ M(3)在右键弹出菜单加按钮
8 Y1 ^! E. u) S4 x% x <menuContribution$ A( K6 D9 F- s; C- V
locationURI="popup:org.eclipse.ui.popup.any?after=additions">& E0 u J4 R$ A9 }2 f7 N: |! r
<command( ]$ b& ]# R _! n
commandId="com.plmhome.createFolder.commands.sampleCommand"3 N3 G! E% }8 \7 x2 c# Y
mnemonic="S"1 w( x' E" e8 P' F& p8 Y
id="com.plmhome.createFolder.menus.sampleCommand">
; p7 ]. e) [. z9 o6 D1 [. {2 _ </command>+ ^" a6 G& Z' K7 c5 ^, @1 }
</menuContribution>/ ^# }3 s6 e/ L P# P4 l& L
(4)在具体的菜单后面加功能按钮- u$ f( L+ l2 h0 l
<menuContribution- x. {$ R* F& ]
locationURI="menu:com.teamcenter.rac.ui.views.DetailsView?after=group4">/ {% X" E# K. Z! Q/ k& L
<menu% }" Q! F. q; P3 f r) ]
label="PLMHomeToolKits"2 |5 j+ @8 T% v* X! j L& v
mnemonic="M" x }6 h- y: v, t- p
id="com.plmhome.createFolder.menus.sampleMenu">1 z( f# K9 u f# D2 c& h8 S' o* R
<command" ~9 N5 i2 u8 U: C
commandId="com.plmhome.createFolder.commands.sampleCommand"
' S% x) r% F! V2 y7 \* H mnemonic="S", X4 `: `7 B! e, s0 f! D
id="com.plmhome.createFolder.menus.sampleCommand">6 ?- v p3 c3 h8 w3 F: z
</command>2 J" C1 F2 v5 X- g# {9 i+ w: r
</menu>
. v' R, y# }5 W/ _$ K </menuContribution>
- l" y$ M6 i, ^# U3 j3 z4 D
. j f) f2 d s$ U9 S- e(5)指定位置,直接加按钮1 N; R4 a* a4 U) ?4 ]2 V2 t
<menuContribution
' p9 h% l$ m6 q0 q% O# P" w( | locationURI="toolbar:com.teamcenter.rac.ui.views.DetailsView">
( v+ t8 G. L" m( o) O% R& P& x) ] <command+ |5 O# c6 C! g2 T
commandId="com.plmhome.createFolder.commands.sampleCommand"
9 O7 Q6 M t2 S L/ g/ b icon="icons/sample.gif"
4 p% @0 i, |/ t( s1 t+ g; v1 z4 T/ D tooltip="Say hello world"
* }: n0 h8 X% [4 e id="com.plmhome.createFolder.toolbars.sampleCommand"># g, h( O1 K9 X! p% M7 }! j7 x- H
</command>
3 r. ^9 \6 h) a </menuContribution>) M5 Y, f. `0 P- n! l# e
5 G; \) E: G2 j) `$ u8 l, M9 z$ ]3 t
(6)加工具条按钮
) Q9 F. I6 S1 q+ R <menuContribution1 }" B( f8 n4 b" x; T, Y- @
locationURI="toolbar:navigator_Toolbar?after=additions">4 j1 e. D) b! \1 {5 E
<toolbar* Y8 d3 F- I' T/ [* K( {* f4 x
id="com.plmhome.createFolder.toolbars.sampleToolbar">
0 P( q+ Y+ `) c* K2 ~! R% P <command; R; O7 C# D! i+ C" e* C' F% `
commandId="com.plmhome.createFolder.commands.sampleCommand"2 I" U1 `+ d; s0 @+ C9 Z8 Q X1 ^
icon="icons/sample.gif"# L- L: A o1 {& P- ^2 _
tooltip="Say hello world"
# a8 G& @& g5 A4 m8 v7 O' n8 t id="com.plmhome.createFolder.toolbars.sampleCommand">
+ \# J% ~( w: P& B5 ~ </command>7 |% U" d. b' ?# V7 X5 v
</toolbar>- e! @+ }) ~7 `9 N' U9 E
</menuContribution>
- Q) {, K6 w3 @. F. s; \! y4 N" |+ p2 y ~0 S
' U1 Q/ O+ }2 b7 h t1 z
完整的例子如下:/ r: E# ]+ g' w& x3 M2 m
[) G. o9 \% Y# W1 y$ w9 v
<?xml version="1.0" encoding="UTF-8"?>0 i, l! y0 i, [0 _9 @
<?eclipse version="3.4"?>7 v- ]7 t6 e8 s, f7 Q
<plUGin>: k9 @6 D; |& G& i( @! A
; O$ r* q$ U$ Z2 b <extension" q( \# X, j5 _9 l8 O! g2 f
point="org.eclipse.ui.commands">
( B" Z5 }4 d2 F( R% K1 a2 S <category
% Y: D( l: [3 y( X6 e4 p name="Sample Category"1 Y1 c! U- B- V! k1 T3 V
id="com.plmhome.createFolder.commands.category">( [7 k( v/ |0 Q/ T
</category>
) ?# f1 B$ ~- P6 |- `) f
3 k; T5 v( O% D( b8 A <command
% N1 A( N1 \4 O name="PLMHome CreateFolder"
+ C8 H$ f& T0 Z" |, ~, p: E9 ~0 @4 w categoryId="com.plmhome.createFolder.commands.category", Z( I1 W' o P' B( b8 \' S6 H
id="com.plmhome.createFolder.commands.sampleCommand">
2 T( S' E& ^& f1 X! S </command>
+ \! o7 G- J1 A, ]
& o8 l) d" x! Z/ H# E6 L </extension>
4 ^$ g6 v, |! D <extension
: d3 S5 b- P: h% u3 w' s point="org.eclipse.ui.handlers">
( k" D# p) S7 W& ^7 K" R, { <handler
5 t# r6 g2 U/ s/ |" M! _5 j commandId="com.plmhome.createFolder.commands.sampleCommand": d- h1 Y3 v1 `. t* Z
class="com.plmhome.createfolder.handlers.SampleHandler">
h( G% b9 [7 U9 n </handler>
5 E6 Z( t( @1 T* ~ </extension>
9 X1 B8 [! `, p% O8 L; x p <extension5 s; C# L9 L% V% c* R/ M
point="org.eclipse.ui.bindings">
3 G. `8 [7 F" G+ { <key7 G4 ]. S, ] d! y% Z
commandId="com.plmhome.createFolder.commands.sampleCommand"1 u/ Q; e1 w0 ^5 `3 g+ v/ ]6 Z' W
contextId="org.eclipse.ui.contexts.window"
/ J. _6 j& @( C( m8 ]- W+ x sequence="M1+6"
' r; l! U; G! k% L! I0 h+ A7 w% F! { schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
) n- P' {9 N+ y </key>
, f& \( F* f2 E9 Q9 ^. O5 M8 A4 J </extension>
) v" R' Y1 V3 ~4 J# M* E5 E <extension
4 T6 ^) S$ ^: r5 u8 n8 k9 q point="org.eclipse.ui.menus">' l4 k, l( W' D. v; a2 H9 G1 i
0 m) C9 X6 ^% \3 s Q7 } <menuContribution
' B$ d8 y! O8 E5 V$ X, D2 l locationURI="menu:org.eclipse.ui.main.menu?after=additions">, E3 ^' E; q0 b d# C0 a* x5 B
<menu id="com.plmhome.plmhomeTool" label="PLMHome ToolKits">& M/ O+ t* \. ?3 o i
<command
# w$ |' K) N W& E' y3 r2 S n; k D commandId="com.plmhome.createFolder.commands.sampleCommand") W8 c% z, H* }
mnemonic="S"
9 c' ~, p' o1 A2 o) |! ~! g id="com.plmhome.createFolder.menus.sampleCommand">5 V' V+ F& Y- ^% B
</command>
% E% e* B* Q3 j4 s* W2 p1 o8 Y </menu>( c: w. A- T, t n: W5 \9 R6 Y
</menuContribution>! s; J5 F4 ~ @0 o
. h3 n0 ` V: x8 {9 u: p5 e9 y( K
) ^6 E# a" V7 n# h; J, n' Z( \) g' ?: W( c5 R! N
<menuContribution3 H- j# p$ k" i8 Q/ c2 Q
locationURI="menu:tools?after=additions">9 R7 r/ D0 N1 ~9 q& p
<command
X0 p+ M2 M0 b- m+ G/ @$ J g commandId="com.plmhome.createFolder.commands.sampleCommand"
7 D E- { E) v mnemonic="S"
* B2 ?* ^" K% Z- z5 X W+ Q id="com.plmhome.createFolder.menus.sampleCommand">8 b3 x7 M" S' s! S1 Z5 J$ L7 e
</command>
0 X4 I3 I- v4 E$ } </menuContribution>$ j! u7 }% s! _
7 h* d0 R# o7 o! \' h4 K0 ]9 l/ n& ?* S( ~
; T- N5 S Y" g ?
<menuContribution7 T) ~2 ]; f; J# p, f( M
locationURI="popup:org.eclipse.ui.popup.any?after=additions">
( ~; k0 y, J8 T \ <command
( K- G6 n) O8 v3 U2 X+ ^ commandId="com.plmhome.createFolder.commands.sampleCommand"5 L& w3 R7 C, n1 f0 U
mnemonic="S"* }) ^0 o# A! L5 y! f5 {
id="com.plmhome.createFolder.menus.sampleCommand">4 ~ a, x4 w; _( R" o: ^3 K
</command>
- Q) w* U) K: v2 E7 j8 H </menuContribution>7 x1 c- B' Y* V) `5 i. r. T3 K
" ? ~5 k& y5 b3 b! ~% g <menuContribution
: s. h8 w* v; n: ~ q) O# w locationURI="menu:com.teamcenter.rac.ui.views.DetailsView?after=group4">- |( M1 }5 s% ^4 u
<menu
4 r' n7 t5 ^& m O4 p label="PLMHomeToolKits"
- w) G) |& A3 C; a& Q' E# [, @( T mnemonic="M"
; c/ M$ s' M: G/ a& y, j id="com.plmhome.createFolder.menus.sampleMenu">! }( N' ?3 z: }* l$ q& _7 x0 ^
<command& g, a3 U4 ~% w3 e; y4 f- N
commandId="com.plmhome.createFolder.commands.sampleCommand"" [' a9 p( ?6 b
mnemonic="S"+ O1 d- B3 y& L1 n
id="com.plmhome.createFolder.menus.sampleCommand">8 J6 E. J& k. h0 l* \: T3 H, g
</command>
. Q% A# q- |0 R4 w </menu>) {, V3 N9 @/ _8 Q7 h! M
</menuContribution>: l9 L% R$ {/ O9 t' ]$ @
4 B" X$ M: S( L% w& q8 m <menuContribution2 h# Y( ~: v0 I. q4 ^8 N/ W) L. o
locationURI="toolbar:com.teamcenter.rac.ui.views.DetailsView">) o) a) |' C2 z" X
<command8 H5 ?, g; E- I) ~
commandId="com.plmhome.createFolder.commands.sampleCommand"! Z# l; v6 W: @/ h* k8 V
icon="icons/sample.gif"
3 T: w$ |+ d; c5 Q9 i# \0 G tooltip="Say hello world"
0 L$ Q7 @! ]% v. t: Y+ |* r( }5 H+ ~ id="com.plmhome.createFolder.menus.sampleCommand">
2 U: t/ Q" E2 S% }4 I9 _0 [" |2 k- {5 M </command>4 W$ q v( N) g/ V
</menuContribution>
9 _% \' L: l( u; }
# I* `. _8 l* k/ L: J( r
1 P2 [- \& q2 W# s+ H; W4 ] <menuContribution
6 A- M, y9 ? l locationURI="toolbar:navigator_Toolbar?after=additions">
7 p. h, b) o% t. B( q <toolbar
. B$ H* c$ T( v' |; A& E id="com.plmhome.createFolder.toolbars.sampleToolbar">; B8 @; ~( Z2 n d3 P
<command* E+ }( P% Y" R& ]9 ]3 R
commandId="com.plmhome.createFolder.commands.sampleCommand" o* y- {/ W4 ^+ o% }6 c7 {2 K+ b
icon="icons/sample.gif"' R: Q1 {9 `/ F' A6 {: U
tooltip="Say hello world"
0 T8 S: H9 [, _1 n y+ U$ n id="com.plmhome.createFolder.toolbars.sampleCommand">
9 s; C, m& j( `, o( i+ @2 U% ] </command>" x4 B3 a5 c: K- |
</toolbar>% x% F4 X2 I/ O _! l# n: ~
</menuContribution>
5 c* d$ s o# V: C# L' e4 p
; f7 V/ } J% d2 Q6 Y& D4 o
6 F/ i& V3 Z* ^% Y) h6 u </extension>
- X+ \2 O: L; d+ e) [5 K6 X' q7 g) k0 @( m+ S& U$ b0 j; c/ z0 i
</plugin>
0 e, U! q6 A a) ]1 G( J
, x; v; Q e! E+ z/ x. H" q# t3 W% a) a
- G) i! C6 J; a7 p+ _
|
|