PLM之家PLMHome-工业软件践行者

【Teamcenter胖客户端开发】teamcenter菜单添加图文教程<1>

[复制链接]

2015-4-1 14:48:17 8008 0

admin 发表于 2015-4-1 14:48:17 |阅读模式

admin 楼主

2015-4-1 14:48:17

请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!

您需要 登录 才可以下载或查看,没有账号?注册

x
Teamcenter胖客户端开发】teamcenter菜单添加图文教程<1>) v1 r- ]1 `* D2 l' T' M
这部分内容实际上是eclipse的插件开发的功能, 这里做个简单分类,菜单文件的扩展点都是  <extensionpoint="org.eclipse.ui.menus">,添加菜单就是在这里面添加内容。这里只要注意location即可!# t" N, M) v( `
(1)在主工具条上添加菜单。. `/ D  u/ a+ A3 }: D+ |
  <menuContribution
$ A2 y3 B+ j0 i! O6 r            locationURI="menu:org.eclipse.ui.main.menu?after=additions">
% }4 n; S/ C8 [            <menu id="com.plmhome.plmhomeTool"  label="PLMHome ToolKits">
- }: l, d: O' g+ x            <command4 k& S$ W/ y& T' q3 N  X
                  commandId="com.plmhome.createFolder.commands.sampleCommand". E0 T2 O; N) I4 X3 L' X, l
                  mnemonic="S"
- F6 j6 N; o* |) I" j$ ~                  id="com.plmhome.createFolder.menus.sampleCommand">
6 V  h2 X  R6 @6 D/ W            </command>
/ m* a) ~- S. Z7 |5 H0 G0 ?            </menu>: K4 r- I) V/ N' L8 ]6 N1 y
      </menuContribution>
! w! s: U$ }9 x# ~$ O
$ u/ A3 J1 @8 f2 K0 k(2)在工具功能的后面添加按钮。; Z* O/ Q+ ?& j) L/ F
  <menuContribution
$ H5 L& f. H7 L' }            locationURI="menu:tools?after=additions">
7 ~# h- Q/ N3 w. t7 H1 M' m            <command
4 ^8 g; @' i9 G                  commandId="com.plmhome.createFolder.commands.sampleCommand"4 ^- l; |9 [. x; M( a! `
                  mnemonic="S"/ b% ^9 h. S+ R, D
                  id="com.plmhome.createFolder.menus.sampleCommand">, X& a- L4 d0 r$ @; ~/ |& n
            </command>" P7 G+ L! F6 }- t" H2 h$ [* P
   </menuContribution>$ I$ F4 Y" A! ^. P$ [6 @

, n+ ]" Y- u% k: j4 t+ t(3)在右键弹出菜单加按钮
" C) O# i3 y+ E2 a      <menuContribution- S1 O9 a- ?1 F; A5 K
            locationURI="popup:org.eclipse.ui.popup.any?after=additions">% C- k2 S; R$ @( n7 O& J
            <command5 V; D8 \0 U- b) M+ i4 S' I- i
                  commandId="com.plmhome.createFolder.commands.sampleCommand"
5 L5 n6 V9 d7 @% s0 |. t                  mnemonic="S"3 e# f% f# A5 y$ z) q$ N1 \4 P' `
                  id="com.plmhome.createFolder.menus.sampleCommand">0 c" P6 ?( _' z" b/ Y$ U9 I( V
            </command>8 K" t  s; o, L* \
      </menuContribution>3 [  |; m5 [8 O4 a7 Y) A
(4)在具体的菜单后面加功能按钮9 R( L4 l" w3 w* r  c# U- ?
      <menuContribution
) y& Q+ D0 Y5 E) R: x7 B  `% t  c            locationURI="menu:com.teamcenter.rac.ui.views.DetailsView?after=group4">
  U2 _! `- O+ l; p# X9 ~         <menu2 b1 B2 X: n8 d6 N
               label="PLMHomeToolKits"
( T) E% m! F7 b1 Y7 j               mnemonic="M"+ e) c* z5 t/ G6 L4 C3 s  U+ T, W
               id="com.plmhome.createFolder.menus.sampleMenu">
