|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
×
【Teamcenter胖客户端开发】teamcenter菜单添加图文教程<1>
' Q* t2 @ b9 p) }4 s这部分内容实际上是eclipse的插件开发的功能, 这里做个简单分类,菜单文件的扩展点都是 <extensionpoint="org.eclipse.ui.menus">,添加菜单就是在这里面添加内容。这里只要注意location即可!9 W, t/ K% w$ {$ X5 p; ?
(1)在主工具条上添加菜单。/ D0 X0 k. ~% J" t1 d7 I+ H
<menuContribution2 i5 w/ ^( ?; j# i _" ^
locationURI="menu:org.eclipse.ui.main.menu?after=additions">3 ?9 x8 c' C- S7 O
<menu id="com.plmhome.plmhomeTool" label="PLMHome ToolKits">
* T7 Z8 X- M3 V+ X <command
[8 t/ y2 K9 ]' Y" j commandId="com.plmhome.createFolder.commands.sampleCommand"9 k" a6 B: A1 J" v' g: o
mnemonic="S"- ?7 G- B' U' x; O1 I
id="com.plmhome.createFolder.menus.sampleCommand">
: m/ e5 S: m0 \0 x </command>9 y$ I& f4 Y$ r! O5 n
</menu>
0 r2 t0 v- E+ H4 ], P7 O7 s </menuContribution>
" ^ j7 t2 L+ z) U; y$ Z9 h- s- I+ f5 C5 P V7 ?* e* {: D
(2)在工具功能的后面添加按钮。7 ]/ m0 j5 x8 u+ P, b7 }
<menuContribution& B+ H+ d$ w4 e
locationURI="menu:tools?after=additions">% O/ X8 s0 N; \6 J! u
<command
% i# H; u1 z) \5 F6 z commandId="com.plmhome.createFolder.commands.sampleCommand"
9 T1 B" y3 n4 P; X1 r mnemonic="S"' w$ x+ P$ n' K2 ?" V8 v
id="com.plmhome.createFolder.menus.sampleCommand">1 D* m! z$ S' U- ]9 q7 V T* `
</command>
. p0 M; k; ^8 P" }& S7 _& @ </menuContribution>
' [* M; I( z6 x
4 L8 O' h) q. K2 y+ h! w(3)在右键弹出菜单加按钮
8 c7 O$ }9 b" i2 R& @8 a$ w4 Q <menuContribution" P9 Z3 G! u* ^6 c# S; \0 Y5 _6 z" |
locationURI="popup:org.eclipse.ui.popup.any?after=additions">
7 Y( A8 x' E% X3 o, `- o <command
4 M% Q/ W5 a" p commandId="com.plmhome.createFolder.commands.sampleCommand"0 V, F" @9 P+ V- Q- Q
mnemonic="S"
* Z8 {+ m9 J! S4 F$ l7 G. s id="com.plmhome.createFolder.menus.sampleCommand"> @/ J/ o! ? E' |8 C: W8 u
</command>
& {- @$ I8 S. x$ K8 a </menuContribution>% ^' x$ T3 I+ g
(4)在具体的菜单后面加功能按钮
; O$ a% ^/ J: h& j" I& ` <menuContribution
4 r1 u8 M+ b$ G2 D L locationURI="menu:com.teamcenter.rac.ui.views.DetailsView?after=group4">/ E1 O& l3 M, [9 L/ T
<menu; }. R6 Q5 `* a3 Y/ h: L
label="PLMHomeToolKits"
) h* `, S: X! C+ q1 S" V mnemonic="M"* J$ I3 F4 X$ ~/ q6 A2 Z
id="com.plmhome.createFolder.menus.sampleMenu"> Z b6 E/ u9 U& O% k. @* {0 T
<command
% B8 S" T2 R# T+ C) G4 A+ q- h commandId="com.plmhome.createFolder.commands.sampleCommand"
' X& x) l5 x# N+ T mnemonic="S") {: f1 m0 r; _' \# ?; q. Y9 i
id="com.plmhome.createFolder.menus.sampleCommand">
6 K. r. w# j7 u; T </command>
( N7 S9 I) L* q p2 y- q </menu>7 V2 [) J5 G0 }, z
</menuContribution>6 l6 _, n! C5 i9 U2 D6 {
: M5 i, t" T \; |
(5)指定位置,直接加按钮+ o4 D" p1 G% s
<menuContribution
' V. _: ?0 r2 K1 R3 G( r locationURI="toolbar:com.teamcenter.rac.ui.views.DetailsView">5 q5 @/ j" n7 u+ p( _( P
<command
6 J& }1 G5 I4 C2 E8 \( h& M commandId="com.plmhome.createFolder.commands.sampleCommand"
7 l4 ~+ B" V* f& m6 Z" ? icon="icons/sample.gif"& j( t; W. L# M# L* z5 q/ A
tooltip="Say hello world"2 o! l, R, ]. c/ \
id="com.plmhome.createFolder.toolbars.sampleCommand">2 I# ]( h* r9 R1 R# s
</command>
1 g8 A: ^! l: L! F5 @0 c </menuContribution>( y' u6 q% t h( U9 p9 m8 P5 w5 }
, _5 c5 x, { \; s6 R9 k) T
(6)加工具条按钮
% @; ~3 _7 ^! s. f9 E" P, O. u$ { <menuContribution4 J( I6 u) U3 X4 B: p2 S: t
locationURI="toolbar:navigator_Toolbar?after=additions">9 ?! }; b2 ^7 ]
<toolbar! ^8 Q- b: E+ W
id="com.plmhome.createFolder.toolbars.sampleToolbar">
7 e9 a# n8 g8 m. M! [/ O2 H <command
- h1 X6 B# L4 s2 Z0 p z commandId="com.plmhome.createFolder.commands.sampleCommand": V! D" i. c2 ^& Q9 A" J
icon="icons/sample.gif" Z0 p( k5 n; j3 j+ \3 q% f
tooltip="Say hello world"
" W3 M& T c( v- n4 Q id="com.plmhome.createFolder.toolbars.sampleCommand">
* b1 l1 q' o/ Z </command>" |" K( u$ u( _( K2 A
</toolbar>6 }4 Z" q% w) p- m& o
</menuContribution>
/ \1 w) W h$ X/ B- r) N0 J
$ J0 c( P% m1 O! j# V/ ?6 D" C9 L i# c! h6 G, X" i
完整的例子如下:
6 d; ]2 _* e8 X. P: B
: V A- b" c# x<?xml version="1.0" encoding="UTF-8"?>
- H c% h4 |! T: o X$ _8 q<?eclipse version="3.4"?>) y$ M) q0 p3 Z+ ]0 |9 N+ u9 D
<plUGin>
* P5 X- |4 e" b7 ?; U6 {* A) d5 z% ?3 _0 c$ M6 O3 J
<extension5 \: X+ T0 T! J; T0 i" O
point="org.eclipse.ui.commands">& Z( S! I0 C& Q0 B {+ S
<category
/ G" V3 h1 g) q% j' `0 c0 g name="Sample Category"+ e1 h* ~, G/ u) h) [
id="com.plmhome.createFolder.commands.category"># a. ~: }8 w4 x2 A' J" S
</category>
9 w' s- H/ X: y) e1 H
5 s+ c8 v0 S" a: q0 ]2 t- g <command- j+ F [" d! B
name="PLMHome CreateFolder"8 c+ v# t, t4 q+ H0 p6 S S+ A
categoryId="com.plmhome.createFolder.commands.category". Y6 a6 _$ V- E8 n* U
id="com.plmhome.createFolder.commands.sampleCommand">7 _7 \: E) b, g. C; z( p) C
</command># j1 P3 C O }' i! k
+ ^* G# v2 d7 k3 }7 u
</extension>
. W! E' M" C: J7 [$ F3 y <extension
+ l! l8 q$ m% U& G, [+ O point="org.eclipse.ui.handlers">/ K3 g* t8 k% d( Y2 t. M' p5 s
<handler7 Q1 c- \, h; x! h/ u6 A* f) i
commandId="com.plmhome.createFolder.commands.sampleCommand"
) F+ M, H$ u6 U. \ class="com.plmhome.createfolder.handlers.SampleHandler">5 @* s& [* e: h( n6 E6 L
</handler>5 X6 t2 N: d5 q' u+ b
</extension>
g, G4 p3 k( h! [. l, ?; \ <extension
$ ?0 G* |; r4 u) ] point="org.eclipse.ui.bindings">
6 [8 K- W& i ^4 }+ z/ s: ]# Y <key% t" N) n8 _" c# x
commandId="com.plmhome.createFolder.commands.sampleCommand"7 _5 R0 L1 @# V0 }6 H# K/ ?
contextId="org.eclipse.ui.contexts.window"
! l$ Y. }, z- T! e sequence="M1+6"; |& L& M S! u4 y' [+ m u' V5 W
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
# |" m: s' a9 ^6 M% \ </key>0 w/ t6 ^5 d& n% p4 H1 \" Z) e
</extension>5 t$ Y' G+ J# K8 N7 ^
<extension
4 o" I% b( J5 t9 a% H( T: a! u7 p5 N point="org.eclipse.ui.menus">
4 ~ X, i$ ?9 g F4 Y3 i2 V; ~5 l' d: W
<menuContribution
4 x# Z: ~- W2 l8 `, w. y locationURI="menu:org.eclipse.ui.main.menu?after=additions">1 [4 O/ v/ f4 }) Q4 x" q* u
<menu id="com.plmhome.plmhomeTool" label="PLMHome ToolKits">
$ ^5 k9 M" O# P+ e <command4 ?: a$ f' J: v0 D4 M8 z/ A ~
commandId="com.plmhome.createFolder.commands.sampleCommand"
* F7 @, X B. v mnemonic="S"5 w- U8 c T/ [4 O2 w
id="com.plmhome.createFolder.menus.sampleCommand">) H" J1 q z, Z1 P& O
</command>
8 ?* s' o8 ^/ j: y8 j </menu>
+ V( z$ i H) k$ n& n </menuContribution>
, Z# |$ r: e5 D3 c: J8 y
# Y7 y' ?& J" R/ E+ u, N/ P
6 T k9 ^! ]" R+ T
1 z: F, U* v8 u/ b <menuContribution
1 B: `! J$ k9 B# l8 l locationURI="menu:tools?after=additions">
* }, a9 N" S8 {4 X" V0 P <command
4 O2 s( ]1 y8 B4 x3 R3 q' s commandId="com.plmhome.createFolder.commands.sampleCommand"% j8 S& U' m$ g' V
mnemonic="S"
* b+ H; x ^( W5 C: @ id="com.plmhome.createFolder.menus.sampleCommand">) V/ c. L8 v1 ]0 E; _% x5 S& D
</command>1 ]0 V1 @% D1 c! M1 _' s
</menuContribution>
* Z+ f6 v' C! a1 e
A. V$ ]; w C- H! l$ \
: y- i1 t- f/ C5 j
i" D; |' X: t, t <menuContribution
% t. x' o/ r" d$ y% f locationURI="popup:org.eclipse.ui.popup.any?after=additions">
) @+ V* J8 q' e) D1 o <command
7 ], j. b9 [) L6 b: l5 {) i; ` commandId="com.plmhome.createFolder.commands.sampleCommand"
, ~+ O4 D; ^: y, O mnemonic="S"6 `3 N; t, R* m2 D! ]/ Z
id="com.plmhome.createFolder.menus.sampleCommand">
* Y7 b1 t+ q3 a& `! X l8 ~& x6 | </command>
m4 ?- T9 \- A- Z0 p, V% C </menuContribution>7 U* u' \( Z" s& m1 g- f+ E
. S/ y/ P1 y4 _# M/ h1 l9 N <menuContribution& \0 r/ Y) g2 r
locationURI="menu:com.teamcenter.rac.ui.views.DetailsView?after=group4">
X- D. K7 e9 @# B2 } <menu* x9 [) G9 V/ c9 I* s
label="PLMHomeToolKits"
6 H" ^' I6 @& O( Z L mnemonic="M"* w+ [% N1 E5 p$ e6 i6 g. D$ G
id="com.plmhome.createFolder.menus.sampleMenu">
9 [% W) a/ N4 \$ s% a2 u <command1 V" Y s$ r8 W- m" ^2 |3 H, I# d0 x N
commandId="com.plmhome.createFolder.commands.sampleCommand"$ H& r! x4 B1 R& N& {# J, x
mnemonic="S"
" Y' q! Y6 A' T) Y id="com.plmhome.createFolder.menus.sampleCommand">& u* C1 Y/ p9 e7 A
</command>
7 b: W7 D, }( ~; M3 V; y0 H; N </menu>
$ Q: A O7 R8 c/ M e! ~+ f* ` </menuContribution>
5 |- Q2 z: w" [, N) G4 E; A2 `+ H* \" K& t
<menuContribution, h/ K8 c3 b: d4 u7 G$ g# F
locationURI="toolbar:com.teamcenter.rac.ui.views.DetailsView">
7 _) v* T7 v3 r- l <command
& ]$ [2 z( _1 h% L ^3 x, L commandId="com.plmhome.createFolder.commands.sampleCommand"0 ^1 ~* I2 k$ m8 W H
icon="icons/sample.gif"+ @6 \ K& w, m$ M9 w# v
tooltip="Say hello world"4 B2 H( Z3 p0 m
id="com.plmhome.createFolder.menus.sampleCommand">9 a1 v, w- O* L# F3 g- H }3 Z; }
</command># ~+ b' S% |) l, }- J
</menuContribution>& K, T9 A N1 @- e' l: R
! ~# p% }2 ]0 V3 v- S* v6 {
& K" E, q9 _8 o <menuContribution _$ S4 h7 c( B' O) O1 O
locationURI="toolbar:navigator_Toolbar?after=additions">0 z( u/ u- d8 H7 n5 U
<toolbar1 S8 u; Y9 H$ R0 b
id="com.plmhome.createFolder.toolbars.sampleToolbar">
. ?1 Z- c m4 O% z' v: o <command, I( I" ^1 n& n+ ^/ f0 [8 b5 B: g
commandId="com.plmhome.createFolder.commands.sampleCommand"
l6 Q6 t5 x+ X& P icon="icons/sample.gif"0 M. A# g5 i8 Q3 y) A3 j' o# |* z
tooltip="Say hello world"
+ D' W" Y# Z( J1 e7 F5 y# f id="com.plmhome.createFolder.toolbars.sampleCommand">0 |5 d S |6 N) F
</command>
' }/ P. C% }( A, ]+ X( E$ } </toolbar>
$ R! x, z' |' O- ] J </menuContribution>
/ I7 ?) u9 r/ M9 W1 Z% ?9 H; f% G# A7 I4 `
+ Y9 ?4 {% O' r7 p </extension>
: V1 T' t' Q# c' h
7 h9 a* I6 ~; P, X5 ^</plugin>+ D8 X6 C7 s& b) m2 V
/ j) v( z. Q: s t' N2 q
. i4 i) ^; s% v# M$ f! j: Z/ y$ m7 A8 M& l: a7 x" x I$ T7 V1 D
|
|