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

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

[复制链接]

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

2470

主题

1275

回帖

8万

积分

管理员

PLM之家站长

积分
82172
QQ
发表于 2015-4-1 14:48:17 | 显示全部楼层 |阅读模式

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

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

x
Teamcenter胖客户端开发】teamcenter菜单添加图文教程<1>9 |/ N3 U8 q  J& q' t2 k# J
这部分内容实际上是eclipse的插件开发的功能, 这里做个简单分类,菜单文件的扩展点都是  <extensionpoint="org.eclipse.ui.menus">,添加菜单就是在这里面添加内容。这里只要注意location即可!  d! k$ ~9 Y" C% \9 N# O1 C
(1)在主工具条上添加菜单。
; l  l, X5 ~1 ^* V# u  <menuContribution+ |& \* A6 |1 x" g* M
            locationURI="menu:org.eclipse.ui.main.menu?after=additions">
1 d3 w! o/ O+ N; y3 C/ o) [            <menu id="com.plmhome.plmhomeTool"  label="PLMHome ToolKits">
- x% `. q& a  h            <command
; ^2 o; V- z' U* f, T& E                  commandId="com.plmhome.createFolder.commands.sampleCommand"
) L- Q  \: n/ w6 l' Z                  mnemonic="S"
  X9 J' d. T3 q0 h3 q                  id="com.plmhome.createFolder.menus.sampleCommand">* R) p0 R% k8 D7 j7 b. v# y7 p+ o# j2 \  Y
            </command>$ T  {9 W  P6 ]& e% G) O
            </menu>9 \- }( `, Z. m# C% Q) I. N
      </menuContribution>
$ z/ b$ ~0 q$ Q8 a: C7 x/ H
' t- h7 t/ y) \9 ?& Z- i; ~(2)在工具功能的后面添加按钮。! |3 m% k) s. i
  <menuContribution
7 X+ O* L8 X1 P* Q* e            locationURI="menu:tools?after=additions">" V. y: `+ T, w. O- q8 \
            <command0 L) V5 ]4 P: r7 i7 s( W
                  commandId="com.plmhome.createFolder.commands.sampleCommand"
8 Z; [% l+ k% N( [4 B/ U                  mnemonic="S"
; k  A; V5 }  B* X& O  g                  id="com.plmhome.createFolder.menus.sampleCommand">
- E$ @& o" w. Y8 c7 r& l            </command>
" y4 T" L, u4 \* T3 v& d, ?, I& x   </menuContribution>1 ?4 K) L5 Z1 q2 q7 m7 j9 T
# @7 `: w" j" }: {* y5 x2 v2 E6 i' `
(3)在右键弹出菜单加按钮
5 I5 q0 d6 S% t  a8 O      <menuContribution$ ^& D* J0 w; `# D. s
            locationURI="popup:org.eclipse.ui.popup.any?after=additions">
6 m" e8 f9 t  |/ ^3 L0 P            <command! l5 D- N) D# ~& o
                  commandId="com.plmhome.createFolder.commands.sampleCommand"
2 T" c. m# u. y3 v8 {                  mnemonic="S". g& b; O5 |5 j( q$ C" @
                  id="com.plmhome.createFolder.menus.sampleCommand">6 Z9 h* L4 q3 A7 r/ O
            </command># R0 ^5 q' C$ v2 j# K1 y  D1 S
      </menuContribution>
/ R( N/ K4 H7 c9 Z% ^(4)在具体的菜单后面加功能按钮
7 t0 B" q! r/ S2 u% z      <menuContribution
; a8 o4 y  D0 S0 D; S- K3 `            locationURI="menu:com.teamcenter.rac.ui.views.DetailsView?after=group4">
9 u/ {$ d1 ~7 v- e         <menu
9 c  L  T2 J7 |5 {; I0 F7 w               label="PLMHomeToolKits"
( v: o  t# u7 e  R" R/ N               mnemonic="M"
9 ?& F( s8 `, x  }. k               id="com.plmhome.createFolder.menus.sampleMenu">/ H$ z" m- a/ x! e% ]% ?
            <command2 G$ {+ r8 G$ ?; _. m
                  commandId="com.plmhome.createFolder.commands.sampleCommand"2 Y; V4 I9 I0 O# }- s6 }8 u/ X
                  mnemonic="S": J2 |; B* P6 u, _
                  id="com.plmhome.createFolder.menus.sampleCommand">7 v$ s# i2 X! k; ~$ g
            </command>6 n. q0 T2 E; P: j+ r
         </menu>" n: [& e' [+ {5 h# G: D/ S# D9 U
      </menuContribution>6 M4 o) I2 h) \/ [

5 {5 `2 v" `6 j0 ~9 c9 x(5)指定位置,直接加按钮" h: Q* E% J0 O; j; H4 x0 [
      <menuContribution$ V* |3 s3 R, e
            locationURI="toolbar:com.teamcenter.rac.ui.views.DetailsView">3 J- O7 W; n# x# X
            <command' }3 ~4 j) f/ Q. s$ C( j* [
                  commandId="com.plmhome.createFolder.commands.sampleCommand"* }; }5 R! _$ p$ s' a% P
                  icon="icons/sample.gif"
: F) u# T, p: }# d                  tooltip="Say hello world"
! M8 b1 s9 R+ ~- G1 h: x) H                  id="com.plmhome.createFolder.toolbars.sampleCommand">) R3 f# a8 |5 d) y! f! |
            </command>7 d8 _, l% u4 A+ N
          </menuContribution>
' P7 A# @3 u& a6 ~% G& p. @+ [( y( P+ S. S
(6)加工具条按钮
9 ~" p$ E' P6 s1 P2 ~  <menuContribution
$ X2 C5 D8 Z. S8 {/ K            locationURI="toolbar:navigator_Toolbar?after=additions">) N7 i# W1 c) t$ P4 P
              <toolbar
# L; t' b6 N  ~1 `               id="com.plmhome.createFolder.toolbars.sampleToolbar">
3 j  q9 m, p# v9 c, R6 q' j# c) U            <command2 S9 \7 t% @) X7 A7 z
                  commandId="com.plmhome.createFolder.commands.sampleCommand"
; y  Y5 p( _) f7 }2 r                  icon="icons/sample.gif"$ D) d' `1 u8 Z9 M4 G) V* `
                  tooltip="Say hello world"
