|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
【Teamcenter胖客户端开发】teamcenter菜单添加图文教程<1>1 f9 @& I5 k5 Y/ ~, y" u0 P
这部分内容实际上是eclipse的插件开发的功能, 这里做个简单分类,菜单文件的扩展点都是 <extensionpoint="org.eclipse.ui.menus">,添加菜单就是在这里面添加内容。这里只要注意location即可!, `! T9 s& |8 ?: D( p
(1)在主工具条上添加菜单。1 \8 I7 W! @/ j* r5 f
<menuContribution" s, U3 V1 @: K4 k
locationURI="menu:org.eclipse.ui.main.menu?after=additions">9 i$ l/ l4 J" L" L9 Z) A; \
<menu id="com.plmhome.plmhomeTool" label="PLMHome ToolKits">! e4 c0 k8 c% ^# G3 H) a% A
<command3 ?( M2 z. k' b8 o4 E
commandId="com.plmhome.createFolder.commands.sampleCommand"
* x# F" k2 x9 O4 \; p- G mnemonic="S"
: A$ x+ q _; v. n- z+ k! L id="com.plmhome.createFolder.menus.sampleCommand">
9 u) y8 N8 ~) o1 r) E </command>
9 t5 F, o' m( \ </menu>$ r1 `; [8 l: i( f0 O4 g
</menuContribution>' ?' r/ ]; N3 x' C ~7 T
1 y/ q x; c B! c2 ^, c
(2)在工具功能的后面添加按钮。
4 I5 C% I1 K+ S* w% E* t' ] <menuContribution
( E$ }, [; J* v9 e locationURI="menu:tools?after=additions">
_1 u0 m7 Q5 L: ~/ J8 p <command! K* o1 f7 k0 P
commandId="com.plmhome.createFolder.commands.sampleCommand"
i+ j6 ?4 k" g* u0 @' C! H( P mnemonic="S") b( X) o& B3 i. R7 f# v
id="com.plmhome.createFolder.menus.sampleCommand">
0 @7 Q* K* Z A* O. n8 M" T! M5 O5 k </command>+ V# R8 I3 V* T R1 X
</menuContribution>* L+ ^5 i3 ~" [9 m
/ z: z# K7 Q) Z& g# P$ \
(3)在右键弹出菜单加按钮
a2 t* W9 b$ C: B <menuContribution
# w( }7 Z7 _- A9 F locationURI="popup:org.eclipse.ui.popup.any?after=additions">. B; @$ m3 }+ X0 _$ ~7 a+ @
<command' W' F& Q* n% t
commandId="com.plmhome.createFolder.commands.sampleCommand"
Y! k4 q9 B Q9 x, T mnemonic="S"
9 n3 v& Y7 R% |9 i; i+ ?6 S1 L id="com.plmhome.createFolder.menus.sampleCommand">) O p! U+ W, h! u5 D) Z
</command>
) Q3 {1 V' u7 Q( _ </menuContribution>
6 U- b# w A5 }' j3 E(4)在具体的菜单后面加功能按钮: T3 j% d* W" b6 c2 Z4 P5 Y0 U) o
<menuContribution4 O" s* w, M0 [0 P& Y! d' _# @# @, g
locationURI="menu:com.teamcenter.rac.ui.views.DetailsView?after=group4">
Y1 `$ G& p% m! L <menu+ G) m; a, I0 G" H( H
label="PLMHomeToolKits" D p9 x* c' M* ] s" b
mnemonic="M"
! J& z" S; C! Q9 q9 y2 l id="com.plmhome.createFolder.menus.sampleMenu"># v( M6 f/ g+ J4 ?
<command2 d% }8 t& v; M( w& x4 ?' q) D6 C
commandId="com.plmhome.createFolder.commands.sampleCommand"3 k6 n s6 z# I3 e- L: F* y
mnemonic="S"
7 G3 W$ m* F, @ id="com.plmhome.createFolder.menus.sampleCommand">* s$ u: X3 ]% l* N: t8 F
</command>
( n6 E/ |: r9 X- q5 G% k( q, C </menu>9 O. J6 p* Y. u1 E$ ]3 Q1 G8 A( ^$ u
</menuContribution> l" `0 A' W: { s
; _4 |3 ] E1 ]
(5)指定位置,直接加按钮
; h5 E/ l+ w$ @0 G- t3 e <menuContribution4 ~2 q! m" B5 ~! t
locationURI="toolbar:com.teamcenter.rac.ui.views.DetailsView">& Q- ^ t1 K5 @, P
<command
3 f; G3 N, } |6 {7 [5 y; V" U commandId="com.plmhome.createFolder.commands.sampleCommand"+ Q( R: T3 K6 O$ ~0 ~' G+ o
icon="icons/sample.gif"& h+ S, c% v% `0 X! n% i
tooltip="Say hello world"
! G- n; N+ T3 |9 N U z7 Y id="com.plmhome.createFolder.toolbars.sampleCommand">7 x5 x( d3 {' V! X% x; O8 d
</command>
" F/ s% y* p$ V- ]3 r! l6 L1 r </menuContribution>
) U7 G9 _9 m: b2 n
- A. q- `, p! q; F$ v( R(6)加工具条按钮
4 a7 Z( Y2 g; X( t. ^. \5 E* }- @ <menuContribution' m5 l$ I p. M, }5 k6 C
locationURI="toolbar:navigator_Toolbar?after=additions">
+ H$ b4 O8 c( D; t8 b; p <toolbar
! S& B- C6 O- }# u. v; S( | id="com.plmhome.createFolder.toolbars.sampleToolbar">
2 E+ o8 H; n1 x8 F6 m <command2 B6 {# ^5 K) l( p7 o( m+ ^
commandId="com.plmhome.createFolder.commands.sampleCommand"7 Y; Y2 m7 G, H2 T% h
icon="icons/sample.gif"% ~! T3 [* [2 }8 J0 T4 `3 K/ b, v7 `1 C
tooltip="Say hello world"
/ S, J" b4 \+ K: v* x6 |% n, ` id="com.plmhome.createFolder.toolbars.sampleCommand">$ k4 \9 s1 L" H( E; |' A
</command>& Q: ~+ q u# ?7 W Q+ \
</toolbar>
2 K' i3 y& {' l3 s </menuContribution>( f! |# \$ t3 j7 j5 \0 E$ b
4 T2 j/ Q0 ]8 n& P# _- R( f) D6 L* B0 Z9 s$ f) u+ M
完整的例子如下:
* ~+ w3 z z# r$ O8 O K# Z& F/ J9 C0 r4 G7 U7 X; B
<?xml version="1.0" encoding="UTF-8"?>
6 a8 n* b+ ^8 D0 O- r<?eclipse version="3.4"?>
2 }0 Q8 U1 @$ }6 b<plUGin>! b0 d4 h# G( }
' C/ L, X7 ~9 Z3 B9 p
<extension
8 f- u: O+ g8 p8 v0 Q0 ? point="org.eclipse.ui.commands">* t! K. P6 I; ], I: b
<category
1 ]) W* n* O/ t3 ?5 q# y name="Sample Category"
3 G! P5 f/ ]- s) n+ D' g+ y) V id="com.plmhome.createFolder.commands.category">
7 V1 x2 k7 ~- s; Y8 A5 U </category>' K6 h V% _1 T% q0 W; g ? W
* G4 N7 m0 q. o2 G0 P$ {
<command
8 }# v; P+ R. Q; t9 M1 Q; ~7 t name="PLMHome CreateFolder"$ [! J" c) u/ \% F0 l
categoryId="com.plmhome.createFolder.commands.category"
* F9 e3 Q& y( W4 r; d% p2 y+ e id="com.plmhome.createFolder.commands.sampleCommand">3 L) T) N. ^9 q$ _! s4 w" B3 D
</command>) C7 t* }9 c# I% s
' F0 r1 c; \3 ^. ~) v6 | </extension>
) B8 s" q! ~7 \- P: F <extension" A G) U6 @) S/ F/ K2 o
point="org.eclipse.ui.handlers">
: U% G2 m+ ]8 f/ v/ D# K5 t$ V <handler# x7 R( m) e b; H6 ?; U% y
commandId="com.plmhome.createFolder.commands.sampleCommand"% q/ |0 z) ^/ @1 B
class="com.plmhome.createfolder.handlers.SampleHandler">$ C$ b0 J1 l$ Y: I. r. ^
</handler>
# ~: ]' p5 s: S. C% i! E </extension># z' v) O" A: S, s
<extension) n! k: K0 y; g4 |2 {
point="org.eclipse.ui.bindings">
1 e. ^5 c6 _3 Z2 p0 F3 x, l6 ] <key
" N2 X; `# ]4 ~+ Z9 W! ] commandId="com.plmhome.createFolder.commands.sampleCommand"! U3 T1 X* P! m$ m S2 {
contextId="org.eclipse.ui.contexts.window"
5 a; e9 [9 h7 }; ^1 V/ B- ^0 x% H sequence="M1+6"% Z, v2 {; y; W8 c" W
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">6 e- A9 X* c% o" ?, l
</key>3 U* G/ u0 I& b2 h
</extension>4 w- f( D5 K- P2 O. c
<extension9 n, v* H1 ]1 S, u" T% |
point="org.eclipse.ui.menus">) L% \) q4 I, m' S) e# e8 \
+ l+ w0 k" t$ N <menuContribution
4 ?6 [! p, [* L: S- D locationURI="menu:org.eclipse.ui.main.menu?after=additions">) E: g3 j {4 H4 D
<menu id="com.plmhome.plmhomeTool" label="PLMHome ToolKits">3 Z' ]* N; i* S% O% P+ ]" e
<command P6 E8 v3 p4 b' l3 d' I* a+ J
commandId="com.plmhome.createFolder.commands.sampleCommand"# n( c K3 _" y
mnemonic="S"
, G3 f& d( T& p& ~9 e* D, \# q7 \ id="com.plmhome.createFolder.menus.sampleCommand">
# Y# E6 Q. S' x9 ~# [( `8 N f </command> M4 I: {7 `* V7 L; |% \# C& N
</menu>+ |8 ?- L4 w' z8 `/ B$ i
</menuContribution>, B7 [8 s. z- l1 P4 @
6 w! Y6 V& A! ~( ^
- `+ k. A8 w% }# C8 Q' }, Z' V. F+ j5 S
<menuContribution. R9 M3 c1 }) t
locationURI="menu:tools?after=additions">) E& j* {3 I& `7 L4 Q
<command
+ n# r& [" G" e commandId="com.plmhome.createFolder.commands.sampleCommand"1 T* }" y" [' Q: U0 I6 u: m
mnemonic="S"
6 k2 x, ]0 V9 l9 K id="com.plmhome.createFolder.menus.sampleCommand">
: F4 ]* P) J' T) d. \ </command>
% v; c. V4 b7 A& W </menuContribution>* T& J( |1 Y; ~
2 Y) N( x9 n% {0 J r0 a2 u& U
# n9 g' B! d- q* A/ ^; N( M8 F3 ?" K5 ]1 N" ^
<menuContribution% t# @& Q% ^+ h- `) Y
locationURI="popup:org.eclipse.ui.popup.any?after=additions">2 X; }; e% W; R2 j! w
<command
& i, u; L- o1 O commandId="com.plmhome.createFolder.commands.sampleCommand"8 V* a) `+ [ M! K& F
mnemonic="S"4 w9 u6 u- v/ [8 F7 O3 H8 R
id="com.plmhome.createFolder.menus.sampleCommand">2 m; Y$ i% a0 Z) I9 d# [
</command>
& b3 o+ L2 {/ p' V9 A4 Y: d </menuContribution>* g9 U- ^" }; j! m$ n4 ^3 }
$ H# ]0 Z/ A, J* y; U& N" t: O
<menuContribution2 I+ w% s/ O, h' X2 m* ]4 ]
locationURI="menu:com.teamcenter.rac.ui.views.DetailsView?after=group4">2 ?9 }3 H1 S% }" b8 o
<menu0 a$ j3 I9 V# Z4 b7 T3 b, g) r, X) z
label="PLMHomeToolKits"7 I3 a* r, A5 M1 p }! M
mnemonic="M"
8 n7 a2 y, E# T2 C6 K1 o$ R id="com.plmhome.createFolder.menus.sampleMenu">
( ?4 @6 h- l& \/ a [& w <command
7 ^) `* |, j2 P6 y. k; W" p commandId="com.plmhome.createFolder.commands.sampleCommand"
2 G# o9 ?* Q7 k0 V1 U* ]' T* O mnemonic="S") C3 N& f. G4 t6 A8 ^
id="com.plmhome.createFolder.menus.sampleCommand">3 b- i8 P0 r, [ d8 A4 [# [
</command>
/ ~4 t3 _' X& d8 s0 X </menu>& {/ j9 L9 e* w5 `! A9 j# H
</menuContribution>- g+ S# z& s/ G3 a
: }# _ s/ L% n+ T R3 b4 E <menuContribution
0 B! {: N6 ^; D4 l+ p locationURI="toolbar:com.teamcenter.rac.ui.views.DetailsView">
! Y$ K' h2 u" [! T$ e <command
; j# y8 s" ]* W% u2 n/ k: U. k% T commandId="com.plmhome.createFolder.commands.sampleCommand"
, o% _5 n' M: f3 N# ~* i' e3 t! u icon="icons/sample.gif"* {' }$ A# B0 r( |! y: s
tooltip="Say hello world"" Y, N4 S$ F+ t3 P
id="com.plmhome.createFolder.menus.sampleCommand">
+ T. q1 L6 C! l! l4 t </command>
% U; h1 P6 @3 ^0 c </menuContribution>; p2 g H" e+ w% X7 O! j+ l# ]
1 ?4 T- R4 L& X# C, m9 R$ B9 R6 k% x: ^
<menuContribution+ J, k: U4 s3 Q( R/ s$ ^$ X
locationURI="toolbar:navigator_Toolbar?after=additions">. R1 U6 a9 \- b6 J+ L. f) X& \
<toolbar
* T5 H a1 W1 T3 [ X# E$ y' I id="com.plmhome.createFolder.toolbars.sampleToolbar">
^7 j6 Y" L: ^ <command
8 ~) j5 d8 U! G+ q e commandId="com.plmhome.createFolder.commands.sampleCommand"+ o8 @* G2 x8 t$ C/ c g% g& t4 I
icon="icons/sample.gif") S/ |6 L3 ~9 K b2 V( j
tooltip="Say hello world"- t- y! |/ Q0 S& @- m6 t
id="com.plmhome.createFolder.toolbars.sampleCommand">+ D. H" j" w9 x
</command>
1 ]: |8 g* _: X </toolbar>( s; k9 k% b' q ?, @ ~" Z q
</menuContribution>
. [' N1 @. d7 ^" D5 K, a6 u* S0 \5 A B0 D% T
0 r8 s- R2 I. D </extension>* w R r- z1 K. e9 Q
; x, [4 t5 Q: S* ^: W$ O1 B( A</plugin>
) K' e$ S& B% R7 I' j7 h: p% O. C* V: y& j# M2 ^
# F* ]- X% \3 E' A+ j4 W
0 U4 ?- j9 I8 {
|
|