, R8 k- [* I# U            <command
- s& y8 E) I/ R; _5 z" _+ n3 D                  commandId="com.plmhome.createFolder.commands.sampleCommand", o/ m  t$ \, F: s; w/ K. C$ r
                  mnemonic="S"- J9 {# g+ K: ~+ e0 k/ M
                  id="com.plmhome.createFolder.menus.sampleCommand">& F& X4 y9 s6 x$ t; L2 T8 i, {
            </command>
0 [) K) y$ Z3 m$ s6 C, B; C         </menu>
' x3 q9 ^4 @9 A, z1 P      </menuContribution>
* H# o2 \3 M. M0 x) X$ O4 ?" N; c1 [+ o
(5)指定位置,直接加按钮- G$ f  a7 A5 `7 W
      <menuContribution
7 m; c) o, S9 z            locationURI="toolbar:com.teamcenter.rac.ui.views.DetailsView">
5 f" ?, k' ^6 t3 U9 E7 _! `6 o0 e( @8 W            <command8 L0 g( P! C9 I1 K, u+ R% W
                  commandId="com.plmhome.createFolder.commands.sampleCommand"
: N( y% e# P# N4 i0 C4 C                  icon="icons/sample.gif"0 L4 P; Z) [8 z$ f0 {' p" _5 t
                  tooltip="Say hello world"
, M7 `6 J1 z; [6 b                  id="com.plmhome.createFolder.toolbars.sampleCommand">
  ]. b2 C& }0 J1 m% ]  x0 {% J            </command>& T  x& h: g+ i  H! w$ F% L7 X+ Y
          </menuContribution>1 j( M$ n9 {# L6 `) i9 F. h  p  X" Q2 n/ f9 {
) u, s" a3 E' W$ i& t5 z: j8 ~
(6)加工具条按钮3 V6 W2 z, A- d1 D; e6 [6 T
  <menuContribution; k: S/ A3 Q/ O& B# ?
            locationURI="toolbar:navigator_Toolbar?after=additions">
& ]) y6 X, c- q              <toolbar1 C% j) a' i2 i/ r8 I+ `! `
               id="com.plmhome.createFolder.toolbars.sampleToolbar"># z* a! q: G! B" F: o4 H" {
            <command2 c, X6 S1 ]1 i! ?! \
                  commandId="com.plmhome.createFolder.commands.sampleCommand") O# h9 l& X+ L/ S. z( W9 y$ [
                  icon="icons/sample.gif"0 t4 ]8 ~. H7 e6 x  r  ?
                  tooltip="Say hello world"  Q' |& A, v( k- Q; u
                  id="com.plmhome.createFolder.toolbars.sampleCommand">
" S" a+ B; F, k$ Z0 b+ F            </command>
# E( X. v- ^: s  n2 P9 \            </toolbar>
7 E0 t, M+ T( C9 k7 s3 b! D          </menuContribution>
- t& @  J# P3 t7 n6 f- P6 M- V% Z9 R+ c

, [( W# O' D  j完整的例子如下:
+ i8 b" M$ |" y0 R) u" C/ I4 R5 J* |5 K, x2 t3 A% A
<?xml version="1.0" encoding="UTF-8"?>
! b# ~5 l( }/ c; Z* C( q<?eclipse version="3.4"?>
. J" _3 M. h2 G# U<plUGin>8 A/ z* J) r, r
8 @$ f& c( |7 B/ R
   <extension
) T4 F; _, o8 p* ]$ l( Z         point="org.eclipse.ui.commands">
* Q  R: q* Q2 o  j9 H6 ?4 L      <category% z1 E6 H8 x' ?
            name="Sample Category"
$ `- v3 j- Q4 \7 R+ |1 w) Q; A            id="com.plmhome.createFolder.commands.category">* v+ _3 t  y  T- m! q( c* t4 y0 M
      </category>) R4 E9 W; \: I% I9 y

# ]- M* T9 G! B7 w; g8 z- |      <command
9 D# J5 f6 @8 h0 f            name="PLMHome CreateFolder"
+ v  r$ {' M. H2 `. u            categoryId="com.plmhome.createFolder.commands.category"
) X4 @6 y  Y' D5 {            id="com.plmhome.createFolder.commands.sampleCommand">0 k, M+ u" `0 e  D
      </command>
- W6 E1 n, L0 ?# k8 i0 l# e5 B. d1 M+ I$ E3 N& z
   </extension>
2 R/ L0 z3 P0 v7 N% L1 P   <extension
6 f& d7 J5 q4 ]* L; Z& O! i+ b         point="org.eclipse.ui.handlers">  Z$ y: z$ z+ Z% G) M* ^
      <handler# h, \& P& K. d9 b5 M  n; y8 l
            commandId="com.plmhome.createFolder.commands.sampleCommand"% h" d; @% t, A; g: I' v3 L: M
            class="com.plmhome.createfolder.handlers.SampleHandler">) ^" s# H. C! D) q0 E
      </handler>9 O7 h/ A0 y1 ]% i% f# z) B! s2 ]
   </extension>