' ]$ U  G3 _6 W1 y; U2 p( Z  |  J& N                  id="com.plmhome.createFolder.toolbars.sampleCommand">
8 o- g- h0 y% Y            </command>1 L( J0 r! H' L6 J. Z1 d5 [
            </toolbar>
* y2 a  a+ T$ Y. M  Z& B/ q- A( G  |          </menuContribution>
% E; d: M: M& F6 J' x% V0 d; q
  s6 E# ~4 \0 V$ h4 c: D& z
4 u4 I7 j; ^* G! ^: o3 Q+ M& h/ r完整的例子如下:$ e7 s4 q: }$ h; V  U
+ ]0 S, S" H2 g1 a
<?xml version="1.0" encoding="UTF-8"?>6 \( A% g' n6 w% `
<?eclipse version="3.4"?>
% c& }' z( D$ O<plUGin>' s- m9 Q$ J( L
* ^$ ?6 X) E4 I9 c/ W* z+ o: }
   <extension5 [3 ^+ j5 m; ^) ]2 v( t, U' g
         point="org.eclipse.ui.commands">- `( Q" l7 P2 r2 _: H
      <category; y+ G1 e2 \/ T; s; e
            name="Sample Category"4 e" ^. h. x! a! b$ u4 F
            id="com.plmhome.createFolder.commands.category">5 D  j9 D' c) T( ?
      </category>: ^5 Q, _1 Z4 s( s0 \& B7 U

2 \& J7 o/ X* h0 G4 R      <command
: ^5 `9 c) K" Y9 u/ F& c            name="PLMHome CreateFolder"+ a& ^$ l" r6 d% [7 a: A
            categoryId="com.plmhome.createFolder.commands.category"2 Y5 M' X2 V6 E: Y, q- y
            id="com.plmhome.createFolder.commands.sampleCommand">  ^% H1 e9 P' y5 q
      </command>' E9 S/ t! S& x7 R3 N4 }: N) d, J" z

1 q2 U. h* a: p4 }1 H   </extension>
7 m% _- A. j/ I: z6 C0 r; y* |9 E   <extension
7 H' t% ]( x& i! t" p$ x6 m         point="org.eclipse.ui.handlers">
9 x7 k. k5 h, B' E      <handler
' W# p0 k- k% E" s% O            commandId="com.plmhome.createFolder.commands.sampleCommand"- u7 k& @$ W7 E8 A
            class="com.plmhome.createfolder.handlers.SampleHandler">) F8 {! O9 C/ N& ~0 O, V* k
      </handler>
9 j" ~0 e5 J' x& a& x   </extension>& C( u/ A) U  u+ ]' [# W
   <extension
8 r+ u8 j# b' @# N# |         point="org.eclipse.ui.bindings">
2 E' M0 I( Y: W$ ~2 R      <key% Y- F# I5 M, p
            commandId="com.plmhome.createFolder.commands.sampleCommand"% K  `, n' T2 t
            contextId="org.eclipse.ui.contexts.window"' X% Y* q. [5 x( g( ~0 R0 B* L
            sequence="M1+6"
$ K8 [- Z3 ^/ c& ^            schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
1 c$ J$ M# a% A# E" R; Q      </key>( z* H$ ?2 L& {# q
   </extension>
/ U: k( d$ a" G" T5 I# @, n2 s0 O/ A   <extension& x8 c9 u6 F9 y2 {* }; |2 e
         point="org.eclipse.ui.menus">
4 g# ?8 ~  ]6 p
# d" r/ o$ j8 }, E, ]: H           <menuContribution
! A# g) E9 x5 [* B* t1 l            locationURI="menu:org.eclipse.ui.main.menu?after=additions">" b4 ]4 @" y6 T1 T( r  {
            <menu id="com.plmhome.plmhomeTool"  label="PLMHome ToolKits">8 i) R0 v0 x5 I/ p) y# t: R
            <command
2 K, ~: n: F0 a% Y                  commandId="com.plmhome.createFolder.commands.sampleCommand"! C9 f" P, c5 s- o+ c) R  h1 a
                  mnemonic="S"4 U: p! d# S: l; o
                  id="com.plmhome.createFolder.menus.sampleCommand">
, l7 F& X7 i' Y2 Y3 }            </command>
" B( P5 X; Y, o' B( {            </menu>+ V- J4 a, z- e! y3 m
      </menuContribution>; a- Y. W8 y  S% o

) L6 K5 T0 T4 J. n  Q' g
- ?5 N9 T8 r  y% V% q5 v6 R+ u
       <menuContribution
5 K6 b3 i+ O) Y* S4 t3 |            locationURI="menu:tools?after=additions">
# @$ Y  }, `/ d9 D2 U& k$ {            <command' Y5 V3 E1 p5 t. V" i& S7 B
                  commandId="com.plmhome.createFolder.commands.sampleCommand"
4 v. e7 r8 J& F/ y/ V+ F                  mnemonic="S"
$ {% D3 Q' m0 w" t9 y                  id="com.plmhome.createFolder.menus.sampleCommand">' Q4 _: v. n. w0 x( y% l
            </command>
- X5 S7 j1 i; O      </menuContribution>
! D' y( P& ~  c2 c3 ?' t- s
) g1 l9 q2 l  f* r5 I; }$ I# o( C( X: {: \6 H! h

" X, z. s' _  u, J      <menuContribution  @' y2 f6 j% P. _/ Q
            locationURI="popup:org.eclipse.ui.popup.any?after=additions">$ d+ n( }/ ]$ r7 Q( h8 X5 G; A: O' U
            <command8 N& M! E3 V3 Q7 h1 q/ ?: `
                  commandId="com.plmhome.createFolder.commands.sampleCommand"
( ^6 R: F+ J! l: t" H$ {$ h                  mnemonic="S"4 Y+ O3 u" q  U) l* k+ j
                  id="com.plmhome.createFolder.menus.sampleCommand">: Y" s- B5 g, E! Q5 _
            </command>- i9 \- M* f% F/ g3 W$ L
      </menuContribution>$ w; P7 a" R& d: K6 U0 `& ~8 Q
/ O8 s) h. w6 H( ^
      <menuContribution
5 n$ o& R8 V4 {6 O) A1 n) V, d            locationURI="menu:com.teamcenter.rac.ui.views.DetailsView?after=group4">
+ b+ Q5 ]5 h4 q- z7 ~         <menu7 y2 X1 b+ F& f! z4 f7 [
               label="PLMHomeToolKits"6 c) A) H$ s. q* U$ c
               mnemonic="M"
