|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
【Teamcenter胖客户端开发】teamcenter菜单添加图文教程<1>
" x- R* J' \3 X2 M7 g. c. F/ ?# W这部分内容实际上是eclipse的插件开发的功能, 这里做个简单分类,菜单文件的扩展点都是 <extensionpoint="org.eclipse.ui.menus">,添加菜单就是在这里面添加内容。这里只要注意location即可!
+ r; |; }+ l- p. I1 w+ t# Z(1)在主工具条上添加菜单。
) a' R% y. m9 A0 ? <menuContribution
" Z; L: J5 O- r% E locationURI="menu:org.eclipse.ui.main.menu?after=additions">
' p/ s' q; V5 q$ m* O$ u <menu id="com.plmhome.plmhomeTool" label="PLMHome ToolKits">
5 u: }- F) L9 V$ ?. g( N# S0 z <command2 h, ]5 u5 A3 ], f. f
commandId="com.plmhome.createFolder.commands.sampleCommand"- Z$ M3 s( C, _
mnemonic="S"
) R0 F3 U( D: z4 I0 @- b; Q id="com.plmhome.createFolder.menus.sampleCommand">$ R) k8 B9 _+ e9 u" N
</command>6 _; F5 ?) p6 h! S2 ~
</menu>' K, x' G# X! s) [" ~+ [
</menuContribution>% {$ {$ t* h* `( R& ]. H
9 }3 v# R, ~9 ~; X, P
(2)在工具功能的后面添加按钮。! _( Q+ G, D6 r- d
<menuContribution6 l( y1 J. X7 _0 T' y
locationURI="menu:tools?after=additions">" p) v8 D! H9 t& Z. y. Y
<command
6 m) k1 h9 l) ^) k5 _' g commandId="com.plmhome.createFolder.commands.sampleCommand"
' C+ r% H g3 {8 l mnemonic="S"' {. U" }" ]3 B: V: L
id="com.plmhome.createFolder.menus.sampleCommand">
# d n- E# ^, V p5 t; I </command># I. |( K, A/ w' k* l0 A4 d
</menuContribution>
! ~1 _& j1 B7 {: p. U! Z2 L5 K- t
. l+ W" V" k8 w. D# r8 Y(3)在右键弹出菜单加按钮
0 {& d, K" B4 l1 T <menuContribution
/ P& f; y4 b* i$ O locationURI="popup:org.eclipse.ui.popup.any?after=additions">
4 i _) H$ r5 s" e$ T4 }0 ?3 Q1 \" _ <command6 d* Z! Q, G1 J* l" p
commandId="com.plmhome.createFolder.commands.sampleCommand"9 J' B, P! F* n4 N( R
mnemonic="S"
+ F2 M& V+ E5 R2 Y1 {( V$ l0 b! G7 i# T id="com.plmhome.createFolder.menus.sampleCommand">" y1 f4 S9 [, z" N- D( h1 D* D
</command>
Q' j# ~. C. }2 G </menuContribution>$ I8 m6 I6 L9 Y. B! }
(4)在具体的菜单后面加功能按钮
3 w% N* m& `9 ~1 M/ c <menuContribution, y1 X- n& r' o" R% O& d& v
locationURI="menu:com.teamcenter.rac.ui.views.DetailsView?after=group4">
5 R; d' r% {0 X7 g( j% A3 W ~ <menu
2 I7 Z- ^% u; H& k; } label="PLMHomeToolKits"8 h$ L: U+ y' c) P/ {
mnemonic="M"
4 c/ H9 w& m% | V' u y+ i id="com.plmhome.createFolder.menus.sampleMenu">
2 _& U4 J. t$ b7 e <command
; d$ `, c: a# d7 g- Y& J$ Z. a commandId="com.plmhome.createFolder.commands.sampleCommand"8 ^6 b$ h. r1 k& G7 V/ v) o8 Q- }
mnemonic="S"# l1 Q# w& y! T3 k
id="com.plmhome.createFolder.menus.sampleCommand">3 S- H( ]' z" ?5 }! l
</command>/ v4 a1 \7 F9 t( Z) ~" F: }
</menu>( H R) v4 `) \
</menuContribution>
5 k( f6 C1 w; M0 B. ]; C# u T; v6 N, y0 P8 {. |6 e$ Z& t1 Q, q0 B
(5)指定位置,直接加按钮
% @% L! k" L" z3 o J0 i <menuContribution5 ?6 g+ g3 j+ C( X, C& A1 F2 Q" }
locationURI="toolbar:com.teamcenter.rac.ui.views.DetailsView">% M9 l5 k$ A' b; M; J# j
<command$ s7 o5 M0 Z7 j( Q7 s6 ~
commandId="com.plmhome.createFolder.commands.sampleCommand"( F4 i4 X& A7 l v) L9 B' d8 Y
icon="icons/sample.gif"6 Y! j* k( R/ i; I9 o. V m
tooltip="Say hello world"
* _( t0 D! H; Y, ?; S, I3 [" ~ id="com.plmhome.createFolder.toolbars.sampleCommand">0 f" A! v! S1 g/ h3 }
</command>
: Q0 T% {' I( M" N7 e7 ?/ g </menuContribution>
( F" {: A, ^4 I8 D7 s- x
?1 Y4 V' L- D0 y/ q2 ](6)加工具条按钮
# i/ D4 @, }; w: J J1 K <menuContribution4 }; j- S5 @3 q7 m9 J" H V' \
locationURI="toolbar:navigator_Toolbar?after=additions">
0 h! o2 Y Y1 E- A <toolbar
% c) s. `% B. l W8 `* Q1 p! j: r id="com.plmhome.createFolder.toolbars.sampleToolbar">7 Z, ?5 t6 o: |/ Q, @0 [6 v( H
<command
0 a; I9 @) T& t9 O commandId="com.plmhome.createFolder.commands.sampleCommand"
8 ?0 I+ J; D0 `8 [5 J$ U* ~ icon="icons/sample.gif"9 b% F! ?6 p- n1 ~6 Z: h9 E
tooltip="Say hello world". C7 Q9 G' \! j+ Y6 o4 ^
id="com.plmhome.createFolder.toolbars.sampleCommand">
4 I4 p( |$ @* g+ Z2 M+ `9 u </command>
4 w e, {# g* @0 \& T </toolbar>% x5 k9 o$ b6 V# v. f# v* I
</menuContribution>0 h6 D/ P4 a. U. v1 B9 {& I9 Y
5 J. V6 n& ^1 S! T' I. @& S+ `/ n
完整的例子如下:
. N( i9 I4 ~; r- J" ` ~% N K
6 C) [& ~ k& a<?xml version="1.0" encoding="UTF-8"?>: ?5 V$ Q; f7 |6 k- L( A
<?eclipse version="3.4"?>
D* L1 ]; p1 w& f<plUGin>' e& @; \4 l# o. w& ^
7 d' J$ H+ I8 U; p <extension$ z C [+ A+ T7 {$ g7 F" [
point="org.eclipse.ui.commands">
8 w8 A" Y& \8 ~/ O) T# h: v/ t <category# g6 ?. {1 J# M* [/ K, x+ G
name="Sample Category", _) h6 i0 C0 Y& S, D6 c* }0 d
id="com.plmhome.createFolder.commands.category">% y# a; W6 X# c' u! c6 j/ i, J: m& v8 e
</category>
" ?% b5 M. j. x4 I+ Y2 g
0 i( [% {* X9 m <command
9 f8 m/ H7 \' ]& O name="PLMHome CreateFolder"
6 C. w0 [4 z- f( [6 \3 c" T categoryId="com.plmhome.createFolder.commands.category"
6 B1 @4 U) j% p3 _7 Y4 I& O id="com.plmhome.createFolder.commands.sampleCommand">$ l3 n( G# r+ ?7 J
</command>" X' L( o1 e# ^0 o3 V1 t' p
% k4 V* j- M2 j2 M) T& Z
</extension>
; y! Y2 j4 F- y" y' Q! `& ^( r <extension
, q+ \: f3 a& H5 V5 V point="org.eclipse.ui.handlers">
0 g# s1 }( }$ |$ L, t <handler
) J+ ~& O$ C( A% E E6 c/ t' V$ z commandId="com.plmhome.createFolder.commands.sampleCommand"* C* w% }6 O' H6 ^1 e& X$ j* a
class="com.plmhome.createfolder.handlers.SampleHandler">9 e m4 o) r2 C6 F1 x% N
</handler>& F. U9 s9 z2 u
</extension>6 e1 h( s% A7 ^& X! y& ?, m& ^
<extension2 H6 T$ q0 U6 E& [* W& |
point="org.eclipse.ui.bindings">
2 l* C5 B% X; \ v <key
Z. X! |3 V4 T# G5 r commandId="com.plmhome.createFolder.commands.sampleCommand"
+ |. |# l% s& W+ s! O. c, N2 V/ n contextId="org.eclipse.ui.contexts.window"% k/ d2 a" P( s
sequence="M1+6"
* s7 y$ R" g0 _& O schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"># e* b. l) K- w" |) M" H# `
</key>/ O2 T' [7 ^# {0 X
</extension>2 k; g/ Z0 `( u& v
<extension
; a: e2 C' S! t! Y ^8 g B9 U* t% N point="org.eclipse.ui.menus">- i* t6 l( Z6 A- }' w" u& O! i
+ e, c( }% w0 ^7 b% f0 q
<menuContribution1 {& R- `1 }' }9 L% n
locationURI="menu:org.eclipse.ui.main.menu?after=additions">
) U0 j& A/ p, \3 z! r8 |- h0 Q& m <menu id="com.plmhome.plmhomeTool" label="PLMHome ToolKits">
2 S# J g1 g$ F <command* [! b* ?: @5 U2 y4 B, e. Y6 \9 z
commandId="com.plmhome.createFolder.commands.sampleCommand"5 B M0 ?& ~. V6 G4 u
mnemonic="S"0 s) K2 n* B9 {! @) a" `! J! Y* e
id="com.plmhome.createFolder.menus.sampleCommand">9 R* C5 ^& j, m6 W
</command>
6 f7 N& p) m* u p/ S/ Z </menu>; F) |) W9 `9 l: u9 R0 N
</menuContribution>5 `( c3 `4 P$ T2 l# G
+ H% l8 c- i0 R* x- K
) y% @9 O6 X2 ?- O$ z v, p d; G( a m: N1 `
<menuContribution
# A8 D% H ~: `1 l8 t9 G locationURI="menu:tools?after=additions">
, q4 X) p+ U8 x J <command% H1 w+ k/ E6 t; Z* Z
commandId="com.plmhome.createFolder.commands.sampleCommand"
# z; I4 F, f0 m; s s& h0 v( W/ Q: L5 a mnemonic="S"
' i; y' z! O7 l; n! \ id="com.plmhome.createFolder.menus.sampleCommand">
/ W+ ?" Y( ]* c </command> ^5 X/ r$ j& B$ p" m* o! s
</menuContribution>
9 H6 I0 _# o* n9 B9 }# O' b2 F8 z: n4 c; O' D. U( \ j
5 v% y! m* H H, w6 W8 l- y
% Y$ e* u$ T; _9 r7 [* t <menuContribution/ {! G5 t% a+ F- z% _
locationURI="popup:org.eclipse.ui.popup.any?after=additions">
+ ~) r! `) K' ~+ P$ E+ Z$ c0 ^ <command: c+ i c% Y/ ], Q J2 c( i
commandId="com.plmhome.createFolder.commands.sampleCommand"5 B" l- m" I4 u. P+ a! |
mnemonic="S"; H j4 u( S( ]; ~9 `* ?3 U6 Z
id="com.plmhome.createFolder.menus.sampleCommand">5 G1 {0 i) T/ m. ?
</command>. L) M K1 k3 f9 V. n
</menuContribution>
6 q, |- R6 d, M* \3 Z7 p" e" }* I' V/ I6 @4 m2 U) I
<menuContribution" {! Q* ]% ]8 C; e
locationURI="menu:com.teamcenter.rac.ui.views.DetailsView?after=group4">
) O' l" ]9 y% C0 b5 d0 F- Y- e <menu+ Z; H6 }0 e; K: {- @
label="PLMHomeToolKits"; E# `0 A; u/ k" g' ]; D
mnemonic="M"1 Z1 N% s- W! h1 L; ^; ^6 n/ B6 G
id="com.plmhome.createFolder.menus.sampleMenu">+ H) k2 s% t1 I) z7 b
<command/ n- q* t- k& F2 J
commandId="com.plmhome.createFolder.commands.sampleCommand"8 z! g, b' T, ~" K7 C D
mnemonic="S"8 ?: r s! y, m- F) F8 Y
id="com.plmhome.createFolder.menus.sampleCommand">! y6 T* Y" f4 @
</command>8 w( w$ B1 I! I# D
</menu>
. g( R7 p2 {8 T4 I' } </menuContribution>6 x" H8 K" _$ C5 R
8 V" |( o+ J8 j
<menuContribution
( A' a+ [, o1 L+ K5 j locationURI="toolbar:com.teamcenter.rac.ui.views.DetailsView">+ g! w m+ x$ H: w
<command( J$ z0 Z! U6 p2 `# L" }
commandId="com.plmhome.createFolder.commands.sampleCommand"
- o% w. J4 C' k1 c icon="icons/sample.gif"
0 T3 @( j2 b1 x* V tooltip="Say hello world"
7 y; S9 u; X4 N7 J id="com.plmhome.createFolder.menus.sampleCommand">
" W" A* }* ?- e* e) i: z* ^ </command>
! |5 R6 g- U* l3 K9 z! n" j! ]5 V </menuContribution>
* c, K( X, _4 _6 N: t' X! {. a
1 a6 z8 Q3 C4 T8 z/ ], Y- o0 ~3 H: v S! z$ m, |4 Q
<menuContribution
6 u7 v6 F5 _4 p) s! d* W locationURI="toolbar:navigator_Toolbar?after=additions">% t9 ^& g- ~/ h% L- }
<toolbar! S' x) @, x, X+ [: h+ Q' K- x- I
id="com.plmhome.createFolder.toolbars.sampleToolbar">
3 ]4 m! q0 r9 S! f `: ? <command6 z" e: o0 Q) t" p4 U4 I
commandId="com.plmhome.createFolder.commands.sampleCommand"1 Q* ^( ^0 S+ x9 [; }, p8 t
icon="icons/sample.gif"
. U K% J4 e3 o6 y2 | tooltip="Say hello world"
% Z) ^5 {8 X, j8 p$ g3 @ id="com.plmhome.createFolder.toolbars.sampleCommand">" ^. g6 b0 n2 n! c( d& e; z
</command>+ F! [6 R4 \+ F/ f0 U
</toolbar>
6 ]" g9 t: Q9 Y5 K' A1 r* b </menuContribution>0 Z% H+ }/ s7 C; ?5 b2 Y& V) k
! F6 k; ~- D, Z& I1 o% r3 q; Z; j; p* h: h8 v W" K
</extension>
2 C# P. P/ ]3 O( L1 X- b! ^( R0 @% m* ]% f: ^
</plugin>- p$ m. ` T, i8 I
8 j5 W* d' U Z3 v' F
6 e7 i! ~5 |8 B5 i9 Q
6 w+ A( q6 S( X% x+ Y( L1 z |
|