( H" z; ]: j# y   <extension
; x5 E. y- r( c% l+ x2 {         point="org.eclipse.ui.bindings">
7 ]1 L( R2 M  a  c      <key; q! r* j4 {% b
            commandId="com.plmhome.createFolder.commands.sampleCommand"
6 u) L- h" d. ~# \8 E            contextId="org.eclipse.ui.contexts.window"
# f# ~6 M/ X$ N6 W; `5 R  g            sequence="M1+6"2 F* |( Y4 ?  A- R
            schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
2 V! x: T& h: x, ?' y      </key>  w" v2 m  E8 Z0 w+ @7 @2 T3 y
   </extension>2 E8 I& p9 @% z3 D7 b3 m
   <extension
. d5 ~# p3 c& U$ U         point="org.eclipse.ui.menus">
! N! {) v( B3 Z; C* Z: x3 K4 r6 L9 m- o& C
           <menuContribution$ x& E5 [5 w) O9 _% Z
            locationURI="menu:org.eclipse.ui.main.menu?after=additions">8 e7 `8 ]/ W: s- v9 D( K
            <menu id="com.plmhome.plmhomeTool"  label="PLMHome ToolKits">5 {7 b, r* b0 E* ]3 `$ R" u4 h
            <command
. H# o% B; _' S4 Z+ s) U9 F) z$ [                  commandId="com.plmhome.createFolder.commands.sampleCommand"
/ @/ T! U. `2 v0 F                  mnemonic="S"8 f. B1 z+ y7 m$ L9 X3 j! K5 G. r
                  id="com.plmhome.createFolder.menus.sampleCommand">1 r; ?& B  K3 r- k* v, Q5 m  q) I
            </command>
8 y) h; d! M  D* l4 Q1 [7 ^            </menu>
* ?8 t& C7 J. f6 c* _3 {0 n      </menuContribution>
( n$ J8 W" a  r( Y, u8 R. L) r! c, {
0 @9 l2 V9 S  p5 L: m4 m

1 l3 M: m' q% e5 Q# G& m: [       <menuContribution
& y1 m/ u* I+ l& X( [5 r            locationURI="menu:tools?after=additions">, p) X7 R9 }" g: n( G
            <command
; p% q3 |8 Y% X. |* c0 U                  commandId="com.plmhome.createFolder.commands.sampleCommand"
4 b# I5 W5 f2 B# Y                  mnemonic="S"9 e' O& q/ ]/ ?
                  id="com.plmhome.createFolder.menus.sampleCommand">; e# F7 H4 h8 g" I' i/ \
            </command>
: |: b7 N. r9 @      </menuContribution>* _  w# `6 x( R

. G3 z; K- ~# k: O" Q2 ^  B2 \( C; ]. X
- F) c+ q- L# w
      <menuContribution
9 J  b- b4 p  j& Z/ D. j( x            locationURI="popup:org.eclipse.ui.popup.any?after=additions">- w) B# F$ d  L" Y9 \1 G$ _8 T
            <command- A0 y) h+ o. g
                  commandId="com.plmhome.createFolder.commands.sampleCommand"
2 a* p4 Y, R5 G" O3 F/ P  A                  mnemonic="S"
: U: s6 g& n1 k/ j3 h7 `2 I( H                  id="com.plmhome.createFolder.menus.sampleCommand">4 |. ^) d( I9 k" p1 I1 s
            </command>/ }# U: t1 I4 U, V: O, c' b: Y
      </menuContribution>
+ J/ X' ^9 `; L1 l2 @! Q; y7 w2 }8 ~) k: o. y& M
      <menuContribution
: x% l: P+ X/ e7 E  o8 ?0 q            locationURI="menu:com.teamcenter.rac.ui.views.DetailsView?after=group4">9 u0 |. `- @# q, X
         <menu; _1 r" U+ \( @6 q9 |
               label="PLMHomeToolKits"0 c+ Z. H8 O; s9 b  r* U
               mnemonic="M"7 `( c  \& G& [" M1 @9 g; t* o4 G
               id="com.plmhome.createFolder.menus.sampleMenu">; J" e# F+ w8 r+ w7 ?
            <command
: d1 g# r! I$ I, T: m' v                  commandId="com.plmhome.createFolder.commands.sampleCommand"$ x) J( O1 G; M/ Q. ]6 ~
                  mnemonic="S"
- q8 W: v$ C! T" a4 i                  id="com.plmhome.createFolder.menus.sampleCommand">; e7 u4 r+ C) h( U3 W. C: [
            </command>/ C3 D" t2 A& a8 Q
         </menu>
6 B& ?3 m- z, K  Y. w8 Z$ d# b      </menuContribution>4 X+ M7 l! c% C$ b% u1 P

0 x- x1 t" d1 ]. s      <menuContribution
8 a# x/ C) P; f" |7 n            locationURI="toolbar:com.teamcenter.rac.ui.views.DetailsView">+ q, P. u% t$ P/ m0 |2 N  I9 D9 ^( o
            <command
6 U" G1 w+ B) q                  commandId="com.plmhome.createFolder.commands.sampleCommand"2 Z, F5 P. Y7 `" h
                  icon="icons/sample.gif"
) r0 P. F' k# G4 K' }3 ^% h                  tooltip="Say hello world"" e8 j& X; _) s) ^7 G
                  id="com.plmhome.createFolder.menus.sampleCommand">
2 M4 t' O" m7 T9 h; v) ]* r0 N            </command>% K- L( k2 V9 d
          </menuContribution>5 }; t5 f4 {4 f2 q

5 R" q9 H0 ?! G/ {3 T1 g9 g6 @% p6 w* u) {0 R, i
      <menuContribution
: }0 I+ L" t) G1 Q& m# x            locationURI="toolbar:navigator_Toolbar?after=additions">) u6 ]  j! i2 r; b( M* f2 X' S
              <toolbar
