|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
【Teamcenter胖客户端开发】teamcenter菜单添加图文教程<1>/ t( B% T3 \" e( `# [; k
这部分内容实际上是eclipse的插件开发的功能, 这里做个简单分类,菜单文件的扩展点都是 <extensionpoint="org.eclipse.ui.menus">,添加菜单就是在这里面添加内容。这里只要注意location即可!+ ]4 p( E$ s1 B4 [3 X; i. a
(1)在主工具条上添加菜单。) l) D P8 W; \, T/ N
<menuContribution1 z/ f+ b5 M$ U9 _: M y" t, L
locationURI="menu:org.eclipse.ui.main.menu?after=additions">; K* {. Y; t* ^) H4 f
<menu id="com.plmhome.plmhomeTool" label="PLMHome ToolKits">
) i4 L: n, H0 ] E2 Q, U& z1 Z <command
/ f. P4 V* b+ e0 }. a3 x# t commandId="com.plmhome.createFolder.commands.sampleCommand"4 @0 i# g9 d3 v, J+ B8 v: J
mnemonic="S"
/ T) B3 ^' _5 R1 v2 ? id="com.plmhome.createFolder.menus.sampleCommand">: m3 Q6 U% P: v( O1 }
</command>
8 q; |/ G J% ^' Z1 U t6 n </menu>5 f+ H, D6 L( c/ V. e, a; Z0 j2 [
</menuContribution>/ Q& ^6 L: l& p0 M. r& |
5 P: u" ^5 r: N" m6 y* ^(2)在工具功能的后面添加按钮。
" W) W/ Q2 q3 A- d <menuContribution
) h2 Q- L& _7 J4 d n" | locationURI="menu:tools?after=additions">
: l2 S$ P, Z i$ X8 H6 N <command" m* O' X& G6 c7 [
commandId="com.plmhome.createFolder.commands.sampleCommand"
% q7 a% J: G4 P5 v4 _% T+ B mnemonic="S"
' G7 ~; ]/ U$ r* X5 B) _ id="com.plmhome.createFolder.menus.sampleCommand">3 b8 F% o# y7 r
</command># U" d7 |! d( G2 I+ w6 g* g x8 @
</menuContribution>6 q" J9 t2 `9 g! }/ f# J- P9 Y
5 J: c/ q# N& t0 {(3)在右键弹出菜单加按钮% \0 J% [' Z! B, ?- a! Q% C0 w% w$ F
<menuContribution
/ r8 m+ r( A1 U# {. R0 | v locationURI="popup:org.eclipse.ui.popup.any?after=additions">6 Z' z: G5 F9 ^
<command- H4 _* V# f4 G/ O7 _0 U
commandId="com.plmhome.createFolder.commands.sampleCommand"
5 M+ s8 a% X2 R; K, c$ J6 j$ \ mnemonic="S"
4 |! S% M* v5 @( C id="com.plmhome.createFolder.menus.sampleCommand">
9 U0 z6 Z5 L1 n </command>
7 m5 r3 |- j; d2 L" u5 u' Y' Z </menuContribution>
5 _; g. Q, K. x \; O' U' j9 }(4)在具体的菜单后面加功能按钮+ t) _9 U6 y* V j C
<menuContribution
" a1 m% G# I2 Z `4 j locationURI="menu:com.teamcenter.rac.ui.views.DetailsView?after=group4"> L4 h9 F0 u' [5 a* Y
<menu" }, i! @ ]/ \4 Y' H
label="PLMHomeToolKits"9 ~ U* c+ H) w1 d& s. F( R5 w1 w
mnemonic="M"( a+ }8 B+ f' P: {: \7 }
id="com.plmhome.createFolder.menus.sampleMenu">
6 m0 x M8 g2 I$ Y+ P/ d7 P <command
5 M! \' _% O. W( C commandId="com.plmhome.createFolder.commands.sampleCommand"( h6 b+ C3 _8 N
mnemonic="S"
) J! e1 R7 t7 V) x# X# d7 r8 J id="com.plmhome.createFolder.menus.sampleCommand">" r7 S/ n& i; \6 R
</command>0 s4 D0 r! D5 h$ Q; b J$ ]
</menu>
4 \) R; g L x; G2 I% i* e </menuContribution>
2 U( m0 F* Z# n
; N/ K/ v2 |' X# r(5)指定位置,直接加按钮& A' u9 e. {7 F
<menuContribution3 Q } r) Z8 X" B2 o& V. e* D
locationURI="toolbar:com.teamcenter.rac.ui.views.DetailsView">4 X Z& e! } L% F, a5 C" U: T
<command; l# I+ B4 t# \
commandId="com.plmhome.createFolder.commands.sampleCommand"
/ V& U3 b/ M- C @& ]" L icon="icons/sample.gif"0 e; z* n; m0 G, z
tooltip="Say hello world"
. E) y9 |( g2 J: M+ z id="com.plmhome.createFolder.toolbars.sampleCommand">/ O8 ]" G; f2 o% Q( o& d# n% m
</command>
8 D' m b2 ?7 A. u" ^# u </menuContribution>* z5 H7 S8 Z6 I3 [' N" K7 L
# l( d* }: q& X6 h8 p9 _2 S(6)加工具条按钮
: V, f1 a9 f# L, B) r; s <menuContribution) ^2 G6 C; O4 U9 h
locationURI="toolbar:navigator_Toolbar?after=additions">9 ^' \1 \3 N1 i" X
<toolbar
- h2 B$ u6 g) F id="com.plmhome.createFolder.toolbars.sampleToolbar">
% [( z' [4 R8 Q0 i0 h <command
) f& F8 e! q5 g6 z+ h commandId="com.plmhome.createFolder.commands.sampleCommand"' R; E. l/ {6 b5 P+ ?8 l9 H
icon="icons/sample.gif"- y4 O. K: x$ C
tooltip="Say hello world"
5 j; J6 M3 Q9 K" l6 M. f2 { id="com.plmhome.createFolder.toolbars.sampleCommand">: {. \/ R5 I: O) B
</command>" \: ~5 ^8 S4 d* s" h1 n
</toolbar>8 W" f6 I, ]7 @' Z9 G1 q! j. W
</menuContribution>3 L; \! |) [* E/ z. W
) T* V3 q2 ] ~$ O* y
0 e: B: }% _4 V2 F; a7 B1 t" C完整的例子如下:
. I$ b( T( Q( [* e: t% _4 N
# m. a* U$ P9 p<?xml version="1.0" encoding="UTF-8"?>2 D1 e( f; o$ i% p
<?eclipse version="3.4"?>- r ?) a3 x4 @8 t8 S& n9 _
<plUGin>
! \, x" J6 I6 E }' _7 D# o h* b X7 G( `" l9 z0 g
<extension" r- g; O a0 N1 _
point="org.eclipse.ui.commands">
8 d Z1 e( m7 V+ W$ G& L) ?/ h <category2 M1 `: |# [9 L; N w% t
name="Sample Category"& X, }) Z) K" v) D0 _ j5 e
id="com.plmhome.createFolder.commands.category">
n9 Y. d$ j+ d8 {0 t! m# O </category>! _# c/ g' _9 I# |" D$ d
/ B" V0 p# A& L/ H9 `
<command7 E# N0 Y: h' o6 t
name="PLMHome CreateFolder"3 n' ~" R: G( B) D/ A
categoryId="com.plmhome.createFolder.commands.category"' D( H7 r/ d( p
id="com.plmhome.createFolder.commands.sampleCommand">& ^) M5 ?8 b& R. k8 J+ N8 E1 P% W
</command>' ^1 n* S# n2 T8 k0 v1 u
# o! y& P' i8 ]6 ]- |: D- d </extension>
6 g" m/ E2 C; s( T& q <extension
% i9 i& i6 q5 B% z point="org.eclipse.ui.handlers">5 W2 K6 o* u# a0 G, _( [5 R+ e; n
<handler
; t: }# I) v) J9 E' z commandId="com.plmhome.createFolder.commands.sampleCommand"; N5 v& f, u @$ a
class="com.plmhome.createfolder.handlers.SampleHandler">7 E+ m3 b* j, a" P) O* y& v
</handler>$ h1 |" T' }+ [+ [. Y7 x8 V
</extension>
Z1 d3 v. u' c) J <extension" s7 K$ `) ?) i
point="org.eclipse.ui.bindings">
8 K6 K$ }5 `6 G. I <key4 d7 D+ m0 q" Y- g4 |7 {
commandId="com.plmhome.createFolder.commands.sampleCommand"
9 Y' W- {9 h3 p* \ contextId="org.eclipse.ui.contexts.window"
_6 y B/ H: l; K" ` sequence="M1+6"
7 y* Z( r: d# t- F5 B schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
2 p3 ~5 g# f. A </key>
8 s$ j' }8 U+ m' n+ D$ U </extension>0 i- C; M9 L4 ]5 n3 S. V3 S2 R
<extension
! Z6 e l6 e4 a point="org.eclipse.ui.menus">
1 O! n7 P2 \" G* l4 r/ J8 A7 h! K0 \# s8 o' L4 S
<menuContribution+ T+ N: c/ W: L; e5 f
locationURI="menu:org.eclipse.ui.main.menu?after=additions">3 L! a+ B% t5 D3 V2 P' h: C0 o
<menu id="com.plmhome.plmhomeTool" label="PLMHome ToolKits">
! r: C% I$ X z* G# K( m7 x <command
/ l+ b) k* n) r; B9 n& V* J: q& D commandId="com.plmhome.createFolder.commands.sampleCommand"; ~2 c4 e7 |0 a l7 ?$ v) m
mnemonic="S"
8 r0 _0 w( V$ t" W8 \8 R id="com.plmhome.createFolder.menus.sampleCommand">
# F, ]! T% g- U3 J </command>
3 R2 R, C. z/ F) C4 q </menu>* G2 w' i( Z& [( ~
</menuContribution>
6 r8 N7 w" O x+ i. Q) [3 V( r X: {9 g- D) }! m7 B& {& w
! `' p) O2 M6 {/ h, U# b n9 r/ s {- S, f) e8 ?2 S
<menuContribution. g" n j1 V; C% j& Y8 A, h
locationURI="menu:tools?after=additions">
( Z. Z- B' N! b4 M( e: j <command
: u9 V1 D+ V8 [2 h commandId="com.plmhome.createFolder.commands.sampleCommand"
! j+ K, s y8 z0 Z3 }3 Q mnemonic="S"7 A# i# U; i+ {& r% o
id="com.plmhome.createFolder.menus.sampleCommand">
& ^- v' [ d" Y </command>) m1 `. y a" C/ ^4 u' }8 R5 I
</menuContribution>
5 X3 ^# C; Q9 S) N; F% s. D6 L" d
$ J8 b: v* q# [
: x+ {( N$ w5 u1 {
<menuContribution
k: d# w! Q; [- d' p1 t9 { locationURI="popup:org.eclipse.ui.popup.any?after=additions">
1 y* [: F1 I9 X7 _, o; | <command. Q4 d1 F: I4 \2 }+ U) Q
commandId="com.plmhome.createFolder.commands.sampleCommand"" r: x' X$ j+ x/ q' u
mnemonic="S"
, ]8 i- s7 W1 a/ H& p& o8 Q$ c9 k" ]' O id="com.plmhome.createFolder.menus.sampleCommand">
+ C; D7 M* ^2 M. A( X </command>( k* S8 x8 o% l% W3 n$ T$ I
</menuContribution>! E1 D/ {0 ~- Q% \$ C7 U6 B7 _1 s
4 }* ?) |3 K" G& B; m <menuContribution& T, r* V; T' Y9 L
locationURI="menu:com.teamcenter.rac.ui.views.DetailsView?after=group4">
W8 H3 |+ ?+ t L- J( c. H t <menu j6 q: M' n1 G; c! v& V: S* n6 R
label="PLMHomeToolKits"2 V v, C% H3 z, V: y
mnemonic="M"
0 S9 J4 a% m; x8 L( f( X( o id="com.plmhome.createFolder.menus.sampleMenu">
/ B: ^! v# @% h% k! t% }3 n <command
+ [9 K* u0 r7 @7 i$ s commandId="com.plmhome.createFolder.commands.sampleCommand"% i( F$ s ^: G4 j4 P0 U
mnemonic="S"
, v# o; _# @# @ S4 ?! q id="com.plmhome.createFolder.menus.sampleCommand">
( h, _9 ~3 q# V7 r( b0 B0 @ </command>* F& z: G! I/ t$ T' L9 ~/ j! s& s
</menu>
% s3 b8 D' _" Z( ?. s! i8 D/ V) i0 Y </menuContribution> C$ I. D3 @1 G
0 v- ?1 w2 ?# L6 I <menuContribution% `- |8 l% z4 g
locationURI="toolbar:com.teamcenter.rac.ui.views.DetailsView">6 @: e1 o7 A* o) \2 J
<command b" x1 R$ R6 {% U6 ~1 D( s
commandId="com.plmhome.createFolder.commands.sampleCommand". D5 R" ~. u, ]; j' R |. T
icon="icons/sample.gif"8 I" F- S2 p/ F! V8 S7 s0 v% i
tooltip="Say hello world"& ]: O/ Y' a: m: {* ^$ P; A2 b
id="com.plmhome.createFolder.menus.sampleCommand">
. X; z7 W* T2 z u' e2 m; Z# A </command>" c( f; c0 V& x( W/ b0 I/ Y9 c
</menuContribution>, R& u9 x, _# t. r5 u1 h8 i$ N
1 t' n# }1 f2 U7 R* P5 ~( ]6 U" d6 W! N! o7 W* s* Z
<menuContribution
- f- ~2 d/ j8 O0 V2 j3 V# K locationURI="toolbar:navigator_Toolbar?after=additions">
- m- ]5 V% Q& Q! j1 {' {' R! n( P <toolbar
- ^! J* g# U5 l" U5 N id="com.plmhome.createFolder.toolbars.sampleToolbar">; N9 Q' ~* |, m# t* h
<command- Z5 q8 h a) s& }( n# t+ ?6 C9 G
commandId="com.plmhome.createFolder.commands.sampleCommand"* ^7 d) g6 q/ b' M
icon="icons/sample.gif"
8 g, O% ]9 F+ f4 A) q tooltip="Say hello world"
, t7 {- q# S4 g' o A id="com.plmhome.createFolder.toolbars.sampleCommand">% u; {4 y' P9 _& F( z
</command>6 `/ [/ ]1 d; C- A/ p
</toolbar>
: H' @8 Y5 E7 E% ^) W/ T </menuContribution>- p: J& b( P& U* R
& { `& t) s+ t4 E
6 D2 [) n5 n0 ~; q
</extension>. X- `: \9 o7 X* G$ Q. {
; \9 N2 B9 B$ t% _8 x& R</plugin>( q$ t% K2 Q+ \6 K5 U+ ?
3 ^ g" s4 y# b& O+ |% x# n( L" f/ h( }8 F8 X8 W N
: `: ^- ]$ y c: f0 Z9 I1 h1 p
|
|