|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
【Teamcenter胖客户端开发】teamcenter菜单添加图文教程<1>
5 r* t+ Y3 i) M这部分内容实际上是eclipse的插件开发的功能, 这里做个简单分类,菜单文件的扩展点都是 <extensionpoint="org.eclipse.ui.menus">,添加菜单就是在这里面添加内容。这里只要注意location即可!
5 Z1 \4 c0 Y& T$ W/ s( j$ Y(1)在主工具条上添加菜单。! w/ u. l9 _" k& f$ u7 W$ ^0 @' Y
<menuContribution6 ^% d0 p o7 `7 [, {# L, L! L4 _
locationURI="menu:org.eclipse.ui.main.menu?after=additions">/ K# R" o# @+ C
<menu id="com.plmhome.plmhomeTool" label="PLMHome ToolKits">$ S4 D1 G7 J+ R3 G o
<command
- d. h0 y! W8 x# b: ~ commandId="com.plmhome.createFolder.commands.sampleCommand"/ @, V% U4 [# ^1 o% G v
mnemonic="S"
; \9 s2 E. W+ c2 i id="com.plmhome.createFolder.menus.sampleCommand">
3 A) |! i; O; M </command>- H, m2 I0 ~3 z
</menu>
& q- J3 F8 v: N8 k- S8 X </menuContribution>. _* T% S0 Z, u; z [
' E& j4 Z, P% `* N! ?4 w. G; V(2)在工具功能的后面添加按钮。
5 T6 t9 H6 Q2 A: a; t0 s <menuContribution
{7 |: ?) H8 W* } locationURI="menu:tools?after=additions">, Y, ^; h0 Y1 b$ R* l% c. Z
<command
- U) K- g x& R; x7 ^2 O commandId="com.plmhome.createFolder.commands.sampleCommand"
; W0 b, z/ l( B l- u5 o mnemonic="S", l' l" ~9 e* d
id="com.plmhome.createFolder.menus.sampleCommand">& n7 f. T$ c$ [9 g0 r" o) s
</command>
. J- K4 O1 _4 ]& D6 `9 K/ f3 R </menuContribution>
. m8 Z& ]2 k9 F% i& b
+ h+ s& Y& f. q! N+ x6 C& `7 {(3)在右键弹出菜单加按钮( [$ T, I" `2 b
<menuContribution
! ]+ v- w" H5 z! \1 j locationURI="popup:org.eclipse.ui.popup.any?after=additions">
% l/ X' h7 H* [/ o3 V4 @% j I! G <command8 h0 |; O& F* l( u# @
commandId="com.plmhome.createFolder.commands.sampleCommand"
# u2 z; @) J6 A1 g* B" D! s O mnemonic="S" q& n% F1 q7 n1 g5 t5 R, e5 |
id="com.plmhome.createFolder.menus.sampleCommand">
; X( _8 |) ?/ j t& l: r3 }, ^; Q </command>/ _% M- G9 }' g* p4 [ p. a
</menuContribution>
# x8 E) }: x* O) g9 t(4)在具体的菜单后面加功能按钮
2 |/ r7 s/ A5 R! _+ l <menuContribution8 R% c: b7 Y* n: w
locationURI="menu:com.teamcenter.rac.ui.views.DetailsView?after=group4">& B% W% [( Q6 S: x
<menu
7 r% l) h& r2 |: l! F% i label="PLMHomeToolKits"
" O# H: T$ P3 J, O* h4 O mnemonic="M"
# J3 c; `1 X4 f `1 h& G) u id="com.plmhome.createFolder.menus.sampleMenu">
' m6 ]( S0 |" ]& `8 x <command
; |# \- q E% n commandId="com.plmhome.createFolder.commands.sampleCommand"
, c! \7 g: i* q. I& y* h/ {; k mnemonic="S"7 t0 l3 d: [. ^$ j1 u1 T
id="com.plmhome.createFolder.menus.sampleCommand">' w% Q9 j% P% X r2 s" m( h+ V
</command>
$ [: i5 V/ K9 _% b& T0 t1 K1 g9 z </menu>4 v# {* E. t2 C S! }, M' Y9 b' n: l
</menuContribution>
, k4 ^' L" K) }& ]+ ?) l1 J, E( I+ I% d- D) v/ P' F0 J
(5)指定位置,直接加按钮
$ y; x- S3 O4 f' d' t) N <menuContribution) q2 q6 D- Z0 I7 ?5 F) [7 R
locationURI="toolbar:com.teamcenter.rac.ui.views.DetailsView">
+ ?6 N) C C2 [4 ^9 C <command) c" p4 s& d$ H! n5 c
commandId="com.plmhome.createFolder.commands.sampleCommand"
: x; T$ ~4 Z% Z2 u# u icon="icons/sample.gif"
4 X- p7 M3 K8 t9 }* M) d tooltip="Say hello world"4 X9 s D- ?( v( R6 o$ Y
id="com.plmhome.createFolder.toolbars.sampleCommand">
6 n, t4 b$ s( M </command>' x# g' Q2 Z. M1 m
</menuContribution>
2 [/ @( V( O: m+ M9 M1 {* L4 [( j8 S, b& R
(6)加工具条按钮3 e q5 i6 v+ t9 ^! C' }
<menuContribution
n# ?: \& d# @+ s6 A g locationURI="toolbar:navigator_Toolbar?after=additions">
9 o+ _* v# L( Q/ P. e$ O5 n/ | <toolbar
/ P3 W9 C7 r& a, | id="com.plmhome.createFolder.toolbars.sampleToolbar">, c" X( r' |( i0 K2 u" F
<command
( E% k& j0 X; ]+ M F commandId="com.plmhome.createFolder.commands.sampleCommand"$ X0 ^! L6 h" S' U1 y
icon="icons/sample.gif"3 Z/ d. C- k, v: ?4 r$ w
tooltip="Say hello world"
0 @& }5 y# t% b0 a+ U. u4 x2 Z id="com.plmhome.createFolder.toolbars.sampleCommand">
. L7 o! `& I& |! W/ { </command>' n$ O# ]7 A) N5 A0 \
</toolbar>4 Z+ `/ w/ A" U# k; n+ p' U
</menuContribution>! |( t" t: D6 I9 B7 S+ _5 S
( p" o: w/ b* @0 {: x
+ R2 e7 q8 V/ C! v: M2 I完整的例子如下:" A, g# e3 F8 _/ f) P# M( B2 k
' A# a0 q {7 F% p<?xml version="1.0" encoding="UTF-8"?>
- ]4 ?9 F3 h6 V" {; ~- A8 }<?eclipse version="3.4"?>
9 W4 L( B w3 y% G<plUGin>: R; K% b, c; l# `! O
! c3 \# Q7 t6 f" ^6 R <extension
0 Y N" K6 J$ w0 a point="org.eclipse.ui.commands">& [2 l, P1 L8 J- O3 }
<category& X( T; ^- C) ^
name="Sample Category"4 H8 B0 C' d9 J& \
id="com.plmhome.createFolder.commands.category">
1 ~0 i; L' Z% g& K3 ^ </category>2 v' n9 Q3 W6 Z9 H3 f% k$ |
" p3 k& p/ |& n
<command
& F' v, R; P) g1 g/ W9 D F& ^6 t( ?: e name="PLMHome CreateFolder"
, V7 f; `: e7 ]) V8 W6 \ categoryId="com.plmhome.createFolder.commands.category"
* U/ W+ H3 Z) P/ ~8 Z/ d id="com.plmhome.createFolder.commands.sampleCommand">
" f; j5 j1 x2 x S </command>
/ `$ x: ]2 S; _7 o4 m' V0 f9 C% ]1 ~
</extension>, W2 K' v6 U* N y8 ~
<extension) O2 k) G7 j2 F5 C0 q
point="org.eclipse.ui.handlers">1 E, _" U P, S a. y% `
<handler
* a2 {: n6 ]- b$ L m commandId="com.plmhome.createFolder.commands.sampleCommand"! t; I* M7 r, W
class="com.plmhome.createfolder.handlers.SampleHandler">
+ p7 J4 }* i- `. y% K7 `3 n </handler>% W; f% `9 Y7 f& Z2 R
</extension>
9 r" Z: S. h) R2 s3 M% P/ H4 W <extension1 q$ |! x" I' W2 j6 j* d; W
point="org.eclipse.ui.bindings">
" H" t+ _, s% P4 d7 e <key6 e8 Z; p1 ] L
commandId="com.plmhome.createFolder.commands.sampleCommand"
; O9 E/ o' B$ R+ u: H9 t& l contextId="org.eclipse.ui.contexts.window"
; T4 T) R( w: k; v- w sequence="M1+6"' _% c6 B- f) r, H6 w) A, \
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">! o1 w. W9 N. V4 s# D1 s9 L7 Q/ [- _
</key>
H( b% [: T/ M. x </extension>. z, ^" {5 P$ Q# ?2 q& n5 i" g; b
<extension* H* Y6 R) R4 C- s# |
point="org.eclipse.ui.menus">* j2 p1 ?% f H! I4 i h) F8 g3 S
2 X. a+ {# d+ h <menuContribution3 M& I0 L) G- v+ A
locationURI="menu:org.eclipse.ui.main.menu?after=additions">: f/ n& p9 b; v- \0 I8 m2 j
<menu id="com.plmhome.plmhomeTool" label="PLMHome ToolKits">
0 z# D' C' U. p% u$ p: X6 i <command$ n9 C" h6 t+ O- T0 B
commandId="com.plmhome.createFolder.commands.sampleCommand"
. A2 e s) j; E mnemonic="S"9 M8 _6 A* M4 x! Q9 C# y9 I5 A
id="com.plmhome.createFolder.menus.sampleCommand">
9 c/ k6 j" B% O' E8 L </command>% B. q2 y) W) H8 e4 r% g# ]3 x
</menu>
\5 D5 r q4 D$ B$ s# o5 @% r </menuContribution>
4 @, P, q& T& P- R" j" x( T- y
- w) D: v; ?: N/ A* C* Y2 h- U I! Y0 j/ Y/ F( r
) _; j& G$ W5 s9 _
<menuContribution. z0 f, H- C" F/ B- ]0 Z8 _: ?. ~/ j
locationURI="menu:tools?after=additions">4 Y% ]* ~3 L3 K4 [) _; E; m
<command
: {- Y8 E% r( p5 n) b' i commandId="com.plmhome.createFolder.commands.sampleCommand"$ G% o7 x* i" f; X
mnemonic="S"# a4 K l% m' t+ A, S0 a u4 ]
id="com.plmhome.createFolder.menus.sampleCommand">
3 S+ S$ i- C9 M( }' [0 H </command>- F5 s# s4 w( G3 t7 H
</menuContribution>6 w# G5 B* [/ l: O9 J3 C( ~/ D3 A$ f3 K
5 V# e0 Y7 _" W" k; F, }5 x
% M r$ N8 b# f( G( p" g& Q
8 n* j& W# i$ l: y3 E2 {- o
<menuContribution
4 l) N* s1 q) x1 G+ l1 e5 Q locationURI="popup:org.eclipse.ui.popup.any?after=additions">- h- B! b$ x3 s- }/ E( G/ G
<command( v$ b% Z) o; ~) ?7 P
commandId="com.plmhome.createFolder.commands.sampleCommand"
7 Y3 L4 g/ |# l: x# y) c mnemonic="S"- q$ p8 S* m0 K3 @
id="com.plmhome.createFolder.menus.sampleCommand">2 n" m& c2 u3 h; f% a* `, Q# t( U
</command>
. k3 s* T, t/ X) t- b" x </menuContribution>/ n; z% n3 f, ]+ M
! \ ~- f y3 Y; L) `5 k9 H/ O3 b <menuContribution
0 \3 A6 j1 S/ v0 u9 ^# x9 k8 l" f locationURI="menu:com.teamcenter.rac.ui.views.DetailsView?after=group4">8 P5 y* J- \) ^, y9 C% f
<menu
" P2 P% |( }' e" _! f( I label="PLMHomeToolKits"
8 u& c& o3 l7 U) Z. d- N% p2 _ mnemonic="M"6 r: s9 @! U- X$ [; r
id="com.plmhome.createFolder.menus.sampleMenu">
- Z. W1 h6 R1 q+ f- ^' H <command
( `. Z$ n& Q- a" S( F+ ?1 i commandId="com.plmhome.createFolder.commands.sampleCommand"
" v. {* s4 ^. O/ F* O mnemonic="S"
* L% P0 i( B& t id="com.plmhome.createFolder.menus.sampleCommand">
& ~( p$ o" g" S2 g" ]+ W& [* G1 z </command># o N3 ^; b V7 ?+ q
</menu>5 q8 i. e. n+ s0 n8 y+ f @8 L
</menuContribution>
& K+ C; ~8 @% K. ?
+ ? q! E! Q+ |" W) [ <menuContribution ^3 i" y5 s* Q/ I% B3 y
locationURI="toolbar:com.teamcenter.rac.ui.views.DetailsView">8 j" S- `! A) t7 ^
<command, o$ w1 x$ ]7 a3 d! }
commandId="com.plmhome.createFolder.commands.sampleCommand"
+ q! C! ^5 e* l3 n& J# r! [: l5 R icon="icons/sample.gif"
4 j) E+ y% E8 V9 d5 ?4 |7 N6 C tooltip="Say hello world"
, O8 h1 E ^' t# _. M3 v id="com.plmhome.createFolder.menus.sampleCommand">8 q! Z& v! L9 p4 f& u
</command>
2 ?8 z) J" D6 a0 \" f* g* G7 f9 B </menuContribution>
% }6 w& x* V c5 n6 M* Y) x- G/ C
# t2 m( Y3 E1 f6 M% w <menuContribution
; t5 R, _: L3 g4 c1 L locationURI="toolbar:navigator_Toolbar?after=additions">
$ T# Z8 l8 ^4 }; A <toolbar
$ }7 E* E4 i: r" G/ m, W id="com.plmhome.createFolder.toolbars.sampleToolbar">
5 V/ R- P* D/ S2 O <command
+ M- V7 y5 ^$ Y commandId="com.plmhome.createFolder.commands.sampleCommand"( o$ s/ Q6 M1 {1 E
icon="icons/sample.gif"9 }9 `2 p' S% i+ B! [: Z! p5 H; h* H
tooltip="Say hello world"9 W% B) J% m% V$ }- `4 g; D
id="com.plmhome.createFolder.toolbars.sampleCommand">
+ z3 O8 F. p/ e% t </command>
9 l5 P) S$ o8 A5 l' X5 Y- F$ D4 k </toolbar>
3 [' Y5 \4 Y: V# X: k [, R </menuContribution>5 A6 M3 |# M" J; e0 R' w
/ P( W @3 _. V, {7 W+ f. Y
e. p2 U, T/ A. J" `0 ?, M </extension>' U# f. ]1 A, V: @7 d3 Z+ X; ]
4 \' X+ D6 w+ s( i5 E</plugin>
/ Y1 |9 J) g/ g' A0 {. c0 g* P& ]+ ~* U5 z+ l
9 l) }* S6 @7 M4 C ~" J( ]1 d+ [2 `6 Y" I9 Z, y: ^/ l" d
|
|