|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
【Teamcenter胖客户端开发】teamcenter菜单添加图文教程<1>) L p, ]2 `7 a. o
这部分内容实际上是eclipse的插件开发的功能, 这里做个简单分类,菜单文件的扩展点都是 <extensionpoint="org.eclipse.ui.menus">,添加菜单就是在这里面添加内容。这里只要注意location即可!
: ^/ u: t1 d( e3 @(1)在主工具条上添加菜单。
. E1 E& [* h/ k9 K9 o <menuContribution d+ w6 i! G- K! M# h4 W% U
locationURI="menu:org.eclipse.ui.main.menu?after=additions">$ }: W1 }8 K& Z* |2 k& c
<menu id="com.plmhome.plmhomeTool" label="PLMHome ToolKits"># @# I& @+ e# G) h# C/ d
<command* G! y& L% P1 |8 I: i
commandId="com.plmhome.createFolder.commands.sampleCommand"
8 F' C8 T" B$ y1 w6 e* g, b mnemonic="S"
# L# S! g( v2 o id="com.plmhome.createFolder.menus.sampleCommand">2 d( R! ?1 O4 |
</command> Y- j" ^- ~$ Y9 |; B1 a
</menu>/ Z. d! t) Z4 _, T, B7 U# X- t3 v- ~
</menuContribution>$ b, X# F. r$ J( e* `- @; F( t
2 \; d) y& L8 l% ](2)在工具功能的后面添加按钮。
$ @6 V, [3 M$ U. S) @' M <menuContribution
- Q8 m# x7 Z \ locationURI="menu:tools?after=additions">6 E# A5 C+ h# \6 X
<command
) K5 g& t9 K9 {; O- G% S commandId="com.plmhome.createFolder.commands.sampleCommand"" e7 v. L7 ~8 Z+ d# f
mnemonic="S"$ R* P$ J: @$ z( w8 C
id="com.plmhome.createFolder.menus.sampleCommand">* c9 Q( Q6 }8 \9 D0 Y7 ?! {# c3 C
</command>2 `, A# {4 G! `! X0 K- m- G4 ]
</menuContribution>
6 z7 Y+ M9 w5 T! f `4 C, @
' [! Z" v5 p5 @0 L. _' t(3)在右键弹出菜单加按钮' C/ n/ n: }0 q2 o% T
<menuContribution: i; ^( L- S0 k5 V3 p3 l( X1 g% M
locationURI="popup:org.eclipse.ui.popup.any?after=additions">
3 L9 |. D1 ?2 @& a J <command$ c; ^) U- o4 b; l$ c; U
commandId="com.plmhome.createFolder.commands.sampleCommand": s# A( @. i% J! b" }
mnemonic="S". W& e) ]0 n7 P
id="com.plmhome.createFolder.menus.sampleCommand">
! R# d! D9 S# ?+ |* @6 L </command>/ r, p: A* O& H, |2 W) H: X: W# J
</menuContribution>
7 ]1 ]: v/ T+ @8 w/ e9 s3 m& r$ R(4)在具体的菜单后面加功能按钮
7 V# j# p/ ^) y4 ] <menuContribution
% t5 K; g6 X" A+ T9 U locationURI="menu:com.teamcenter.rac.ui.views.DetailsView?after=group4"> O$ d8 }& F- A' `- e7 p
<menu' v! E$ j Y6 B A
label="PLMHomeToolKits"7 }$ Y O- P* J: N8 n3 k$ L( U
mnemonic="M"
v4 T' r5 _) d/ b9 b( X id="com.plmhome.createFolder.menus.sampleMenu">0 M3 _+ d5 A# ] B3 D* }
<command
( h6 |. L7 W& R& R- T( f0 M4 M k2 Y commandId="com.plmhome.createFolder.commands.sampleCommand"
" o6 y- U7 w2 g! i% B( x mnemonic="S"
% u9 G: E6 m R4 O3 W/ y: V& R5 Q id="com.plmhome.createFolder.menus.sampleCommand">
" h6 i; f2 X0 p& K </command>, ?, B- g4 P( e5 [
</menu>3 C' F0 A0 f% K/ ~- e
</menuContribution>- E3 }( y V! w# z+ E( @7 C3 F
) y: D3 P6 Y6 D8 X
(5)指定位置,直接加按钮
& @9 o! o3 U) U' q' U' k# K <menuContribution
) p% ^8 Z* C( h) L' c8 v: | locationURI="toolbar:com.teamcenter.rac.ui.views.DetailsView">9 q1 n4 C4 K- ~ ]9 ~, _" q
<command
! i& q% m! Z1 N! z1 W7 j7 c+ J commandId="com.plmhome.createFolder.commands.sampleCommand"" X, O2 x. y6 q( V( M4 x* O- d
icon="icons/sample.gif"2 O7 o3 {% l* `) t
tooltip="Say hello world"
" Y! |. R" A/ j+ g2 F- o, \ id="com.plmhome.createFolder.toolbars.sampleCommand">
) l6 Y" I' A% @$ d8 H) P X </command>) ?6 p6 f+ a7 ` B3 [
</menuContribution>
' M, [3 t, r% L, `( E/ g6 L
9 \ ]8 B( B4 M, ^4 M* j( G% Y' K: ~(6)加工具条按钮& J$ {3 M8 s5 S- m) B1 m5 x+ Q
<menuContribution1 o, V2 w; }; S8 h$ m
locationURI="toolbar:navigator_Toolbar?after=additions">: a: j6 \! e* f% B, w: K& Q/ n8 K
<toolbar: I) E1 Q/ `/ q: n8 u
id="com.plmhome.createFolder.toolbars.sampleToolbar">2 N$ n4 Q x& i" N: u
<command$ G7 o- U: [" H/ z2 x, p
commandId="com.plmhome.createFolder.commands.sampleCommand"
6 L; [! z+ \* M; L" i icon="icons/sample.gif"5 _" @8 ~5 P' _ H0 y" F
tooltip="Say hello world"7 g1 _7 K U3 a: g
id="com.plmhome.createFolder.toolbars.sampleCommand">
6 h0 T0 ]4 r1 m( [( x6 J </command>3 B7 w/ [' ]3 K& E
</toolbar>
( H2 r4 c5 B4 \9 C' V </menuContribution>+ D( X0 z$ k& t) M+ z! {
; A7 D7 l% `; C! t+ D2 d2 A$ G5 t9 W7 d4 A
完整的例子如下:" V" a# v- Y' p+ W! l
# E# V: ^: B( d9 |! [<?xml version="1.0" encoding="UTF-8"?>& h! ]7 M4 | O) K: C
<?eclipse version="3.4"?>0 Z p( T$ W1 k6 R& ]- i1 m
<plUGin>9 e) Y8 \. h6 ]7 l9 w l, q* t
8 V' m! [* O# j8 }6 K <extension* ] L& l7 p$ P* O5 {( N- w
point="org.eclipse.ui.commands">
3 P7 N% ^3 d1 y/ D4 C9 a# } <category7 P1 g' r& |; W! w7 ~2 N/ |
name="Sample Category"- P( H* L _$ q7 h
id="com.plmhome.createFolder.commands.category">/ k% J+ }, t& o I: C
</category>3 u7 ?6 ]4 x, U8 u, b3 H
, F' @. z k0 N$ D1 Q W, I* r <command
4 @/ T' y# v! o. X# t name="PLMHome CreateFolder". ]& ^. J# {) s* v# s9 _1 f
categoryId="com.plmhome.createFolder.commands.category"
% R N8 {- e+ J! p" U0 s$ p id="com.plmhome.createFolder.commands.sampleCommand">, B, b2 { O) g F, w9 T; c
</command>
' } ]% U3 L9 ?7 F6 ~# l ?3 J! u5 J) B+ y
</extension>; i9 v3 R' v' {; \
<extension
; T3 n* M0 T1 Q2 g point="org.eclipse.ui.handlers">- A; c* m# ^' g2 J" |3 ~6 i! O
<handler- F* x- c5 ^4 e- j2 w% Q3 b( P
commandId="com.plmhome.createFolder.commands.sampleCommand"7 r x. D1 |/ F% z& A }3 @
class="com.plmhome.createfolder.handlers.SampleHandler">5 x) m5 R/ R5 i, Q
</handler>
6 S; I3 X% p$ u' z r) J </extension>7 i* A; ~, x# O. y
<extension
. X, C" F/ b3 {) L( X% C point="org.eclipse.ui.bindings">7 z2 F$ \; @- J& q
<key
% Y7 O, L9 @' y; |5 M# ]* ` commandId="com.plmhome.createFolder.commands.sampleCommand"
% B1 R* A' j) J/ J" h! d7 A% y contextId="org.eclipse.ui.contexts.window"4 [: G) |8 f; Q; C5 }2 Q. O
sequence="M1+6". ]$ g0 Z8 V8 g+ }$ e
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">, Y; \' v% @# w3 p2 F' n
</key>
: o. P2 I( G, H. F( K </extension>1 Z/ V6 p: j6 l* T' u" I4 d* U: s
<extension
o s: e$ z3 a point="org.eclipse.ui.menus">
, Y+ X: n2 X$ t' E
$ e/ D6 K5 C7 ]' p <menuContribution
+ c7 S7 h1 x2 z) b$ A( R locationURI="menu:org.eclipse.ui.main.menu?after=additions">& M- s7 I. T7 n& G1 a, D% a) m
<menu id="com.plmhome.plmhomeTool" label="PLMHome ToolKits">: l& s' O6 ` I; ]- ]
<command0 F2 `) G" s/ n" E& Q" @2 N) e
commandId="com.plmhome.createFolder.commands.sampleCommand"
" P# H& D* u# I! i$ i mnemonic="S"
- ~! ?! D2 Y; D/ m$ R id="com.plmhome.createFolder.menus.sampleCommand">* D% S9 s. z/ o- [
</command># b1 c; V/ I& M& G" _& u* Y& x# y
</menu>' H% N% ]4 \4 ^# w
</menuContribution>
/ C2 [2 h2 b, M& F/ i3 f
! `9 O) e* h# B% r6 J( _7 A
" c( d! G" M) {6 e7 K9 i
a7 {. e" ~6 x# s- l <menuContribution
4 {# b, p' ?" K4 c; w1 C% v- P locationURI="menu:tools?after=additions">
% k% R# C& u/ u* F+ f9 q& y <command& v6 w' i& q& F
commandId="com.plmhome.createFolder.commands.sampleCommand". g5 E4 R% b- b) o# v
mnemonic="S"
& W# U8 |- W' G+ C" s X5 r9 V- R: T# x id="com.plmhome.createFolder.menus.sampleCommand">) b) d7 J/ ]/ U* _) A2 X! F* p3 Y
</command>
2 Z2 ?0 Z8 b1 ~( g2 W </menuContribution>
9 ?, z) v. b# C! D. }6 c3 Q) f
+ [3 g. Y( x# q8 Y3 t0 ]. y
4 f, _; D' B9 A! a/ h% ~( J
3 _4 y- Q) d; u* X <menuContribution
V0 G2 @. O" Y# t* K7 | locationURI="popup:org.eclipse.ui.popup.any?after=additions">
# z5 z9 h8 m- o <command( P6 V5 e# V. e8 D* c
commandId="com.plmhome.createFolder.commands.sampleCommand"
' x6 G+ L9 Z; K: o6 f) P mnemonic="S"+ a& a0 _- c4 C
id="com.plmhome.createFolder.menus.sampleCommand">
: n$ Q9 l1 S- L& C6 \ </command># v: m* _4 p' U) o5 ]0 i8 k7 m0 f
</menuContribution>
/ j" C3 s( x& F* ?- M
# E9 y0 k1 s+ g. h <menuContribution7 h3 E& P7 a2 j) S& B" ^6 f2 E
locationURI="menu:com.teamcenter.rac.ui.views.DetailsView?after=group4">
2 P* L% `6 B4 U <menu9 J$ F3 L8 I7 i0 b
label="PLMHomeToolKits"
% B3 K; n0 q& u! U9 ]( K% h5 S mnemonic="M"5 Q' ]$ R2 ]5 U% h' }
id="com.plmhome.createFolder.menus.sampleMenu">& V J) ]/ Y' Z
<command
" Y; J; | X3 b* O commandId="com.plmhome.createFolder.commands.sampleCommand"
6 p& M, }. j& R3 Z, Y, @& r mnemonic="S"
+ ^0 q" i+ U5 |+ C4 H5 G$ y id="com.plmhome.createFolder.menus.sampleCommand">
' p4 V0 r# P' R </command>
/ O y! y% _. M- }0 z1 r& H. k </menu>
" x* V$ J* ], h H% q4 | </menuContribution># S5 V7 ^( z9 }% b1 M" S+ Y
! M. z( |" D/ x1 | <menuContribution) c- n! \; }! ?7 P5 S- }
locationURI="toolbar:com.teamcenter.rac.ui.views.DetailsView">% }2 @7 U6 C* d! y
<command
$ \2 y% G: x4 N; V2 M! ` commandId="com.plmhome.createFolder.commands.sampleCommand"6 r9 X0 x/ q* P3 c% L6 Z, D" ]
icon="icons/sample.gif"
, l' E4 {; ]1 b. D tooltip="Say hello world"
7 ^; \9 M( r9 A" X5 |4 D! t id="com.plmhome.createFolder.menus.sampleCommand">4 w! s) u( W: K' j
</command>! Z8 E) @( ]/ @$ v) R
</menuContribution>% [) O8 o4 F: @/ v- g
' ~' p, ~ A4 V# v6 W' n! L* N, ^
! L/ _3 e1 H5 [9 o) J" k, c! j <menuContribution, E8 d' q( Q7 N4 E
locationURI="toolbar:navigator_Toolbar?after=additions">
# U* {- o3 o3 h5 Z+ A; p <toolbar" r9 B/ n' J* g4 [" e9 D, w
id="com.plmhome.createFolder.toolbars.sampleToolbar">( ~$ z+ `) c) c; z; K
<command
9 a; T3 {& s8 P2 P8 k commandId="com.plmhome.createFolder.commands.sampleCommand"
8 v% x4 B0 \( w" K Q icon="icons/sample.gif"
q. {' Q$ ~, w: [/ R3 R tooltip="Say hello world"
4 |: e2 c- @( S @, V8 N id="com.plmhome.createFolder.toolbars.sampleCommand">
7 H. S; m# f3 K </command>5 P* P& s' }# G( ^" _* l [) g
</toolbar>
8 h4 N0 H/ W5 Y7 z9 C& z! o </menuContribution>2 i g3 E) t2 w; ^! @1 e. i
3 p7 x6 Y9 m* W, S) j5 u' Z" _1 u% E) a! Y
</extension>
: E% w' @* u( Z5 s1 K4 u3 k, Q G
8 R T H& G- ^1 D- u' y! k& [</plugin>- s; H) q3 b- I$ M( a* [
' q; B! G6 J6 x5 A, q/ ^! l
% ^7 p, E+ T' q% U* e7 D
, T! V5 O9 [8 [' R7 ?% t3 m0 { |
|