. o2 i. |1 K8 g8 X. ^1 K9 L5 T               id="com.plmhome.createFolder.toolbars.sampleToolbar">7 N; _3 u! ?1 `$ S7 U5 o
            <command& |* K! Q! {$ b3 f+ |
                  commandId="com.plmhome.createFolder.commands.sampleCommand"
) Y8 x4 a: \" @$ N* R! N5 v                  icon="icons/sample.gif"- `  V, _  O5 i5 I' N. z9 g$ {1 X% C
                  tooltip="Say hello world"$ @, y3 a, Q" h/ v
                  id="com.plmhome.createFolder.toolbars.sampleCommand">  Z% ]+ k6 R0 R5 S" b- d
            </command>- y3 y" ]6 F# H  Z
            </toolbar>6 G5 I/ D4 Q2 [8 W
          </menuContribution>
+ e# z; D, y  E! p6 S
) [- r( m# f2 r; N
' Z4 ]! G% ]4 n2 Q& ^1 x0 q4 G& b   </extension>6 j- j8 N; ?: ~0 B( Q# M
% C0 D5 W& h& V% B
</plugin>
& j7 q# ^' M$ E3 x! e' b  x& v( x# U3 W9 @2 X: j$ x: t- f& v
7 E2 Y! Q& @4 \% Y7 U
7 A/ ]( H+ d, ^" I, l- o6 W& H
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 doTeam.tech
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 注册

返回列表 本版积分规则

  • 发布新帖

  • 在线客服

  • 微信

  • 客户端

  • 返回顶部

  • x
    温馨提示

    本网站(plmhome.com)为PLM之家工业软件学习官网站

    展示的视频材料全部免费,需要高清和特殊技术支持请联系 QQ: 939801026

    PLM之家NX CAM二次开发专题模块培训报名开始啦

    我知道了