|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
【Teamcenter胖客户端开发】teamcenter菜单添加图文教程<1>- T* I8 H x6 W1 S6 `
这部分内容实际上是eclipse的插件开发的功能, 这里做个简单分类,菜单文件的扩展点都是 <extensionpoint="org.eclipse.ui.menus">,添加菜单就是在这里面添加内容。这里只要注意location即可!
" z' U) D- I% K& @ |3 Y(1)在主工具条上添加菜单。
' \. C- u- v' n4 V2 f! n5 h5 o8 a% o! o <menuContribution
/ Z: E! ^* g2 G: w0 n: `* V locationURI="menu:org.eclipse.ui.main.menu?after=additions">, }. K# M& ] b
<menu id="com.plmhome.plmhomeTool" label="PLMHome ToolKits">) e' a1 Y$ M6 m- _' ?
<command0 c) b1 `+ v* \6 j4 _$ o
commandId="com.plmhome.createFolder.commands.sampleCommand"6 m8 t0 ?( {3 C- c( Q
mnemonic="S"
6 ^( c4 h) X# Z; L( J8 M id="com.plmhome.createFolder.menus.sampleCommand">4 j* n. D" l6 {5 q
</command>
/ {+ [* f+ H0 r; `- z4 T$ W2 g& V# E9 u </menu>
: R* a1 ^; n. w </menuContribution>& f' J, y4 d9 r* q# {. f4 [: T
, f ~ | {' D( g: u t6 F(2)在工具功能的后面添加按钮。& p" O- A. `9 [& K: n
<menuContribution: V. Y2 z2 l4 J* r6 `
locationURI="menu:tools?after=additions"># r: f3 w; {4 X! k& `) _
<command4 t- u7 x W! e9 W
commandId="com.plmhome.createFolder.commands.sampleCommand"
& d: C/ O" C" O, c; ` mnemonic="S"
9 x$ {$ Y0 d; H2 @ id="com.plmhome.createFolder.menus.sampleCommand">5 ^% M$ o$ B0 {" }
</command>* K' u- S* m: S
</menuContribution>2 w' g& V7 v! G. r. R
5 u- B) `8 R9 M8 B9 k
(3)在右键弹出菜单加按钮$ j* F6 [4 r; v2 h5 c i1 M
<menuContribution* `! S7 n4 F) S m
locationURI="popup:org.eclipse.ui.popup.any?after=additions">1 j. Q4 s: b6 P0 W B, o$ |
<command6 @# G6 Z; F) O% B, D9 P
commandId="com.plmhome.createFolder.commands.sampleCommand"3 Z/ W1 k. d! M7 X" i% V
mnemonic="S"0 H2 [1 P: E \* X- A% p
id="com.plmhome.createFolder.menus.sampleCommand">9 N' D* B9 j6 {5 _& o
</command>
' ~, B/ m3 e5 c </menuContribution>/ M# a5 L2 N# P8 u3 R4 Q4 N$ u+ Z
(4)在具体的菜单后面加功能按钮9 ^. `9 z$ {( E) M- c
<menuContribution
& k6 ?6 R, p' x G' s locationURI="menu:com.teamcenter.rac.ui.views.DetailsView?after=group4">
( e; g- c- |/ w: u4 F <menu7 V6 t0 j! h% b6 o' e: V# F
label="PLMHomeToolKits"! d( ~5 u% K$ v4 I9 K6 ^4 r5 X
mnemonic="M"
/ k: K1 p3 |2 c0 _ id="com.plmhome.createFolder.menus.sampleMenu"> E* x1 C1 q# _* C" }9 w& O" V
<command/ P! ]* @. v9 k) f( x' |
commandId="com.plmhome.createFolder.commands.sampleCommand"
% \6 \8 U2 q8 s4 W/ y0 A# {! h7 | mnemonic="S"# }/ V& d: T: F6 c6 I) Z) f
id="com.plmhome.createFolder.menus.sampleCommand">
4 L$ P @2 j3 u7 h' z" B" {1 E </command> F% H; B; j8 [
</menu>0 k5 t1 [) H* s: G
</menuContribution>
: y1 {7 r0 K) b; i( K, B* D( }& ^+ K( g: g" \. i8 O
(5)指定位置,直接加按钮
+ b) C; O8 m. J8 K7 b <menuContribution
( t3 H* l! {5 \& s9 z3 S, T locationURI="toolbar:com.teamcenter.rac.ui.views.DetailsView">1 T9 x1 ?4 X6 s) Y2 g
<command l1 g& p( E( _# V
commandId="com.plmhome.createFolder.commands.sampleCommand"
' t! ]- w+ a% D$ V" x icon="icons/sample.gif"
$ v' ]" ~5 ~& Q% U" @ tooltip="Say hello world"# p6 i y* {$ K- t( o9 v& K I9 w4 }
id="com.plmhome.createFolder.toolbars.sampleCommand">
& u3 J# s# d. a0 m5 B$ e </command>3 U. F) Z0 @- J/ d- ^$ G
</menuContribution>
& X; B" ~8 \* _! G$ g
d7 O7 n' Y: }$ w, M(6)加工具条按钮
% r3 Y4 R, z6 s <menuContribution1 b3 }$ o J6 k v
locationURI="toolbar:navigator_Toolbar?after=additions">
" e$ S; [* N% o& z- l7 b <toolbar
: o, H. Q7 w' I% h+ b2 m3 X: n id="com.plmhome.createFolder.toolbars.sampleToolbar">
) H: u" t* y5 x9 }: B* v <command, _1 O! i( X8 i- N
commandId="com.plmhome.createFolder.commands.sampleCommand"
( @ }; p, d$ l( Y5 f2 q; N: f icon="icons/sample.gif"
4 `$ k5 U6 ^* x6 J( F3 |: g tooltip="Say hello world"0 L3 `: B; y/ q% U# k
id="com.plmhome.createFolder.toolbars.sampleCommand">3 Z i2 ]1 U/ f0 b6 m& _3 e
</command>. |0 f# V4 m( B8 z) ^
</toolbar>+ L$ B) t, j9 _
</menuContribution>0 L( ?& a; y& h4 B, ^7 O, A3 f' x: y
1 N# G& ~! |8 X$ |5 E. }/ K+ _' j
1 ~ T1 g# `4 F
完整的例子如下:
, `# v) K, f3 z/ j9 M
- b4 `8 c j* _6 V3 R2 P<?xml version="1.0" encoding="UTF-8"?>3 v) K N! W- N' r, v( m
<?eclipse version="3.4"?>
" r* g4 Q; D/ v8 W( m. Q$ N<plUGin>
# I& E1 S: W# B8 O3 f# ^5 Y! \, f
9 B% Q6 g8 S/ @) b& n% S <extension
, c0 \3 j, W& j7 i F4 i6 [" S point="org.eclipse.ui.commands">
- O0 n* y& O. P: `8 B0 ]6 h% |: d <category0 P4 P. m- b x! g
name="Sample Category"
; A$ l E$ Y/ f' I2 ^7 a id="com.plmhome.createFolder.commands.category">
, {5 u2 H+ n3 U. |4 b8 O* `- O </category># q4 T) t: m& l6 Z7 M
6 j( g+ c W* i3 h9 d7 Y% `% w
<command) G* K( B$ b' ~6 y
name="PLMHome CreateFolder"- f6 D( |2 I6 g: M8 s1 \$ I
categoryId="com.plmhome.createFolder.commands.category") w5 J- `+ n1 B
id="com.plmhome.createFolder.commands.sampleCommand">9 l! B3 `$ L( P7 l6 [2 i% m( p/ v! j
</command>
% `' ?7 h9 P \( R; M' X5 f% F; [7 m0 g' M+ d2 h8 ]
</extension>* y* `4 K2 J" C1 s4 @, l5 T% v; L8 W0 f
<extension- i! E, p5 A3 |7 }7 Z; w C2 L: U5 M5 k
point="org.eclipse.ui.handlers">9 N8 s1 O1 m; V& G! f+ x' M. C7 u: ?
<handler
4 |4 ~2 w( k! ^8 \ commandId="com.plmhome.createFolder.commands.sampleCommand"* z6 |- S1 J0 U' z5 s
class="com.plmhome.createfolder.handlers.SampleHandler">; o4 ^/ e. v% C9 X
</handler>
8 w1 V8 {* n! u' E7 Y% M8 h6 T1 B </extension>" p9 t) j/ p0 @8 l' ?% L) `0 j
<extension& M0 P( I, q4 A$ r9 Y
point="org.eclipse.ui.bindings">
5 n' s7 k7 \" C! z/ ~4 Q <key
9 s( ^/ D0 q3 O& L" W5 S2 }5 u commandId="com.plmhome.createFolder.commands.sampleCommand"
3 r, p) l4 m8 \2 L+ W contextId="org.eclipse.ui.contexts.window"; |' t" M* Z' r: {7 C% v
sequence="M1+6"
% B/ z5 w1 f4 E7 x3 y" T. e1 d/ s schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">3 k" K7 P: h: T5 F0 h
</key>
6 n" ?3 G) h$ Z </extension>
9 b4 H0 m! Y& f' Z% q6 ? <extension
" a5 M7 r& B6 K+ B; Q/ @0 r* Z point="org.eclipse.ui.menus">
; F! Z+ g* x7 _! u: Q0 F% Z3 v; |0 }2 u2 t
<menuContribution8 i- k4 R2 e+ P
locationURI="menu:org.eclipse.ui.main.menu?after=additions">6 W `% y: X2 C" B/ d' J. p
<menu id="com.plmhome.plmhomeTool" label="PLMHome ToolKits">
# x3 {+ A( C7 Q) s <command
. e$ A% `! B( [' L commandId="com.plmhome.createFolder.commands.sampleCommand"# y H# p" c0 w
mnemonic="S"* y& o$ J# ]8 g B! Q! v
id="com.plmhome.createFolder.menus.sampleCommand">
* k: ~5 d9 N5 D5 D </command>
: W& x! Q4 T F </menu>. C# z/ m$ {6 r9 T
</menuContribution>$ o" ^0 z+ a- ^
1 M2 C, S: i0 i* l
3 g+ @6 w$ ]* t. w8 t( {1 I c; L& M* h4 N" r/ w* Q+ q- r
<menuContribution
6 H2 R j- D* c4 W* X4 [) _0 B: L locationURI="menu:tools?after=additions">
4 _8 @( T0 A% O6 [5 {4 ?# C <command( s9 X- m4 z% B* K" M
commandId="com.plmhome.createFolder.commands.sampleCommand"
7 I/ {* ?3 Q1 n5 U mnemonic="S"
) W1 b# v8 p1 |. G* B$ I id="com.plmhome.createFolder.menus.sampleCommand">
: [# q* P9 s! I1 `1 s </command>
: q% @7 I' @" Q) n4 t </menuContribution>+ n" t/ r6 |4 ^- J3 @0 Y
: ^6 R. J* N$ E8 m$ u. ~! q1 i& F/ S" ^0 e
1 }. T) S' y5 P" J/ G- B* P <menuContribution
3 a; `1 C {4 D locationURI="popup:org.eclipse.ui.popup.any?after=additions">
) }' E4 o- }$ j$ u0 p( ~1 Z <command% J K9 U& P- z
commandId="com.plmhome.createFolder.commands.sampleCommand"
' {9 C8 R9 W3 t8 B3 R! ]: c; [ mnemonic="S"' w0 m1 z+ P$ C% i U( a! V* M
id="com.plmhome.createFolder.menus.sampleCommand">6 w. N. P; P7 x9 \) f
</command>
0 A ?: L( b& |. x5 ?! K </menuContribution>. } d8 A, b5 L+ m+ P
" u% a5 A5 _, h; Q. x4 R <menuContribution+ ]& Q' A; V! m- o5 w) _/ [
locationURI="menu:com.teamcenter.rac.ui.views.DetailsView?after=group4">
9 i3 }4 e# J3 y7 V <menu T. [% t. E: a/ J. w& D2 K
label="PLMHomeToolKits"# C3 K. q$ I" K1 U+ E7 z; [$ y0 P- _1 s
mnemonic="M"2 a. D3 f1 h% d/ g3 Y
id="com.plmhome.createFolder.menus.sampleMenu">
) z9 I3 |; o5 X' K& X2 f' Q! z <command5 H" q$ Q' v: K# F9 |8 n
commandId="com.plmhome.createFolder.commands.sampleCommand"
4 _# s U5 O/ l- F; c/ R mnemonic="S"' }$ R( c% H- k: {
id="com.plmhome.createFolder.menus.sampleCommand">& ]) B% X- r& E g# k$ e
</command>% Z# u- }1 v6 B* S
</menu>& v& ^2 j& m6 {: y/ { t1 y0 W' v
</menuContribution>
: a$ H) i7 P3 v: f2 ?0 t8 D! T3 s [! c2 F0 {
<menuContribution
9 T _! D9 I2 g) h2 M locationURI="toolbar:com.teamcenter.rac.ui.views.DetailsView">1 r7 P" n, ]' E- Y
<command
# c* Q* b# U* T/ ?1 n" U( K$ `2 u commandId="com.plmhome.createFolder.commands.sampleCommand"1 q7 j' Z: F) b. ]+ I2 i3 Y* k
icon="icons/sample.gif"! }& X5 w: M0 G% e
tooltip="Say hello world"
* T* {8 }, q7 H' F6 a* K% k4 u6 @ id="com.plmhome.createFolder.menus.sampleCommand">
, z$ L. @) G' X. R+ a7 }8 x/ i7 f </command>3 D* r/ ?$ i+ G: K' B: Z7 W; p
</menuContribution>
7 @& ?& v0 `5 u8 F
9 b$ `% ~- ^) T8 U3 }# }$ M
- {: J- ]# }& ?" s <menuContribution
( `5 b; `- N9 N; Y locationURI="toolbar:navigator_Toolbar?after=additions">
7 s& o0 y8 M2 M& @- X <toolbar3 c* t' \- t E/ a0 g- ~9 U
id="com.plmhome.createFolder.toolbars.sampleToolbar">
* E; @( E% v/ R/ }, }5 n& c <command
/ r' a2 m9 u) ]& O commandId="com.plmhome.createFolder.commands.sampleCommand"
. x$ o3 O2 h4 l icon="icons/sample.gif"6 U/ U# T6 h8 P
tooltip="Say hello world"4 @; M1 w0 F* j& F4 J
id="com.plmhome.createFolder.toolbars.sampleCommand">
; u0 z) F( g0 C' ~& s$ u& L </command>
; @0 g4 y9 P9 W' ?* C" ^; v! p& t </toolbar>" _1 o0 p6 U: w. { h4 ~
</menuContribution>" j& q5 d2 R* i4 g1 |% d
( E& p! F6 ?3 L. S% H* ^/ w
3 D- s! g0 f- m0 z0 o. C </extension>8 B5 z7 p$ P4 T/ m7 T/ u1 E
; L6 Y! P2 y0 G, j# G8 Z! u( k
</plugin>
( Z5 E! ~" S. ~4 X6 O+ ^ q" F2 [2 g1 ^6 A7 k% ` ~; ?+ h
! D8 N7 X0 i: G+ ?3 R7 U
& A+ j1 F1 V0 |; f) t
|
|