7 E0 ~& {& G: R; v7 ?6 Z# `0 H               id="com.plmhome.createFolder.menus.sampleMenu">
7 H' h. ~0 }( ~            <command
/ Z0 T9 V, M3 u8 ?/ F                  commandId="com.plmhome.createFolder.commands.sampleCommand"
9 {# U  S; K6 [1 F                  mnemonic="S"
6 I& G  m! `9 i  I6 a7 k5 H6 T( _                  id="com.plmhome.createFolder.menus.sampleCommand">0 P2 U/ P6 {5 l* g
            </command>
8 s' P5 _3 d( ]3 r  \: B         </menu>
$ }6 G: i7 d+ D" J2 f$ Z1 R      </menuContribution>
( m8 J. t# S0 x2 D7 ]0 S& n* A3 l% e
      <menuContribution
' s, b6 y, X" h            locationURI="toolbar:com.teamcenter.rac.ui.views.DetailsView">
+ i' T' J& b8 r            <command
5 n+ U; T! e. S( E                  commandId="com.plmhome.createFolder.commands.sampleCommand"
. C2 [9 ~& M$ y+ t' k                  icon="icons/sample.gif"  w& A  C9 Q+ x
                  tooltip="Say hello world"6 i5 ]$ a  {( D. v2 e0 G
                  id="com.plmhome.createFolder.menus.sampleCommand">
* ?( V6 L  H6 u9 Q            </command>' z/ b3 H% A0 w) X, h+ J. D2 M( {
          </menuContribution>; w* G/ N+ z) ^5 y6 d2 \2 ~4 x
- F1 X+ l* u6 Y/ e2 @4 G

$ P4 {/ |% X9 U! G/ f8 D      <menuContribution
' H$ V- A# m1 M6 ?  h            locationURI="toolbar:navigator_Toolbar?after=additions">4 y3 u/ J+ _, k" y4 M; }/ m
              <toolbar
5 {4 ~3 D& E9 R# g* x               id="com.plmhome.createFolder.toolbars.sampleToolbar"># U) ]# _- d! a* p# N
            <command
" N- N+ S# T' G8 V" T8 i                  commandId="com.plmhome.createFolder.commands.sampleCommand"! Z) E+ p0 k+ e1 {; X
                  icon="icons/sample.gif"
% s$ w- C! P7 N, J                  tooltip="Say hello world"
1 ]- a  {# b, F& j; j                  id="com.plmhome.createFolder.toolbars.sampleCommand">
1 ?: g! C* X: A1 B7 n) p7 N            </command>
: t0 _& \# z- s5 d7 R            </toolbar>
2 b+ P% N, l( n6 N1 A# L4 l; b          </menuContribution>% J% G: B$ p. h+ f/ ]; r4 l4 _
0 F) l' z0 I% Q* x$ e- Y* w

2 Q8 Z" Q, Q1 P3 D   </extension>6 m) {! ?& u) l

% [6 r' f% e  M6 z</plugin>
. F! W# L" J& @) w! q. I. @' U
$ h! ]8 `% h4 }$ I7 b! A+ C4 b, @1 z# {/ c1 \, E
1 X2 O/ s9 y7 p1 y: [8 q8 y
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了