|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
【Teamcenter胖客户端开发】teamcenter菜单添加图文教程<1>
7 y, y6 ?) N& E& e这部分内容实际上是eclipse的插件开发的功能, 这里做个简单分类,菜单文件的扩展点都是 <extensionpoint="org.eclipse.ui.menus">,添加菜单就是在这里面添加内容。这里只要注意location即可!! q8 w" T7 F# l% ^0 h2 P6 T
(1)在主工具条上添加菜单。
1 E( n! r) j. a. S8 B% _% d <menuContribution \$ ]. T; g1 ]4 F6 |/ L
locationURI="menu:org.eclipse.ui.main.menu?after=additions">
- F! e' f1 F- O, r9 b; U <menu id="com.plmhome.plmhomeTool" label="PLMHome ToolKits">+ B3 X4 x% g3 f6 u7 d
<command
. V( P% c2 R) ^* Q' g% n commandId="com.plmhome.createFolder.commands.sampleCommand"8 r, ~" L" O6 O( b `
mnemonic="S"
: a P, k0 ^. o; H- d, j4 g+ Z id="com.plmhome.createFolder.menus.sampleCommand">) T. @( Y7 S+ k: F
</command>* L( c" Y$ M3 @+ ~9 p& A3 u
</menu>
9 ], m: }0 R5 K# [ </menuContribution>5 Q! [, |* w; q, \7 v5 B
3 x4 x7 y% I: e; M" D, V( H$ U(2)在工具功能的后面添加按钮。1 O( O' d& p7 \& t0 I
<menuContribution
2 d" k c5 T" r( d3 i& C; [9 i0 T locationURI="menu:tools?after=additions">& ~/ [8 [2 k. c: [2 M4 r% I9 K
<command
5 L: Q' n7 Q9 n) d6 G6 J+ q commandId="com.plmhome.createFolder.commands.sampleCommand"
0 s- R4 Y9 y2 p7 G4 D% a# @& N mnemonic="S"
/ L% G J" x6 h- y+ Q id="com.plmhome.createFolder.menus.sampleCommand">* y4 m& ]' m+ _ u+ y; z
</command>7 L+ _9 y* U+ g b6 A- W3 w
</menuContribution>) D! c1 ` ]. u3 m. |+ \
) R0 B! K( I+ Q. p q n& f+ t
(3)在右键弹出菜单加按钮 {# y( {) w4 c2 `! \
<menuContribution
1 P/ i: r5 A0 s locationURI="popup:org.eclipse.ui.popup.any?after=additions">7 E. z* I. Q5 H% n9 P+ ~
<command- W- q/ w% y* {* n( J7 z4 P* j, F
commandId="com.plmhome.createFolder.commands.sampleCommand"4 @( ?# ]$ y8 X0 l& l1 b7 Y7 `
mnemonic="S"
( _( J. r [9 A7 O, m id="com.plmhome.createFolder.menus.sampleCommand">% [- a" P8 I- o) r' ?( j
</command>& i$ r2 q$ D5 c9 F
</menuContribution>
, G1 A6 X) M1 `% I( E( T5 {- E(4)在具体的菜单后面加功能按钮
& p$ K6 E9 y& t7 x <menuContribution: b0 w" E5 b5 n9 @- e; W- |
locationURI="menu:com.teamcenter.rac.ui.views.DetailsView?after=group4">
" {8 \9 d% V! E* N+ B# r <menu
# z- h; N4 H. L$ D: u. i( @ label="PLMHomeToolKits"
2 R6 F$ f% N# q$ t v, U mnemonic="M": V1 q! r; R4 u; \& g
id="com.plmhome.createFolder.menus.sampleMenu">3 B n+ a7 W( a
<command
, K8 O2 E! p$ Q/ L) } commandId="com.plmhome.createFolder.commands.sampleCommand"2 N A9 r; F! ]. p" S
mnemonic="S"" @) J7 k) m' O1 m) n- L4 @7 Z3 b8 w) I, q
id="com.plmhome.createFolder.menus.sampleCommand">
9 ]4 ~% f( M. E3 J) m6 C/ p </command># A0 @+ A$ P7 E: ?) T4 P# w
</menu>
: e9 B3 X1 h1 p1 f </menuContribution>
3 ^" i2 O5 }0 A: v0 t4 l
& C$ }+ Z" W' A9 k2 E" n/ C(5)指定位置,直接加按钮
& v6 H+ |& N2 i <menuContribution
* b( `! ?$ r- a5 x8 `0 ? locationURI="toolbar:com.teamcenter.rac.ui.views.DetailsView">
. q5 C7 x6 K9 S" P( h* z# i <command7 e. v3 o* v6 d. J' A* B
commandId="com.plmhome.createFolder.commands.sampleCommand"
- H- {( I4 B/ A$ J2 n6 Q icon="icons/sample.gif"
) b& t! h. p0 W! C tooltip="Say hello world"2 I: ^+ W4 d! M0 Z1 H' d: ^
id="com.plmhome.createFolder.toolbars.sampleCommand">
5 a- l# i; D6 v4 W' a3 w7 _ </command># p0 n2 w5 `$ D
</menuContribution>+ N. T W3 m l( ~' {+ Q
" x# R; j! r: p(6)加工具条按钮
& _, \' v7 B2 W# v K& q <menuContribution
& p/ T! Q; ^) a) Q" g locationURI="toolbar:navigator_Toolbar?after=additions">
{0 K ?7 }! l! ?3 g <toolbar- D0 h. k, ]8 {. S0 J K
id="com.plmhome.createFolder.toolbars.sampleToolbar">
: q3 g7 Z! D. Z" Z9 E1 i <command6 n/ {# U8 v! Q1 o* I# R5 X
commandId="com.plmhome.createFolder.commands.sampleCommand"0 M6 _) a/ {! L, p/ P" m
icon="icons/sample.gif"! m# I3 u$ `6 V
tooltip="Say hello world"7 l& A2 s! `+ L, e
id="com.plmhome.createFolder.toolbars.sampleCommand">7 [! z4 b+ z [6 B$ }
</command>8 P5 y& @' r6 I: q# T! H( b
</toolbar>; m7 a2 N6 t. i
</menuContribution>* o w$ @8 F" X$ K
; i4 r* U% I& b7 v5 L- a/ r4 \3 {
: z' t9 r* N% {& s3 c6 f4 g完整的例子如下:
. a Y- Q" j+ \- _0 h0 R5 [4 Z; ]# ~. w# T, v7 Q- }( W, S$ M% J
<?xml version="1.0" encoding="UTF-8"?>
6 }. r7 d- Q' \8 ^<?eclipse version="3.4"?>9 n' k" R' U- {6 Q9 o. M6 B+ T
<plUGin>
* _, l+ k# V3 S. _. l$ q1 V
, M7 ]" A& r" v <extension) O r0 d. ~' D2 a! Q$ K4 C
point="org.eclipse.ui.commands">
3 J" p) B% J, `% \ <category6 B4 Z2 c3 e1 u. h I
name="Sample Category"
& ?* D! i# }( s1 r id="com.plmhome.createFolder.commands.category">
+ _: g4 [$ k+ f </category>% w* ~' ]- n1 U) J& c. l, o% o" d
4 f m1 q) p: x. n& ?
<command
% P3 \; \: J1 w7 } L4 L- w name="PLMHome CreateFolder"( U* q4 x# e, A0 S) A) }" u! b
categoryId="com.plmhome.createFolder.commands.category"$ n$ k1 p: M: g; P, I1 t
id="com.plmhome.createFolder.commands.sampleCommand">
9 b0 p) o$ R/ t/ S6 @: m0 I* P </command>
0 z; t5 I$ ?$ I2 _3 S
1 i: \: N2 s" L2 h4 W </extension>
: J1 d9 `7 D/ F* G <extension# b s" C; j5 ?4 L
point="org.eclipse.ui.handlers">
) @* V, G* `* q! K <handler
- Z5 ?( K" s9 ^/ f! ^2 R commandId="com.plmhome.createFolder.commands.sampleCommand"! W( v, w- R' U. m. m2 ]/ t
class="com.plmhome.createfolder.handlers.SampleHandler">- B( h) ~. T; I
</handler>
4 l' C2 o0 b0 G0 G </extension>
$ K( T, c9 d/ ~* s <extension
7 G) _8 k" B5 l$ K point="org.eclipse.ui.bindings">
" c' d; }8 r0 t$ Y <key% u; k7 M+ J* E( b' l$ ~( u
commandId="com.plmhome.createFolder.commands.sampleCommand"
: h3 B+ V8 Y! T2 Y contextId="org.eclipse.ui.contexts.window"+ j! I. w& d' \+ x; k
sequence="M1+6"
n/ c) u6 N( \9 n schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">8 Q* V: |+ w: X7 o5 a0 e$ F
</key>6 l- J! b( y% P& N% `; i; }
</extension>
2 ?* ~8 v2 A" l- L' g: @( S <extension
7 c' ? w2 N2 d# H5 J6 j point="org.eclipse.ui.menus">
& N, M: c5 M4 ?9 K
8 @( j% A8 n& m- |6 M <menuContribution
: D7 P4 @$ i7 g' g0 o P+ ^ locationURI="menu:org.eclipse.ui.main.menu?after=additions"># f* g" h$ B5 p/ [2 G, x' m
<menu id="com.plmhome.plmhomeTool" label="PLMHome ToolKits">
4 b U [% W" `$ _$ M" `+ [0 S3 w <command
$ ?1 o3 `3 X! k1 b! w commandId="com.plmhome.createFolder.commands.sampleCommand"; A* D' \$ F: v) c8 @' N
mnemonic="S"& ?- G/ r. n, y- V; ]
id="com.plmhome.createFolder.menus.sampleCommand">: k8 P/ `6 u+ N
</command>0 X' s! L# O& Z0 X
</menu>
3 E. M! R/ `4 H </menuContribution>
* ]' q4 Q8 n9 M5 P8 M( T8 `; G! u" P; ?8 M
$ V4 p- Y* Z5 {, ~" w9 ]
) t; b- w' w. u- m2 g+ v1 |. j4 U
<menuContribution
2 A, L& B: u) C5 ?+ t. J! K locationURI="menu:tools?after=additions">5 Q4 H/ c$ o6 M* V4 \4 O! ]
<command
3 {$ o) [* L$ E! X! y commandId="com.plmhome.createFolder.commands.sampleCommand"+ y( a2 d6 F- e$ _: U5 U
mnemonic="S"
2 ?3 ^! K4 j* I0 L id="com.plmhome.createFolder.menus.sampleCommand">4 P) A6 g# v- ?
</command>% }( n( _. a, z0 U
</menuContribution>
$ d2 Q# } s. H! x( T7 U: R9 r8 Y! X+ o+ g0 w& o9 U
/ J3 ~8 j) [2 V! L9 a4 q7 X3 C
" N8 e1 i( x1 H3 F1 l: s; s <menuContribution
R4 C$ d# H& a+ ] locationURI="popup:org.eclipse.ui.popup.any?after=additions">* m$ h! A# n3 t+ @& B( Q& y2 d
<command
8 c# h' q2 E/ W k2 ` commandId="com.plmhome.createFolder.commands.sampleCommand"
, F A3 s, r5 C2 H+ ~ mnemonic="S"
+ Q2 S* y/ `( l) I* h$ `7 u5 p id="com.plmhome.createFolder.menus.sampleCommand">9 ?4 s! s3 j/ x
</command>
5 I( W+ ?( ?0 i% { </menuContribution>
$ l. g! f* g( t" s
; R' @/ T( @: | <menuContribution2 ^4 [+ T7 y% k4 n& a
locationURI="menu:com.teamcenter.rac.ui.views.DetailsView?after=group4">
" }6 d1 c5 n1 h) P2 A+ j- Z, y <menu
+ O4 o. F; @$ V; } label="PLMHomeToolKits"& a. @! b$ |! F) o' q- D
mnemonic="M"3 X5 m1 c) O. a# V: T+ Z
id="com.plmhome.createFolder.menus.sampleMenu">
0 N; m0 f( m" B- y <command& c; c- B: B: R/ j q
commandId="com.plmhome.createFolder.commands.sampleCommand"
" W O2 e4 F7 W% I0 K4 O% r0 |7 I mnemonic="S"
9 K/ Q) x% k8 m( Q id="com.plmhome.createFolder.menus.sampleCommand">
7 c/ r& n9 m, D) |3 s1 A# V </command>' R' ~$ v/ T; B L% J
</menu>1 [- G( R. i, y* h% S/ I, v- x& I! ~
</menuContribution>
$ a c& w d" r; V; V# I/ T* g$ J, R# R) p$ p
<menuContribution
, a5 @% _: b+ h- \: D& o locationURI="toolbar:com.teamcenter.rac.ui.views.DetailsView">
* n) v. T* W9 M% \0 @& p+ G <command
, H3 p K( w" Z1 Y commandId="com.plmhome.createFolder.commands.sampleCommand"
3 u7 F! E5 @' J! \5 z4 T icon="icons/sample.gif"
- I* c9 `" A$ v) ?$ x* p' i* O& U tooltip="Say hello world"0 F# a" J& @2 P$ I
id="com.plmhome.createFolder.menus.sampleCommand">
P3 r" d j O6 q; s </command>! ?# } \( }3 Y$ a$ c
</menuContribution>9 c7 A( N$ D; k& t( K K
3 r9 V4 \8 F- |8 S k, I# W% O3 p4 H9 P s% }/ D& f& k" R8 O1 w
<menuContribution
4 k+ m( G" P5 Z. Q locationURI="toolbar:navigator_Toolbar?after=additions">
9 \4 g9 ]. U$ J8 e5 c& ^ <toolbar# _0 C% Q& \, P; k
id="com.plmhome.createFolder.toolbars.sampleToolbar">
; d: `+ m g2 H/ [- X4 b0 s3 L <command6 A9 U( D* I) ^" C4 m
commandId="com.plmhome.createFolder.commands.sampleCommand"
) c" b# w; @0 z# h/ z% n n icon="icons/sample.gif"
5 t% ]8 ] w( q( E: ]/ d tooltip="Say hello world"& S1 }( L* k' S! l `: c
id="com.plmhome.createFolder.toolbars.sampleCommand">9 H% c \ D, E; `8 R) I4 [
</command>8 q" Y; N; V4 y8 r4 b3 B9 m7 q
</toolbar>; ^: K% K- x7 I- A2 ~6 b
</menuContribution>: z l% G- X3 b+ I& L& u6 Z5 w
2 X: j0 l. _0 `) N
J0 g4 v& ?! m! c1 D$ Y; l) W
</extension>) {4 c. O6 q3 |$ ~4 q
+ B+ d. F0 l- n2 n2 G' j F
</plugin>: D# c4 ?& E4 s
' L6 M! T/ P' F. t5 y$ P$ r: X3 _) W
4 ~9 V4 w' x c: E# O4 X. L, y( g1 ~% y5 t0 |
|
|