|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
【Teamcenter胖客户端开发】teamcenter菜单添加图文教程<1>
/ Z, Q8 O3 f; t: | H" ]" i这部分内容实际上是eclipse的插件开发的功能, 这里做个简单分类,菜单文件的扩展点都是 <extensionpoint="org.eclipse.ui.menus">,添加菜单就是在这里面添加内容。这里只要注意location即可!5 `$ T+ f, s$ _6 P
(1)在主工具条上添加菜单。8 a$ `2 l, T3 A- R
<menuContribution* c2 ^' d/ `+ t8 y0 {' Q# a
locationURI="menu:org.eclipse.ui.main.menu?after=additions">
! o& L0 g0 C0 t" l7 R: ?8 R <menu id="com.plmhome.plmhomeTool" label="PLMHome ToolKits">0 | c. W* O6 W3 o* j, Z* L( \
<command9 v4 P7 @" [0 m5 m
commandId="com.plmhome.createFolder.commands.sampleCommand"
3 d/ e; r6 {, L! N* V mnemonic="S"$ U% \8 ~4 p$ \5 x. M
id="com.plmhome.createFolder.menus.sampleCommand">
1 e r, j* ^3 |/ M/ e' O5 h) i </command>4 M. |* h# `4 l4 f
</menu>
! l9 }0 N% b5 ]5 {2 ^4 Q. V& L </menuContribution>6 i3 v! h- J8 H1 N- \
2 o" B1 G) ?2 f; E/ P$ b* q
(2)在工具功能的后面添加按钮。
9 e9 K: j$ U" C1 R8 n <menuContribution) E, J* d. H: A' ]" }+ v
locationURI="menu:tools?after=additions">4 f! G {) @2 m" }! v; i1 i/ [8 r
<command
; h. N0 L- u2 w$ K4 Z commandId="com.plmhome.createFolder.commands.sampleCommand"# P# D% v+ y0 [5 Z& P
mnemonic="S"7 f2 J6 A3 Z' H- A0 y, x
id="com.plmhome.createFolder.menus.sampleCommand">
3 t( R( @! F' K5 k: g' E" \* N </command>. S& L/ G5 [ X. K
</menuContribution>
/ S. g* A x# n/ r8 s
6 B( g4 D. T2 L: O6 i(3)在右键弹出菜单加按钮8 q- s7 \2 e7 p9 v3 H: ?4 k
<menuContribution
0 \: N7 k2 `( _ o5 s$ C I6 L4 j9 ~ locationURI="popup:org.eclipse.ui.popup.any?after=additions">
. O/ }# ?) i0 X9 | <command
% O+ z9 h6 A6 s commandId="com.plmhome.createFolder.commands.sampleCommand"
, a* h5 D. Y; z* n0 a: H# B mnemonic="S"8 I, c9 |' d9 S8 m1 O; P% ]
id="com.plmhome.createFolder.menus.sampleCommand">
8 g. K9 s: Z) n& W' R </command>5 d( M, f+ }/ q; g5 l
</menuContribution>4 U( w7 ~; q% W! U6 e- l& S0 @& H
(4)在具体的菜单后面加功能按钮# Y# |' p+ Q. @% F0 \3 O
<menuContribution
+ P: h u t+ t8 y& e: n( x locationURI="menu:com.teamcenter.rac.ui.views.DetailsView?after=group4">
- q4 p6 X h; y* Z3 E <menu& u1 ^' Q7 _, |/ I: G/ \& O7 X+ r
label="PLMHomeToolKits"
# d* e, x5 t' e; m" W) o mnemonic="M"
+ q( I. t8 v! }% Y( n& M id="com.plmhome.createFolder.menus.sampleMenu">% p% T; w9 u- H( R6 v' y3 h' _
<command
/ u/ w) y( M- s( F$ a: J commandId="com.plmhome.createFolder.commands.sampleCommand"# @& G4 P& d7 S
mnemonic="S"
1 }% S% x5 q8 G3 k" d# x id="com.plmhome.createFolder.menus.sampleCommand">
$ R9 o) @* b2 C4 y- x9 k4 E </command>! l. ^0 N4 ~7 S% w/ g1 P
</menu>* e: v& L; u. Z& L X4 R
</menuContribution>9 O2 a$ L$ Z0 w1 Z0 L5 u0 f( f
], r* v8 A: X7 Z
(5)指定位置,直接加按钮
3 O# v n k# L! K- R; } <menuContribution5 c1 {2 b# J( y0 C) G
locationURI="toolbar:com.teamcenter.rac.ui.views.DetailsView">
+ k9 O+ {+ s* t <command) i# D# O P# P, J7 w9 u9 t8 M. M( C
commandId="com.plmhome.createFolder.commands.sampleCommand"# R/ b( \4 d* D# p; |% h
icon="icons/sample.gif"$ A+ O: |. I7 u( I: O1 n2 V7 W
tooltip="Say hello world"( i4 |8 ]% b R
id="com.plmhome.createFolder.toolbars.sampleCommand"># V, I. G+ K# _6 b
</command>
8 @/ L3 e& ]% O: {& s; u- u </menuContribution>7 o( X$ E" o6 n6 i' S
" b: L! t! X# `4 W' m/ m! M
(6)加工具条按钮
5 P; ^0 w! x- ]9 q <menuContribution
, N. Y2 g+ k7 [# u/ ?) A A locationURI="toolbar:navigator_Toolbar?after=additions">: H$ ~9 u+ G* d
<toolbar
. ~0 J( k% a) P. [- P0 y id="com.plmhome.createFolder.toolbars.sampleToolbar">* ?7 O9 H7 E8 z9 g" \5 R5 C+ p) o
<command8 Z) @! o% F/ m* |4 o6 Q3 c+ H% v
commandId="com.plmhome.createFolder.commands.sampleCommand"
. t. K& s& x/ O3 ^ icon="icons/sample.gif") w1 O4 E& r { d
tooltip="Say hello world"
! _8 x8 t# T) o+ \2 t$ m" B id="com.plmhome.createFolder.toolbars.sampleCommand">
/ d! T9 d! ?. ?4 _* e8 { </command>; u7 x$ r0 v; a4 U8 h
</toolbar>3 ~/ ~! h% e$ Y. o5 _
</menuContribution>& \: `7 x4 c8 V/ ^
" o* x# [* x& z+ }8 J5 d: G
9 |: t/ T# o& w6 {; B! A4 }完整的例子如下:
; e2 c% k0 ?" K; p) u6 T _0 Q1 y# {# ^& |
<?xml version="1.0" encoding="UTF-8"?>
. [. p. `3 s {' U4 S' n, {<?eclipse version="3.4"?>
3 Q% H$ y3 e0 @9 i. Q: s<plUGin>
* s# G( y# U) }8 s' N, T% o2 [ C) k7 g4 S' x6 u5 s* B6 X9 q. i* z
<extension$ C% q# ^- J& U. ]
point="org.eclipse.ui.commands">5 ~ m% ~: B" Q6 [1 v0 T& f: {
<category
4 n9 N& R+ H8 L) i$ } name="Sample Category"
/ O3 z: m9 n3 i7 B: M) q id="com.plmhome.createFolder.commands.category">& ]3 \ @- e1 T. K+ l6 z9 g4 Q9 f: p# M
</category>
# m) q4 d G. Y- i2 F w/ ~
; g# j# X( P' l6 E- q <command5 |2 T+ v+ J* T% ^: o# v% ^( k
name="PLMHome CreateFolder"
2 n3 Y, N# r" Q* q9 [7 e categoryId="com.plmhome.createFolder.commands.category"
# ^* s: w0 R: L id="com.plmhome.createFolder.commands.sampleCommand">
% D% d) l0 ]5 [1 N </command>& ^1 R( N5 U5 V8 b( W! P% f
( R( ^% F: n5 @ J </extension>
' x5 R3 A7 \, R: W U' }8 A <extension
% @4 c- E0 b2 L" b7 R, `0 X point="org.eclipse.ui.handlers">
O( I( I9 M+ e: o <handler! M( t; h' O" C8 b
commandId="com.plmhome.createFolder.commands.sampleCommand"
# K% M& e/ P" T- i class="com.plmhome.createfolder.handlers.SampleHandler">/ @7 J/ _; Y- \- E% d9 a! _
</handler>2 U5 P! J$ |6 U( b& y8 u
</extension>
# l$ y7 T5 A( l ^ <extension
2 X* i" v3 ]" ~" c7 g, U: ?; l0 u O9 k point="org.eclipse.ui.bindings">
1 d& r; v# Z+ q U* t* L% X; b <key
; d3 U: K' G# I2 ?; f7 g commandId="com.plmhome.createFolder.commands.sampleCommand"
' z3 K0 ]9 d% i$ R& P* \! W+ W, ^ contextId="org.eclipse.ui.contexts.window"
9 w# L" E' S. Q; G A sequence="M1+6"3 k+ s+ F% K b$ Q% P, c; n @6 w
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">: a) ]6 }8 ^. D! s1 o
</key>1 [, P4 O+ M n" r/ r' }, E
</extension>
- b$ @2 J9 Z: E <extension: i* V+ v8 m2 E# I! ~, [
point="org.eclipse.ui.menus">7 `- P) ?1 u! n& L M
* E T% _7 A3 h; ~+ i! U
<menuContribution0 Q) c& v8 w" j2 U7 x3 `3 i8 A2 }
locationURI="menu:org.eclipse.ui.main.menu?after=additions">
: [% K+ I: U. u9 A, @* r <menu id="com.plmhome.plmhomeTool" label="PLMHome ToolKits">
1 k1 e6 L% J/ q2 ]4 | <command! \$ d1 w" {" d! z, a6 H
commandId="com.plmhome.createFolder.commands.sampleCommand"
3 z$ K% P# v1 t mnemonic="S"2 N9 Q& P6 R5 J1 f) @* j
id="com.plmhome.createFolder.menus.sampleCommand">
2 X% A+ H( b! z1 _ </command>
' u5 t- O3 ?5 A; J4 s4 J </menu>
! C% H- D( q" @1 q7 K) ` </menuContribution>7 d7 T) O' l$ d$ u; u
1 M4 f7 v9 p1 Z( n
, O, z7 |0 h9 @4 S, X7 w' r
( P. |+ ?' s% e8 G: ? <menuContribution
- R8 @2 [% d: D2 A% A* w locationURI="menu:tools?after=additions">
3 Y" p; \6 x U+ y) ^ <command
2 T7 b- r& t/ B- U7 O# T commandId="com.plmhome.createFolder.commands.sampleCommand"' P$ B5 p% l' C, J `3 c
mnemonic="S"
' F O# f4 V" a/ I id="com.plmhome.createFolder.menus.sampleCommand">4 X; O, C' v- u2 u; X
</command>
f3 A3 e, I2 t3 P </menuContribution>6 ^/ S0 b8 c* z U V1 j8 s, W
( p( P; D& t. Q( L6 w: M% F
1 ^4 d3 k; n# k1 u: v3 t* H. p6 M: y) \' N
<menuContribution) I' {: F l1 y- Z! B' v
locationURI="popup:org.eclipse.ui.popup.any?after=additions">2 m+ ]" [7 S! Z7 n( J! Q
<command% G$ w4 B ^' C9 @6 F. \ M7 ]0 j
commandId="com.plmhome.createFolder.commands.sampleCommand"7 J% H+ m; u0 r% p% O6 k
mnemonic="S"$ c2 e8 g; h& C, ^# M
id="com.plmhome.createFolder.menus.sampleCommand">" b* @7 C$ K( a) M8 x0 \
</command># p, P/ F) {0 p$ d9 b% U' c
</menuContribution>
2 U y9 |6 S2 H8 ]0 X; [, L) X! N7 w8 ?# O" J7 {- P! [
<menuContribution7 N: I& n, O+ Q' }* x' W# x
locationURI="menu:com.teamcenter.rac.ui.views.DetailsView?after=group4">
! W$ z j# f3 S3 J' r# j& z <menu
' [7 G' z& k! `' e3 G+ v+ m0 o label="PLMHomeToolKits"! I# X, E, E3 |( n4 z. [; K( R" _
mnemonic="M"
9 t- j* ]/ U6 F) H id="com.plmhome.createFolder.menus.sampleMenu">, ` n/ q7 y( O: ~/ r
<command/ f' q2 L7 G- ^0 u" r
commandId="com.plmhome.createFolder.commands.sampleCommand"
8 J- h3 W0 V$ v3 \. U. M mnemonic="S", t3 R. G8 u4 c
id="com.plmhome.createFolder.menus.sampleCommand">
, W' }: }2 o* P: c; `7 e </command>
- V( W3 o# _. o3 c }% n </menu>7 C% C) _1 T& h7 s7 N
</menuContribution>
) _/ M( m2 F/ t, U+ U; b. N2 @& x7 H) d6 ?9 G+ D
<menuContribution. J$ \% F5 ]; R% H) }8 V! W
locationURI="toolbar:com.teamcenter.rac.ui.views.DetailsView">
/ `/ r9 a# K* }! @) M <command5 d* l6 n7 U3 g
commandId="com.plmhome.createFolder.commands.sampleCommand"4 Y; J' d* D& o
icon="icons/sample.gif"
* D) N* E; O; V% Y tooltip="Say hello world"% v) A% j2 d$ [' ?" Q9 [. Z8 Q( {+ m
id="com.plmhome.createFolder.menus.sampleCommand">0 u7 t5 @3 l# Y! F: g& V5 C
</command>
8 ], t8 u; l3 E8 m# P& @ </menuContribution>' p+ g& ~% w8 _; M
( J# ]. ~. x$ G& G
* ?" g+ B( `6 I. ]; {- S& o <menuContribution
; _3 q* R6 }9 m1 x K locationURI="toolbar:navigator_Toolbar?after=additions">+ D( x. @ c8 g
<toolbar
1 @1 [0 }7 p( `. A, ~% K id="com.plmhome.createFolder.toolbars.sampleToolbar">
9 Q: [+ u6 a" W* O h8 Z <command/ @9 G4 N+ y6 S% v" K
commandId="com.plmhome.createFolder.commands.sampleCommand"6 f6 o8 J1 E; N$ o
icon="icons/sample.gif"8 X. c3 d B6 ]) W
tooltip="Say hello world"
8 h& @$ u7 A+ m( \/ g+ ]! m. a8 E id="com.plmhome.createFolder.toolbars.sampleCommand">/ p% E* n$ M0 p
</command>! W, W( O) b5 f# a0 V" i; k- N
</toolbar>
C* l: C1 ]) S6 c </menuContribution># e; h! h5 n g6 g6 H
8 U( o* S! Q* Y; \( Z& B2 ^
- V/ n+ t* c# c
</extension>
" e, X' `4 B+ ]* M9 g) b- ~' K& J2 x$ {! C# I- v
</plugin>
0 X3 W$ n( X6 T2 m. Q; J% C1 @# c6 A0 X% O% W1 e* e3 g
, m% L1 o9 d6 Y7 m& B6 i& w; A5 D0 ^; y6 i% L+ N7 Q* Z& w
|
|