|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
【Teamcenter胖客户端开发】teamcenter菜单添加图文教程<1>5 m0 t/ B, H: a% S! f; r) T
这部分内容实际上是eclipse的插件开发的功能, 这里做个简单分类,菜单文件的扩展点都是 <extensionpoint="org.eclipse.ui.menus">,添加菜单就是在这里面添加内容。这里只要注意location即可! H& _' E' P7 n# p4 a
(1)在主工具条上添加菜单。4 U4 l, ^' `9 j, L5 ~" C. h
<menuContribution
6 K* {+ b: g1 T' i' K X$ e locationURI="menu:org.eclipse.ui.main.menu?after=additions">
, l$ f$ P! u; B' ] V; t <menu id="com.plmhome.plmhomeTool" label="PLMHome ToolKits">
+ g |, {0 l* G8 K <command
$ @4 _5 G9 T, X! ^ commandId="com.plmhome.createFolder.commands.sampleCommand"
- @4 X& a3 q/ q& r, E mnemonic="S"
' c7 a5 q# V G# X$ _; L* ^ id="com.plmhome.createFolder.menus.sampleCommand"># d! p ~! d0 W o. g
</command>6 l- i/ S9 @7 q7 C: z3 M
</menu>
# f1 m% @% p" _4 j, f </menuContribution>
) i0 {0 ?, K! p: v! E9 S, C" c! d1 U
(2)在工具功能的后面添加按钮。
; h3 S" H1 V/ u8 D' r5 ^' Y <menuContribution9 T6 f' X- c* A- P. O, ^& O
locationURI="menu:tools?after=additions">5 n) ~, U L; @, b6 V0 z4 r) R
<command1 x [, a: d; x& _% g
commandId="com.plmhome.createFolder.commands.sampleCommand"
( Z6 V9 f5 z3 S* L4 X: D4 p; ` mnemonic="S"' V3 J2 j& H# N* `
id="com.plmhome.createFolder.menus.sampleCommand">
* t$ @3 A. t+ \+ i$ H </command>+ O+ S7 H2 `/ a; B/ K
</menuContribution>
F% V4 y7 d' s# G5 X$ Y$ d5 r. B. ^' F
(3)在右键弹出菜单加按钮3 z! r4 Y' ?! T4 E
<menuContribution3 z2 {" b6 S; c5 t3 C
locationURI="popup:org.eclipse.ui.popup.any?after=additions">7 `5 ?# l$ t6 ?* Z
<command
( U0 v7 x3 }; i, v! T; C commandId="com.plmhome.createFolder.commands.sampleCommand"
2 w* }) C" m+ `. V% k1 d mnemonic="S"" @$ x9 {, c7 t6 F5 o
id="com.plmhome.createFolder.menus.sampleCommand">" Y* H! Y( n( q* E! x
</command>) ^. T- d' ?$ u7 I+ x
</menuContribution>. k" |& i: v2 `$ [) j3 Y
(4)在具体的菜单后面加功能按钮
5 m) C; P; J# I- B. j <menuContribution
8 }, i& \5 x4 i( S) [4 W locationURI="menu:com.teamcenter.rac.ui.views.DetailsView?after=group4">, ]4 @' J, [. u2 J- t7 D4 S
<menu7 J' z. T7 |& r; \
label="PLMHomeToolKits"( F" W& e$ M4 i8 r; T, ^2 c
mnemonic="M"
7 Q9 f0 n8 z) S1 z1 g9 B1 d id="com.plmhome.createFolder.menus.sampleMenu">; P: R; i6 ` O d4 J: k) Q
<command
/ U( C4 ]- m$ j7 F9 I0 R commandId="com.plmhome.createFolder.commands.sampleCommand") K2 D+ d- { H8 D3 S& P
mnemonic="S"' F( [$ o3 V9 m5 u: s
id="com.plmhome.createFolder.menus.sampleCommand">
0 F9 z# _4 C) j! p) H </command>7 { }* v4 t' a) ^4 G/ f
</menu>
6 L8 \7 O. M& M4 R/ f* P </menuContribution>
$ B2 c9 F, i G8 c( A0 c* {$ Q: P% r; n# p6 k" t1 X5 }& c3 b
(5)指定位置,直接加按钮$ `- H4 ^* @% Q- E6 m9 v/ w$ f
<menuContribution, H8 p0 m0 G: l9 y, S) P2 T2 q
locationURI="toolbar:com.teamcenter.rac.ui.views.DetailsView">/ P8 @6 s8 Y- A
<command8 T7 B* x, S6 z9 }% }' L' U
commandId="com.plmhome.createFolder.commands.sampleCommand"
! L+ M/ q/ ^9 I% e7 E# N! i icon="icons/sample.gif"
* @ {' t3 j1 ?: ? tooltip="Say hello world"' ?, G, \0 X1 ?' G" Y$ H; c
id="com.plmhome.createFolder.toolbars.sampleCommand">' g# E \8 h4 l9 J, e
</command>
. T2 E$ o' e& g9 r; L8 T. J! B </menuContribution>
1 ?0 p+ v4 r0 ^$ ^/ R/ G" t" N3 I1 k" K! g% z+ D1 C% m {
(6)加工具条按钮2 Y! d: V; G% N: B5 r) Q
<menuContribution
) J# E0 A# [6 ^, X4 H2 u locationURI="toolbar:navigator_Toolbar?after=additions">; v* [" J1 h; x
<toolbar2 Z( | V5 @0 _4 u
id="com.plmhome.createFolder.toolbars.sampleToolbar">
& I, {: ?" h. s: G' s: k8 T <command
" ?) {( F- H- K- y3 @ commandId="com.plmhome.createFolder.commands.sampleCommand"
9 s9 C: `% R* O* z1 g# K icon="icons/sample.gif"
3 e; D( s, J1 }7 ` tooltip="Say hello world"
; o, [9 u6 ~* H id="com.plmhome.createFolder.toolbars.sampleCommand">
1 l _7 l/ j, m% P. B t1 V* y </command>
* k( S. V4 j) g0 r' G </toolbar>: y1 a$ L$ n& c- r4 ^! n
</menuContribution>- Z) `. y9 n/ j8 O6 ]( Q2 {6 F) E
0 V0 u* w" K) \" e" e
" z) h6 o5 P5 B! |: o u
完整的例子如下:" q( P) P0 W$ Z% O. r4 u) c; ^! j& j: m
, \" r6 M- W/ \! |<?xml version="1.0" encoding="UTF-8"?>2 k& e5 L4 \( ~. q: S1 k
<?eclipse version="3.4"?>6 U' O4 ]9 a) Q
<plUGin>
% |) Z# c! `' N# d
# I x/ \4 H6 z. y* n, w <extension9 A% @( U& f+ z$ v, H% z4 c
point="org.eclipse.ui.commands">
9 ^3 K- G$ G8 N2 Z8 x& d <category1 ]. D: W( e# R T. P
name="Sample Category"
P+ X# H( i8 o4 T- F! Q id="com.plmhome.createFolder.commands.category">% a0 ]# c( j" s/ |$ l9 G
</category># E- R4 |1 D4 m8 ^; }
, j& e0 b. d1 r3 s; y <command& f# }8 Q' H+ ]
name="PLMHome CreateFolder"
+ i( S# i" P/ B# ^& I categoryId="com.plmhome.createFolder.commands.category"2 P6 b5 N+ @0 P( L8 D
id="com.plmhome.createFolder.commands.sampleCommand">
& b' e) l& \ G2 D8 ^" Y </command>
3 u c) v: Y4 _) U9 H0 l6 K: }& F3 M) I3 L
</extension>
/ m% Y# D( ^3 q( G0 A <extension( f# Y6 [% ~) A/ F- x Y
point="org.eclipse.ui.handlers">% C/ B' M. l" L' m
<handler' s% X0 q) p$ H+ l
commandId="com.plmhome.createFolder.commands.sampleCommand"
* z# A; |) D; E! A# | class="com.plmhome.createfolder.handlers.SampleHandler">/ t* S4 L3 g3 [" T. [
</handler>+ W* ?" N$ U! M. ^% ^5 p0 T
</extension>/ G2 Q# o0 l" Y5 ~% R
<extension( K$ o) ] L2 w9 e1 f7 Q; o$ E' _3 x
point="org.eclipse.ui.bindings">9 ^, a) I, l" T9 V3 M( ~
<key+ e1 K% L3 I+ @
commandId="com.plmhome.createFolder.commands.sampleCommand"
$ Q; P+ W* \7 Z6 D# @* r contextId="org.eclipse.ui.contexts.window"* R) Y& c* ~4 `4 s2 B$ ]* ?
sequence="M1+6"; Z! F6 e% L# `" p$ ~: Z+ Y; w/ e$ l
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">5 L' G7 l' f& c8 j7 K1 w
</key>2 d4 \, y8 q. n. U0 Z9 z1 @# C6 W
</extension>. X6 M8 T- F1 A; @/ C8 E
<extension9 K+ }- S( |# b9 G G8 N
point="org.eclipse.ui.menus">
* O& s* ~& z) i! J' _$ @% @" X% M: F- L
<menuContribution' }6 n; U8 @# D j
locationURI="menu:org.eclipse.ui.main.menu?after=additions"> Q h+ N) S8 {9 V1 g" i
<menu id="com.plmhome.plmhomeTool" label="PLMHome ToolKits">, D) W+ n6 X* H% S y
<command
( ]6 k7 }& ^* ]9 }) L! e commandId="com.plmhome.createFolder.commands.sampleCommand"
( |4 Z) ^6 s% v mnemonic="S"5 A% o. ?; m, h
id="com.plmhome.createFolder.menus.sampleCommand">
; d! L/ L" b( A& Y </command>
) \% Y2 d. l& [/ R# Y9 i </menu>8 F" e6 l B5 R% @, ?$ m* e4 r; o
</menuContribution>
- R' E3 z1 E& B% u. h) N! |+ q$ h. @
" P4 Y/ p5 Y% g. {( G
& Z2 Q& J: H. h% x
<menuContribution+ U3 V/ `4 {0 y. }2 Y
locationURI="menu:tools?after=additions">
7 n0 \2 H* n5 F8 c8 j$ Y% S2 z' g+ x <command
0 W* Z( \! l7 f0 d# Y commandId="com.plmhome.createFolder.commands.sampleCommand"
# p$ ]5 i* h; P! G3 R, D% M/ l5 l mnemonic="S"" t! m" S( r& {1 s/ k4 R8 g
id="com.plmhome.createFolder.menus.sampleCommand">, }+ ^% a6 o5 S
</command>
3 w& B3 i. s6 D. i' q, P3 d7 z, o3 F </menuContribution>
7 H$ }! f9 f1 C; ~& U# @% X" o4 _$ X, E4 o x5 w/ A
) l. u) n. J% K3 U
2 h8 Q5 `. u* I; `
<menuContribution) ` t( h% F# Y' j9 @$ e+ ~$ _
locationURI="popup:org.eclipse.ui.popup.any?after=additions">
7 a7 ]9 G U* L <command7 h5 c: b& r* c' B
commandId="com.plmhome.createFolder.commands.sampleCommand"- V4 H, }1 [" n1 ~
mnemonic="S"9 g, K z( {' X: A
id="com.plmhome.createFolder.menus.sampleCommand"># G2 U% O& J, Y/ Q6 s+ \! M
</command>
2 {! B% y6 l9 e5 v# R- I </menuContribution>
% \" [4 m) x: P4 l; F' |. }9 T+ g9 v: R: l( u! e- i/ @
<menuContribution1 ?: T7 v2 C; M0 j! D0 z
locationURI="menu:com.teamcenter.rac.ui.views.DetailsView?after=group4">, ?7 ^4 E0 @: Y, K2 m8 M5 u& Z
<menu7 z& @0 k& i4 V5 c
label="PLMHomeToolKits"
) ~, M' T, ?& m% w, D mnemonic="M"' F- ?6 v/ N6 ^! d# ~
id="com.plmhome.createFolder.menus.sampleMenu">
6 s w6 P' Z! W/ Y7 e <command8 R1 u" {' Y) T4 _* x
commandId="com.plmhome.createFolder.commands.sampleCommand"
* ^/ j2 H" U# K3 M% I& B8 x mnemonic="S"; _2 z7 c* s; s8 Z4 J$ |9 P( c4 J4 T- q
id="com.plmhome.createFolder.menus.sampleCommand"> S" o, b* v5 }2 [/ Z6 ~0 H
</command>
0 ^4 C) H3 e0 [3 F9 R7 X </menu>
3 Y: n/ L7 @5 M# k L0 V7 z- l+ F3 f </menuContribution>, R- D0 Q% t) p7 d8 ]# G% v
2 h( O' l6 H' H8 ^2 H9 b
<menuContribution$ C e0 |/ V) A: Z' d. L: r2 g
locationURI="toolbar:com.teamcenter.rac.ui.views.DetailsView">; c8 _/ g! y$ I. ~
<command6 u6 {" \: f, v2 O* k4 K6 D
commandId="com.plmhome.createFolder.commands.sampleCommand"
4 `& ?9 H. e R: m0 u4 y" ~ icon="icons/sample.gif"
2 k5 X. Y, K; }8 M9 }; J tooltip="Say hello world". x7 b9 u4 {0 k) G
id="com.plmhome.createFolder.menus.sampleCommand">
% s" O4 [# ^ f2 D3 K. u/ D& C. ^ </command>' @9 N0 s/ f# b( o
</menuContribution>4 _# y5 {$ i! t6 _9 e! u' Y4 |
5 s# z" F! r' s* H: |4 R
5 d* W6 }5 t" Q- p <menuContribution
8 H$ T* t- m/ F& q; J& Z4 q& L$ D locationURI="toolbar:navigator_Toolbar?after=additions">& _8 M) t. f/ E. l& c
<toolbar
2 k. D: i" Y a id="com.plmhome.createFolder.toolbars.sampleToolbar">) n8 K3 i0 t! [: |
<command# ~& m! S' |+ h2 k& }
commandId="com.plmhome.createFolder.commands.sampleCommand"
* h1 K) K% f6 o) I) E2 _ icon="icons/sample.gif"
3 ?/ X; }' A# M2 u1 `" J tooltip="Say hello world"1 O7 V+ [7 I' N# a2 r
id="com.plmhome.createFolder.toolbars.sampleCommand">
- y1 R! X. Y( w" b' Z3 R s </command>7 ], c: E# W5 i
</toolbar>7 q) [2 I. e) g3 o' M/ S4 K. H
</menuContribution>7 s5 S J) \3 p, M% X7 S9 P" d: p( L
% G& ?8 O& U( e+ g. O
2 \+ [ U* |$ Z; l </extension># p! m, S$ t" s! Z
' G8 y5 [! }% P. l# m. ^</plugin>
U3 |/ a, F! S: H) O' U
" L* ~% n5 A' Q4 M1 F; \' {8 W, \, \3 O4 d. P
& g/ A% a! W* u3 d |
|