|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
【Teamcenter胖客户端开发】teamcenter菜单添加图文教程<1>4 X }/ ]0 l$ K
这部分内容实际上是eclipse的插件开发的功能, 这里做个简单分类,菜单文件的扩展点都是 <extensionpoint="org.eclipse.ui.menus">,添加菜单就是在这里面添加内容。这里只要注意location即可!+ u& g* b6 W. w5 o5 s- c
(1)在主工具条上添加菜单。# a9 G) C: L% ]3 B& Q5 o
<menuContribution
, Q$ T# l1 L5 o7 |5 _ locationURI="menu:org.eclipse.ui.main.menu?after=additions">
q! ~: n1 ^' x9 R2 _. n: T0 W2 _6 h <menu id="com.plmhome.plmhomeTool" label="PLMHome ToolKits">
8 Z8 f) ]0 l4 s" g/ A, W) ` <command" P& ?0 m3 F8 S _/ H
commandId="com.plmhome.createFolder.commands.sampleCommand"6 D0 ^5 B: S" s9 L3 L1 Q4 E* S: R
mnemonic="S"
: A$ @# S. s+ E$ ~ id="com.plmhome.createFolder.menus.sampleCommand">
9 s0 g- j4 o- g+ H) a* N6 J3 i </command>. z# \5 X% W7 r* P
</menu>8 g3 f5 |1 b2 R$ H. q" E
</menuContribution>0 b# X5 O1 B* y/ C& d
' }# X9 e; c0 ^" f(2)在工具功能的后面添加按钮。
* {3 k; ]% M Z2 v7 C, p% ~ <menuContribution* O: ]& }" T% ?. D+ ?0 @
locationURI="menu:tools?after=additions">% h7 }$ l, {* z# i1 v% V* T
<command
6 z5 T( n" v( |6 V% H commandId="com.plmhome.createFolder.commands.sampleCommand"4 M0 B: p6 n& B( s6 v/ X/ V
mnemonic="S" o, [/ W, D: |8 B# j* c# K1 B
id="com.plmhome.createFolder.menus.sampleCommand">/ f, F0 r( ]& n! m. A
</command>2 } P# d+ R4 M4 q6 C9 y2 _
</menuContribution>
, ~' h( W" D# Y) h# [, a
: L( O) D! G/ h% P2 y8 j U1 H! V(3)在右键弹出菜单加按钮/ W1 s9 \6 ^- e
<menuContribution
/ r8 e' ~$ V! @0 A0 z* G locationURI="popup:org.eclipse.ui.popup.any?after=additions">9 J4 \# {4 t# `5 k! m
<command
" W+ B6 Q( P& z2 k commandId="com.plmhome.createFolder.commands.sampleCommand"3 M# C9 E; w1 ]7 T/ z. {
mnemonic="S"
2 x( N# I$ \- N6 |( S' J id="com.plmhome.createFolder.menus.sampleCommand">
0 J, w( G, `0 e& @7 F8 d </command>
: l& g! S7 B n7 X4 s, T1 S </menuContribution>" H# e+ K6 K: L+ f
(4)在具体的菜单后面加功能按钮1 f, ]" X4 s( ~; p/ V- f# C! B
<menuContribution2 u( l( a3 U/ r) R# h- S/ h
locationURI="menu:com.teamcenter.rac.ui.views.DetailsView?after=group4">
' T0 ~8 h$ q2 ] <menu
; _8 O& n% I w6 b; E( W0 m$ t7 | label="PLMHomeToolKits"5 S" Z" a2 t C/ @, [
mnemonic="M"0 l+ n I; M2 ]: w" V6 w
id="com.plmhome.createFolder.menus.sampleMenu">
$ K+ l9 V& K: n/ b1 Q# P# v <command/ d" C$ B7 W# O) r+ f; ?& y
commandId="com.plmhome.createFolder.commands.sampleCommand"
" z3 |& C8 \" h* W mnemonic="S"7 ^8 b& p$ s% P3 C! ? z7 v
id="com.plmhome.createFolder.menus.sampleCommand">
3 l, i9 S* u" i6 [- f3 m </command>
3 p. D3 l" u: d9 Q% w </menu>
' S `* n) c8 I A' P+ K </menuContribution>- g% d; | J( r& @) L- e2 @2 {' U
+ H+ b; @% m6 W4 Q0 L0 b$ c7 I* w7 o
(5)指定位置,直接加按钮4 j& }1 \: i! y+ U4 v ^% u
<menuContribution
5 L6 c p2 L/ F5 n1 S* C( K- u locationURI="toolbar:com.teamcenter.rac.ui.views.DetailsView">* ^9 L& _; A: O
<command: R# B* B0 ~2 N; K @
commandId="com.plmhome.createFolder.commands.sampleCommand", [" t9 {- C) r7 f. j( \& {# q
icon="icons/sample.gif"% {" H# h! L* g/ s
tooltip="Say hello world"
4 m/ F/ u0 T. O id="com.plmhome.createFolder.toolbars.sampleCommand">% x I, A0 M- G/ w" ^& l
</command>* T0 ~- W# N; X) H5 o
</menuContribution>
0 H e: ~! [' G: Z; x3 |: ?- M0 D
(6)加工具条按钮
- u7 R, A1 V/ N1 ? <menuContribution
# N) ^% O9 q$ y4 [ locationURI="toolbar:navigator_Toolbar?after=additions">. r, ^) A8 O% J0 ~
<toolbar1 u5 \# `/ ]4 p2 i" F
id="com.plmhome.createFolder.toolbars.sampleToolbar">. n! M) L) N- e& |
<command5 d0 h- }) b; s' T: |3 t' P' H
commandId="com.plmhome.createFolder.commands.sampleCommand"# V- y( F3 k4 h& Q6 G
icon="icons/sample.gif"' f. h$ s, L( ~& |$ [
tooltip="Say hello world"
! D) i9 }1 w& m4 D; X- ` id="com.plmhome.createFolder.toolbars.sampleCommand">0 {2 i& S' d0 S, i4 }/ p
</command>' J( \2 z: _4 h) ~
</toolbar>
3 ?0 \2 o5 b9 ^/ K5 S </menuContribution>
0 r9 y! A5 ^5 p D0 J/ w; m6 m& J; z
- W( B& x `0 q
完整的例子如下:1 n1 S( r9 S# ?. I4 ~* U$ L# }
. j8 T) W k& ?6 q1 a& P<?xml version="1.0" encoding="UTF-8"?>
* h5 j* [3 J7 P/ z! s/ j<?eclipse version="3.4"?>
& s3 z5 X* T# Q* _8 g% ?# ^& `, a8 P<plUGin>
0 V3 x* j/ T" }$ d* ?) w( s0 ]3 \% z4 Z% R9 @
<extension0 k4 O! V2 u( H# A
point="org.eclipse.ui.commands">- H6 L, v' i- T& u) s
<category
; _% z& @ f2 l name="Sample Category"
2 s' p j7 u# m id="com.plmhome.createFolder.commands.category">% g( j2 g* w9 @* n4 y3 ?
</category>; o& ?! @- Z. a5 {, L
' j$ H- ~8 _: _ <command
3 A0 r; k* |" _& p8 d& C% v9 y name="PLMHome CreateFolder"
% s! Z1 d" d Q- p5 X0 n/ R categoryId="com.plmhome.createFolder.commands.category"
7 _# A) @& N X9 m/ Z+ C- v: K( } id="com.plmhome.createFolder.commands.sampleCommand">
2 M" U- e3 x6 A. B/ |: V </command>% H+ J' B1 H3 i7 \+ t
# U8 F( L$ ?0 F% X6 O* b ^; }# a2 l
</extension>
1 E, {# `4 r1 L E# E6 g$ n <extension
! z9 o" a3 e# W% {4 a4 N. S+ F point="org.eclipse.ui.handlers">" M! B0 y: O7 X3 i" ]/ ]7 W# V" [
<handler
0 X. A; t8 A. D3 v commandId="com.plmhome.createFolder.commands.sampleCommand", C1 f. o! A3 M+ \7 z; A) ^5 {
class="com.plmhome.createfolder.handlers.SampleHandler">+ f' ~- V: g$ G1 b
</handler>
8 ?8 c* ?2 X% l6 n </extension>& f) H7 h# ?: L: ^, ]# O
<extension4 c. n; z1 p* Z3 e2 H, t( u+ E
point="org.eclipse.ui.bindings">4 z& J9 Y' ]0 K1 G* c+ V
<key( ~9 }3 E9 V. ^. h+ B) H) A
commandId="com.plmhome.createFolder.commands.sampleCommand"
- a; O1 g/ d5 ~: i: p contextId="org.eclipse.ui.contexts.window"
6 z6 ?) o1 z" |9 Z2 B- X/ J) w sequence="M1+6"0 I5 N2 } n5 K9 R8 U* G
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
; R2 x" L5 _# z, R6 | </key>
- b6 r+ H2 D( p </extension>2 l+ Q: ~* X) B H9 C9 T6 p4 l
<extension; [6 t: s9 a2 o" i) m+ Z
point="org.eclipse.ui.menus">
8 a: h8 W! e, j2 z5 _$ m
0 q5 e5 m# u) q <menuContribution( k( z- q4 [' y5 t$ Z2 c$ B
locationURI="menu:org.eclipse.ui.main.menu?after=additions">
9 `+ X5 k, E! Z$ L% F8 X& o <menu id="com.plmhome.plmhomeTool" label="PLMHome ToolKits">; L* g+ ]* x. v3 b
<command4 U, U# m* h$ ?" \1 W% G
commandId="com.plmhome.createFolder.commands.sampleCommand"
- Z/ C( J& ~& e5 \: y) k9 U mnemonic="S"9 D8 ?4 Z5 z) N# t
id="com.plmhome.createFolder.menus.sampleCommand">
U, U% [& c0 |9 n$ b% w </command>/ j& `* W/ V9 w* Z8 ~0 j
</menu>
$ U4 e J P, J$ L" \ </menuContribution>
e. X+ d; d* H! U( f7 ]7 `) t4 Q0 Y
/ M" ?6 A6 b+ a+ k4 v- E1 e
# v( O3 j, r' z& n# f) T6 ~$ z
<menuContribution- `3 ]$ `( |% l
locationURI="menu:tools?after=additions">- ~6 |7 |' q- r i0 L
<command
$ Q! m! w. ?* k) e. m* _ commandId="com.plmhome.createFolder.commands.sampleCommand"& z6 S$ n/ m4 [8 y
mnemonic="S"
/ c+ e' l2 D# S/ g7 B* v$ ^! E id="com.plmhome.createFolder.menus.sampleCommand">% s4 H9 _+ K4 i
</command>
5 f: Y& L1 D0 X- x: e0 s9 Q$ N4 P </menuContribution>
8 x$ x. v) g# X
; j& m8 s' C; V; s! X( L+ U! Y+ i/ D; m' q$ z6 U4 V
, A) p& ?+ X; v9 D/ j- D <menuContribution+ X" m! G( A# a7 O
locationURI="popup:org.eclipse.ui.popup.any?after=additions">
, P- D$ e2 _, p- L5 H5 c" i2 ] <command
/ X% D( Z* ]( U commandId="com.plmhome.createFolder.commands.sampleCommand"
( {- [: R6 q# _6 ^ mnemonic="S") h5 I1 Z: _1 |% s
id="com.plmhome.createFolder.menus.sampleCommand">9 d% K- o/ B0 k) G# x1 q5 k
</command>, l- R$ A( z0 s
</menuContribution>6 _) |1 q4 b- v9 W+ P0 x
7 x. W% J2 s6 t( S) i( D
<menuContribution
: V, E' x- A. Z* w U9 W5 v! I locationURI="menu:com.teamcenter.rac.ui.views.DetailsView?after=group4">
' }1 M5 r2 l4 K( a9 c <menu; i& J0 I( {& [) l( V
label="PLMHomeToolKits"
+ A& r0 W( Y5 r- V `: V" F: n" ?; U mnemonic="M"
- H& n9 r4 i- e id="com.plmhome.createFolder.menus.sampleMenu">. f& Q2 q1 C" C: Y( q$ y: I
<command0 M; ]. x: _5 B, M0 x
commandId="com.plmhome.createFolder.commands.sampleCommand"
8 I9 r2 @! ~ ^3 G- b) j! O mnemonic="S"
$ O5 f% o# W! ^' P! y- w* Z; l id="com.plmhome.createFolder.menus.sampleCommand">
8 m2 _8 a8 Q$ F </command>
$ N) G0 f" c- S, F: g7 F </menu>! l" o7 [- E- |) p8 A! k5 \
</menuContribution>4 C- W/ D7 e1 I- [0 v
# u/ {: i; K" f) g5 }3 g& F) p
<menuContribution
" F7 H$ ?* E7 K locationURI="toolbar:com.teamcenter.rac.ui.views.DetailsView">' c7 z0 E' |0 I7 O
<command! T9 E1 i$ R6 i @
commandId="com.plmhome.createFolder.commands.sampleCommand": n: f) l2 U9 u
icon="icons/sample.gif": n6 I2 C" P" }" p% [# h0 D
tooltip="Say hello world"
" B0 _9 D" l5 E2 W$ \ id="com.plmhome.createFolder.menus.sampleCommand">* @* L i. n4 P% T7 N! }
</command>
* g8 n: o# ?, u t+ U- c, Y </menuContribution>: P$ U l+ G# B9 \4 F0 Y
0 ^3 `3 R! b" \- X& j
* D) u$ {" S; e1 ~ <menuContribution' _4 M1 w5 Y' u$ S6 `0 @' O b
locationURI="toolbar:navigator_Toolbar?after=additions">+ D0 B; B+ z1 A* G7 M
<toolbar
" z) R# G5 |* P id="com.plmhome.createFolder.toolbars.sampleToolbar">0 G, D% V0 c6 w: ~3 B* i
<command
* V% h) f r1 I5 b commandId="com.plmhome.createFolder.commands.sampleCommand"- i3 }5 C8 f# y) R2 J$ T: J& ]* T9 }" p
icon="icons/sample.gif"
/ [( r$ W& I6 ? tooltip="Say hello world"$ u3 \' i+ o8 r: ]( e* l
id="com.plmhome.createFolder.toolbars.sampleCommand">, {2 I- Y% T) C" C
</command>' O" M s& c7 ^6 Y
</toolbar>
( z5 k; [. m( R4 [. V) s1 G </menuContribution>" q/ ~2 n! n# {5 S) k; H6 g
, X! d: n' N+ ~, r" q
" B! A! n0 G: f; X* x# s" i( }( t9 { </extension>% t! v1 b- H: h3 ]# b: x5 J0 Y
5 o' K* h" A- t+ W, ^1 k
</plugin>
6 M/ x+ P1 b! O3 i( T& f
4 U/ u- H6 U2 z% [" C# V2 j
! {2 d* c! z4 G9 i; D3 v3 t/ \: A: N8 X1 T: d- E1 M' X4 D
|
|