|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
【Teamcenter胖客户端开发】teamcenter菜单添加图文教程<1>
: L n! E' y: i! b7 G这部分内容实际上是eclipse的插件开发的功能, 这里做个简单分类,菜单文件的扩展点都是 <extensionpoint="org.eclipse.ui.menus">,添加菜单就是在这里面添加内容。这里只要注意location即可!# l* u4 O8 s! M; F- j6 t# Q
(1)在主工具条上添加菜单。( A- ^, P- X$ Z9 `7 q+ j
<menuContribution* w1 S1 Q- x3 v# `
locationURI="menu:org.eclipse.ui.main.menu?after=additions">4 ~ I" Y8 N6 k% p/ F( x
<menu id="com.plmhome.plmhomeTool" label="PLMHome ToolKits"> [0 O- J+ g3 I* m8 |. _; ?9 j4 G: y
<command
. g1 Q# t: i; V0 x; w commandId="com.plmhome.createFolder.commands.sampleCommand" W3 r. L, k. U/ M- [/ r9 f
mnemonic="S"
8 V2 j- n9 y1 E id="com.plmhome.createFolder.menus.sampleCommand">
% e8 L( D( x: z' d/ k </command>
. Y/ F$ H9 x2 M4 K </menu>: t/ \5 _( {8 r; U" _4 z' j! d2 \
</menuContribution>. O1 E* B2 D& B/ d
) s- j% q" R! p$ y% r/ I(2)在工具功能的后面添加按钮。# H! M0 t8 }7 L6 A, \
<menuContribution0 o' |6 o# v5 @9 P0 p2 w- S
locationURI="menu:tools?after=additions"># @ C' c6 b$ e: G ^- ]
<command) D4 E8 J/ @* m) l
commandId="com.plmhome.createFolder.commands.sampleCommand"
' m3 B9 A& ^7 R& w: k mnemonic="S"
; |" w2 h" X4 y! s id="com.plmhome.createFolder.menus.sampleCommand">
7 R5 Q8 p* K! D; ^6 ?9 M </command>% i" h: `) d5 n7 V6 g, B
</menuContribution>4 B( T w5 G. c9 H3 Z+ @
3 I" V3 V7 U9 J9 @0 J% y, T(3)在右键弹出菜单加按钮) U, E+ \, \+ [$ j
<menuContribution9 D$ c0 [$ [8 u
locationURI="popup:org.eclipse.ui.popup.any?after=additions">
! D" Y1 E* Q3 l @* d <command
& A7 N% P" v" r; U3 q commandId="com.plmhome.createFolder.commands.sampleCommand"# g1 E# U t4 t+ \. F
mnemonic="S"
8 A! E u: L7 M/ @: M3 d6 d$ J id="com.plmhome.createFolder.menus.sampleCommand">/ O. M) s; b. Q2 D: P
</command>
* x$ k. L9 }5 z ~: z </menuContribution>
+ h4 T' r7 A u1 U$ I(4)在具体的菜单后面加功能按钮
* S( z, p1 q) q9 B) j/ o <menuContribution
+ h$ ^+ O2 i' s6 B# L locationURI="menu:com.teamcenter.rac.ui.views.DetailsView?after=group4">
1 {( L1 ~' G; h0 I <menu, f' z" T, v; s9 O
label="PLMHomeToolKits"
6 w( n! g0 I2 _/ d! C4 ~ mnemonic="M"7 Y5 i: b9 E5 ]* M( e! d
id="com.plmhome.createFolder.menus.sampleMenu">8 v8 b, f8 Y, f$ J/ x1 X
<command
% o! \1 A$ V( ?/ w* g, _( u6 Q, h commandId="com.plmhome.createFolder.commands.sampleCommand"+ m1 X' ^5 P ]! V& B
mnemonic="S" I) `8 u* V# z C4 W
id="com.plmhome.createFolder.menus.sampleCommand">( H6 e6 p5 R- A7 R
</command>1 J0 R5 X u8 @8 b7 F8 H" h3 M; g
</menu>
- o Z+ \+ w% W2 o* Y q </menuContribution>: @% R5 E; L4 F1 d. F3 Q9 n
7 R8 l! W3 n2 z* A9 A9 ^! `. I(5)指定位置,直接加按钮
/ D5 c$ z" m2 L, V0 Y8 S <menuContribution! J; q& Z; w$ y% G5 @; d
locationURI="toolbar:com.teamcenter.rac.ui.views.DetailsView">
9 [, _3 B: ?3 m: s9 i, x <command9 `2 E5 R- E& I7 @
commandId="com.plmhome.createFolder.commands.sampleCommand"( |" ~: }: d; v
icon="icons/sample.gif"2 a2 @: Q# v* V- p' ^. _; T/ R
tooltip="Say hello world"
, S4 n; ^, a$ V id="com.plmhome.createFolder.toolbars.sampleCommand">
* D3 J! I! c( x, i J </command>, a: k3 J+ K) y. W
</menuContribution>( R0 B/ Z# W2 U0 `. o/ c2 t: o. b! `
& m8 L8 |3 B+ B; W. C" o
(6)加工具条按钮
8 Q" b( g% ?& n# G8 N0 L' J <menuContribution8 e: w, q& S, k/ k9 b5 ?7 d
locationURI="toolbar:navigator_Toolbar?after=additions">3 \: A# f; ~3 M/ c9 d7 ?, C& l
<toolbar
7 \2 w: d/ g! V+ f" }8 T id="com.plmhome.createFolder.toolbars.sampleToolbar">5 \& |- B$ P/ q: v+ r2 x8 W
<command- {3 t% t3 {; a
commandId="com.plmhome.createFolder.commands.sampleCommand"
7 D4 t' {/ \5 }/ [9 y U icon="icons/sample.gif"
8 g$ B. p5 Z: y# z1 [* R tooltip="Say hello world"" K; V& M) c2 V
id="com.plmhome.createFolder.toolbars.sampleCommand">9 A' t5 R9 q9 x
</command>
! t' U* T1 Z: x' y- X& T- e- t </toolbar>4 L8 k" m- S2 F; W/ \
</menuContribution>
/ z0 \8 n, T5 m. |2 \9 w9 n6 }9 L# M2 R& y/ Q; ~" ^) u4 ~
/ j1 w) K- z0 _8 o, x# h: G& s
完整的例子如下:
8 R; @8 C" z3 }. J* L/ F
" X1 V: r1 E7 T8 |. y; P0 L<?xml version="1.0" encoding="UTF-8"?>
: K. _" F$ N. t A8 @<?eclipse version="3.4"?>" j8 v) B& p" O( c5 ]. w! U* a
<plUGin>& ^% P$ B+ \& Q" i% C( i
: U/ |! X% o9 {' s+ z1 C/ N <extension
, Z* a" H( |; ]* { point="org.eclipse.ui.commands">
, a/ ]) k7 R7 {+ R0 N8 E3 e <category
9 i6 |/ v4 X+ I. r" `/ x name="Sample Category"
5 e' p+ t: z7 r' ?& w id="com.plmhome.createFolder.commands.category">' ^' B+ g$ U6 F0 N' S' s0 u
</category>5 J3 C( n( t2 o. H' {
1 `! o4 Q n0 f5 n <command# h4 T: }& {0 Y1 D
name="PLMHome CreateFolder"$ g; J0 _5 [2 v0 M+ U% Z7 u, F
categoryId="com.plmhome.createFolder.commands.category" L* n8 P1 `5 X0 l2 z; y- R
id="com.plmhome.createFolder.commands.sampleCommand">
) ]7 G7 K5 j- i7 A, ]9 q' } </command>
5 ]4 O! |% I T% w, p; J% D9 J# o4 y: d0 F r; ^' {9 M% w
</extension>
t1 o" v3 x. G$ ~3 Q <extension
0 N, g: V* t8 c& r: Y! i+ | point="org.eclipse.ui.handlers">
; _+ R5 Q1 K( d$ O+ W! ] <handler$ C- W* V5 I! s8 H
commandId="com.plmhome.createFolder.commands.sampleCommand"
8 w& \' v5 I% @! K: L2 ? u class="com.plmhome.createfolder.handlers.SampleHandler">
$ Q1 R% [9 f/ e: V4 [% O5 x7 g6 k </handler>
, T: G0 [9 {/ q0 `8 Q </extension># [* w% d* W/ F2 x! }0 H) m/ Q
<extension
0 z. A+ n X, d* q- B9 V point="org.eclipse.ui.bindings"> ?( Y/ ^) `$ i7 `& h
<key- {% a- c- ?4 h- z1 e N
commandId="com.plmhome.createFolder.commands.sampleCommand"
3 W1 n$ {0 S* V' V contextId="org.eclipse.ui.contexts.window") I9 C: \& N2 i: _% a
sequence="M1+6"( e2 I' j9 n9 |4 P
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">" s* m) N2 F& x( V8 Q
</key>
. R! t- L/ s/ o8 B </extension>! ~" V/ Y( ?5 R
<extension0 [& F( J# T# H* U- }
point="org.eclipse.ui.menus">8 s6 C+ F' X/ u' X
y% l. w) c+ a( Q3 d4 B! `; K <menuContribution
" U) s% M+ i6 b2 y! f5 R( u+ } locationURI="menu:org.eclipse.ui.main.menu?after=additions">. m {0 i& S( `) U6 V
<menu id="com.plmhome.plmhomeTool" label="PLMHome ToolKits">9 g% V' N( d+ r4 u! A: y
<command
1 s) e* V1 ?5 r% C commandId="com.plmhome.createFolder.commands.sampleCommand". ^8 k6 |7 X8 l: ]! ~* ?/ R
mnemonic="S"' V0 T H6 t% j T5 U. U1 H
id="com.plmhome.createFolder.menus.sampleCommand">
" o( S* K+ a! b& T- V </command>% t4 `# l/ o# m& r' M5 ?1 ^( Y
</menu>, E5 a' n+ L! p
</menuContribution>, ?5 D3 C0 R/ }' V. U
6 G3 g V2 _& c% e
5 C2 _- f$ h8 F7 ?8 I# t
& G- b+ J0 f! U- a4 u <menuContribution% x$ s+ B" I- h( F. s- u6 v
locationURI="menu:tools?after=additions">! I7 l5 d* G" a. d7 ^) v% G' b' Z
<command
$ n- | p& a' o! D% p# t commandId="com.plmhome.createFolder.commands.sampleCommand"
9 x2 J5 R; U7 j% x2 g mnemonic="S"
$ x: ]3 ]5 W: e* ~ id="com.plmhome.createFolder.menus.sampleCommand">- L$ ]# B; Q6 D x: S9 x/ @
</command>
- q" B9 d: u+ N) Z1 F! O </menuContribution>0 ?7 M$ N) H4 G9 s( D
! X3 D" W: p+ a, N2 Z4 J
. i8 t7 G+ _+ _( Y, ^, Q' ]! f9 B5 ~4 J
<menuContribution$ x1 l( o& {% {2 [: W) o1 _
locationURI="popup:org.eclipse.ui.popup.any?after=additions">: d, J# F( Y' w* V$ }' n0 `
<command$ j: c) t' \4 ?' m* E N
commandId="com.plmhome.createFolder.commands.sampleCommand"
, x$ i, ^: }) u# n3 m mnemonic="S"
) w1 p' Y# [2 C: g id="com.plmhome.createFolder.menus.sampleCommand">5 t0 C3 v# I# Y; O
</command>
4 F( ^5 W" C/ _0 H0 x </menuContribution>& j9 z( j( D. g
4 f$ ]4 J) T" X$ \# f <menuContribution3 s$ u/ ]. q0 j1 e
locationURI="menu:com.teamcenter.rac.ui.views.DetailsView?after=group4">0 K | _/ A& c! d
<menu7 J: h! p( [' G' z
label="PLMHomeToolKits"
7 R& u6 [4 U" N mnemonic="M" Y: }7 M8 g, D8 U. ]5 g1 D
id="com.plmhome.createFolder.menus.sampleMenu">
- s# W& W7 V0 {/ Z <command
) T) ~2 m+ Q) T commandId="com.plmhome.createFolder.commands.sampleCommand"
+ e8 d0 j9 G, C mnemonic="S"! u* o3 z4 L" [: I
id="com.plmhome.createFolder.menus.sampleCommand">
- [( ?- S0 o9 ^9 g+ q </command>
& _7 E) M( Q5 W) D8 R </menu>" W2 ~' p' R C4 i
</menuContribution>
0 Y% ~$ S. f) t5 f. @& b$ `6 g! _ I4 U+ T1 H% U# r
<menuContribution, v* R! o4 o% j
locationURI="toolbar:com.teamcenter.rac.ui.views.DetailsView">
0 g8 n& u- |) q. K) b5 r <command; v" \2 }- y- V; G3 I F% x) |
commandId="com.plmhome.createFolder.commands.sampleCommand"
# F# n+ b" {/ @: U: A icon="icons/sample.gif"
' A$ K1 N* ~" q N9 T tooltip="Say hello world"
7 B" E% Q0 A7 v' a# L: b" \ id="com.plmhome.createFolder.menus.sampleCommand">* m4 z' e2 L' X& c$ h( v6 T7 O
</command>: W$ `% P; v$ h
</menuContribution>: ?, U. s: i. g) x% ^
/ G- `5 t9 Y# l4 ?9 B
$ D6 x/ J: |. h$ T' N9 V6 X <menuContribution H& {$ B/ B" J$ t, e
locationURI="toolbar:navigator_Toolbar?after=additions">( {; u4 b" i0 b# {. [. T# C
<toolbar1 m. m. |$ c& C0 ^
id="com.plmhome.createFolder.toolbars.sampleToolbar">; I/ S7 P+ F/ O! D
<command5 ]3 p. Z- F( N/ o
commandId="com.plmhome.createFolder.commands.sampleCommand"7 d$ x/ z1 A' j. w/ F+ b
icon="icons/sample.gif"
6 O2 G9 m2 J9 P) _4 I tooltip="Say hello world"/ Z1 p7 v" k6 n; ^1 O
id="com.plmhome.createFolder.toolbars.sampleCommand">
0 }. H; {5 A) ]+ w5 D! ? </command>
* V5 E# s9 Z/ _( n7 V+ i4 X, T4 U </toolbar>6 S$ q6 `, _, j# f& n) q
</menuContribution>& ]# m0 v) v, E8 h
4 p: l) E3 y2 \/ m1 i$ }8 R
+ E2 J2 \1 x5 f. U </extension># h. ?% c- ]$ V( j) W: X& a
. s# N6 F% j4 Q
</plugin>' t$ M( s6 S# c9 r5 {: T
, R: Y& |6 Q9 b- X- t& W0 a# h/ a. `' X% c& x9 a3 [2 d
9 z2 ~; I/ c3 |( U
|
|