PLM之家PLMHome-国产软件践行者

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

[复制链接]

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

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

admin 楼主

2015-4-1 14:48:17

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

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

x
Teamcenter胖客户端开发】teamcenter菜单添加图文教程<1>! d( a# N) {2 j( h* t
这部分内容实际上是eclipse的插件开发的功能, 这里做个简单分类,菜单文件的扩展点都是  <extensionpoint="org.eclipse.ui.menus">,添加菜单就是在这里面添加内容。这里只要注意location即可!! E/ |. `! h; u9 V: p9 h, D
(1)在主工具条上添加菜单。' z5 l3 R( [( F/ {: p0 }+ |
  <menuContribution6 V! e# e" ~, w
            locationURI="menu:org.eclipse.ui.main.menu?after=additions">5 S1 H. w: P0 R, r* |, P
            <menu id="com.plmhome.plmhomeTool"  label="PLMHome ToolKits">7 _4 o1 m7 J" d" A
            <command
& h* J6 F/ u( |9 `                  commandId="com.plmhome.createFolder.commands.sampleCommand", G8 r( ~. g( }7 X" k/ ?& A
                  mnemonic="S"$ H9 h/ v0 g' Q( m. E
                  id="com.plmhome.createFolder.menus.sampleCommand">
: X; R! H8 V4 g/ Q  g5 T            </command>% V8 Z0 Y6 y8 I+ S& a1 Q
            </menu>. d6 |5 v) {1 o( g+ e9 E
      </menuContribution>
# ~& S9 r' T* H: a7 \* g; r6 ]! x$ u, N9 ~$ K5 e
(2)在工具功能的后面添加按钮。
7 Z, d! b6 Q+ D( \) p6 L) o  <menuContribution
$ P- Q' N6 f! x3 p            locationURI="menu:tools?after=additions">: _, L/ i8 g- ~& q" K- i+ Z
            <command
0 ^, S7 h/ y. K% w/ a                  commandId="com.plmhome.createFolder.commands.sampleCommand"
6 D  q. k) j. X$ _0 G% H1 @& T; [2 ]                  mnemonic="S"
& R/ _6 R! D0 C1 _: d8 q                  id="com.plmhome.createFolder.menus.sampleCommand">* k6 L9 K" f# P7 r
            </command>5 i4 Q8 Q" F$ y5 V1 z0 n4 A! j1 L
   </menuContribution>6 F, \% s" R( G6 f* R& r
2 O: E( z6 r: b& R. h# [
(3)在右键弹出菜单加按钮0 c" ^  ~6 K: k! d" }
      <menuContribution# {% {3 i; V$ K4 _+ l% b
            locationURI="popup:org.eclipse.ui.popup.any?after=additions">
( C$ J) B9 o# x            <command. x* ^5 Y% x1 p# m
                  commandId="com.plmhome.createFolder.commands.sampleCommand"
$ r/ N$ p: `! M: ]$ L                  mnemonic="S"* y4 [6 l* S2 m/ @
                  id="com.plmhome.createFolder.menus.sampleCommand">
) q3 p- O; N% U% [9 O            </command>
0 r% z$ E9 r3 g4 \      </menuContribution>
9 X: o' J; e; }' J. Y. _2 q(4)在具体的菜单后面加功能按钮' z! w6 \% r, o) Z- v: ?+ G
      <menuContribution
% {  R( L, n( q3 @' O, D+ I4 r" G            locationURI="menu:com.teamcenter.rac.ui.views.DetailsView?after=group4">
& r3 U4 l$ s2 {6 R7 k7 g, I         <menu8 h; ^/ v& b* L' o# g) y
               label="PLMHomeToolKits"
& j* m8 b) @( p( O& @               mnemonic="M"5 l& o2 b+ a9 @4 r" ]0 x: b
               id="com.plmhome.createFolder.menus.sampleMenu">" e& l& G9 x# H9 w& |  i
            <command
) H( m5 @7 t% Q: P) e$ C                  commandId="com.plmhome.createFolder.commands.sampleCommand"
1 ]0 G6 n; L1 I7 j( H) D" t7 M1 N/ J                  mnemonic="S"+ I9 D* g6 I# I! G& J' S' _7 y
                  id="com.plmhome.createFolder.menus.sampleCommand">
) f2 J- T+ R6 w1 j$ `) u% ?            </command>
1 I0 F  _' _2 Z. j         </menu>
- |/ ?$ v2 J7 m# p4 s( g      </menuContribution>
5 n1 Y# Z: d3 Q. G# [) B! y- i. u7 N6 x! m( |* M8 G# j
(5)指定位置,直接加按钮: c( U, ?" y5 S0 Q9 @: i- ~
      <menuContribution
) i0 ]4 I: R2 S2 Z; q: ?7 ^1 C) p            locationURI="toolbar:com.teamcenter.rac.ui.views.DetailsView">
8 L9 M) F* e4 Z1 u            <command) |, n# ~5 l. T: D
                  commandId="com.plmhome.createFolder.commands.sampleCommand"
' m0 N. P  v& f* A# D4 E- g5 d; b                  icon="icons/sample.gif"1 }2 |8 o5 I& w& D
                  tooltip="Say hello world"
  T% j, O3 S% r                  id="com.plmhome.createFolder.toolbars.sampleCommand">
* I# J- u, H! Q0 e4 A            </command>" H3 S4 A  r' o( l: K% C
          </menuContribution>
* C2 S& A0 m" T; `
: J/ o* E+ t% D/ {  b# X(6)加工具条按钮+ T! p/ H& g2 x! B+ f; S9 b
  <menuContribution
4 p; U5 ~+ [" N9 G# K            locationURI="toolbar:navigator_Toolbar?after=additions">3 t; h1 h8 F' Q
              <toolbar
2 C" f, T7 \9 I# t" B               id="com.plmhome.createFolder.toolbars.sampleToolbar">$ o/ h8 N, K7 T$ n
            <command! Y, u+ m9 S' ]% i1 J
                  commandId="com.plmhome.createFolder.commands.sampleCommand"
! A& Y9 T4 {; ]3 M: I! v! T" ^                  icon="icons/sample.gif"  d  X2 ~7 N, f3 a2 @# [! E% w
                  tooltip="Say hello world"8 l2 f* Q3 _$ Q  `3 j. z9 u
                  id="com.plmhome.createFolder.toolbars.sampleCommand">
/ P# ~3 m8 n, I            </command>
6 P4 }8 d" x0 b5 B& L            </toolbar>* @! c' a# P8 W6 A
          </menuContribution>/ X' r- O. g7 Z8 t4 j$ M7 `" g
/ b. x5 d: P6 l+ \( j, Y! \' R  i4 |; y
& L$ w# S& }5 O9 E
完整的例子如下:
( N8 y: l6 H" F3 b' w
9 t4 r- M1 V9 G  v<?xml version="1.0" encoding="UTF-8"?>% j/ q4 t( u3 ]- C
<?eclipse version="3.4"?>2 o$ W( q/ g3 q
<plUGin>
3 t/ c4 S- f6 k* I3 x9 l' K- |+ u; p* v4 P* b$ W
   <extension2 s& u7 f( s% {- [) ]' T9 O
         point="org.eclipse.ui.commands">" E7 r" e6 Y, e7 b$ d
      <category
" v& P9 A: l7 m% X; l" n            name="Sample Category"
% y2 c7 V) {. ]% u. T            id="com.plmhome.createFolder.commands.category">
# ?4 f+ f7 ?8 q4 n' r$ ^/ a% b      </category>" s. m& t& L, b' z
1 M# ]' A$ x5 t0 ^6 Q" F
      <command! E0 c  \  {' @7 f& y1 F
            name="PLMHome CreateFolder"  i/ a: R  c6 y6 D+ M% c. l1 e
            categoryId="com.plmhome.createFolder.commands.category"  w9 s; _% L! V/ l5 c+ s6 E, ?3 l1 A
            id="com.plmhome.createFolder.commands.sampleCommand">5 b$ O2 I4 C7 U; S# w( h
      </command>8 v  |/ ]. @0 Y8 V) C8 i
9 B* x8 ?/ ?1 S: |
   </extension>
; I% X( l6 V# D* s& I   <extension
; i& h' u: i5 I2 B5 H6 Z# _         point="org.eclipse.ui.handlers">
* h+ |( W( d  m" y8 X9 u      <handler
4 {$ q4 B9 w: S/ s- F9 L( L            commandId="com.plmhome.createFolder.commands.sampleCommand"0 Z! h  H: {# W
            class="com.plmhome.createfolder.handlers.SampleHandler">5 c( Q" q- h. w# p
      </handler>" ^4 d" ?- A, W0 l& V' X
   </extension>8 D! [' h& {, v6 r
   <extension1 C$ o+ }+ G/ L+ H9 x
         point="org.eclipse.ui.bindings">
) Q* K. x# u" Q; \      <key
# _3 S& [2 t. Z' N9 k, i2 v' q            commandId="com.plmhome.createFolder.commands.sampleCommand"
  ?5 I- e, i1 O7 U            contextId="org.eclipse.ui.contexts.window"
$ D6 B3 `, q5 g! i# O9 G+ v8 y            sequence="M1+6"  N7 U# y: x' n6 @, l6 @
            schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">3 S, {7 `; f7 \. A6 c/ X
      </key>
; @( t  e- N: ]7 ], k7 u( L   </extension>7 b" ?/ {6 M' k' K' T2 Q- L
   <extension$ T: Y9 V2 @- v+ J
         point="org.eclipse.ui.menus">
# s# K/ w3 S6 R# ~* _
# o8 J  v& E( q; i2 y; p7 A2 }           <menuContribution: L2 K* R- p: u" U- @4 }
            locationURI="menu:org.eclipse.ui.main.menu?after=additions">
1 W7 o" e# d- a3 \1 p; d            <menu id="com.plmhome.plmhomeTool"  label="PLMHome ToolKits">* o8 e- P" x! X
            <command
5 f3 X, m# [! ~! e$ o                  commandId="com.plmhome.createFolder.commands.sampleCommand"4 }9 X& b2 n- f1 l, N7 G2 u
                  mnemonic="S"
! d/ [7 M% q2 w5 @2 H  v: [* G                  id="com.plmhome.createFolder.menus.sampleCommand">
( N1 R9 @( @* C5 d, X; ?% ^* I5 o/ @            </command>
8 |- i% a* R* G8 b+ ^# _            </menu>( v/ y& \' Y* Y! R
      </menuContribution>* Z  Q& a1 N4 M) z( L

4 y$ J* b0 S7 \9 \+ n
2 M5 f1 E5 ]; c, f( V! s+ `; i9 C, p7 T1 c# x
       <menuContribution
; {5 v. I# r" H3 F* b            locationURI="menu:tools?after=additions">0 L' D/ U7 P  C3 O8 M7 a5 T2 Y
            <command
' z& k# H2 F- ~# J7 p                  commandId="com.plmhome.createFolder.commands.sampleCommand"9 M$ L7 H/ {1 R: F4 o. R9 m
                  mnemonic="S"& g# [  O8 M$ l# k3 }$ ?
                  id="com.plmhome.createFolder.menus.sampleCommand">/ F( a- E3 M" I7 G- @
            </command>4 i% e9 R: z" {# P8 e8 D* K: m+ n1 Z
      </menuContribution>
1 |8 U$ j; Y. H9 X& B, K9 X* n9 x. d8 H# |- o
6 J: [, r7 q% z; K1 c
+ B+ L0 L# u. ]; C6 a! a. O
      <menuContribution
+ G; y6 B: \! x4 N* o2 S. ?2 h            locationURI="popup:org.eclipse.ui.popup.any?after=additions">
5 N0 v/ s8 B% ^0 M* ~* q5 T            <command( [: i% I7 W  S6 j/ n. A
                  commandId="com.plmhome.createFolder.commands.sampleCommand"$ S2 U8 k. i/ j3 E+ o' k
                  mnemonic="S"! V. y- e$ v* _& O9 p( U
                  id="com.plmhome.createFolder.menus.sampleCommand">9 n: j6 U/ U7 e# S  i+ M0 |
            </command>
3 J' m  ~' I+ E5 u7 {, L      </menuContribution>
; n: E2 V' z1 f( n3 O+ M4 n
) f: E: s8 U) x      <menuContribution
9 W8 h9 O9 g4 x8 l            locationURI="menu:com.teamcenter.rac.ui.views.DetailsView?after=group4">2 u* e. H+ f: X0 e; p
         <menu
( k8 e2 L8 E6 f5 B' Q' j' V) Q& O1 \               label="PLMHomeToolKits"
; ]) Q! I; y6 q5 z, G               mnemonic="M"  t$ l2 X8 }: z4 t
               id="com.plmhome.createFolder.menus.sampleMenu">- D1 g7 [- g  t/ b
            <command
7 W1 w, y4 |. d, _2 h                  commandId="com.plmhome.createFolder.commands.sampleCommand") x2 d7 e+ h* d8 }: n2 S
                  mnemonic="S"" u  Q6 F- b6 b3 A" q4 ^
                  id="com.plmhome.createFolder.menus.sampleCommand">
' @- ^9 [% H7 ^. ^* H" S            </command>% v: {( T2 S) u$ G
         </menu>! q' C( z4 a* ?' Z6 y
      </menuContribution>/ i+ C# [0 R5 V9 G
8 t, a, d% x& ]9 f: E
      <menuContribution
( }6 k: X+ U8 E& ~7 U0 z            locationURI="toolbar:com.teamcenter.rac.ui.views.DetailsView">
4 y0 R# z" G5 E: q( H$ E$ \; ~3 Q5 }            <command
* Y* p) m. s" c1 U3 G$ y9 F                  commandId="com.plmhome.createFolder.commands.sampleCommand"' W. p. I. P& Y+ }/ n" N6 c& V+ O
                  icon="icons/sample.gif"  ]7 W( n4 J% L% N5 Q
                  tooltip="Say hello world"
1 Q) Q. V1 x5 I8 Y: l8 U) F                  id="com.plmhome.createFolder.menus.sampleCommand">
, ?9 ], j, O  V6 f            </command>
9 l. c) o' i6 b9 V          </menuContribution>
; m( f% f5 U7 Y/ j( I; v% Q6 T$ [$ V2 d' a' F3 ^5 |, X
2 c8 i# `% g8 H2 I% H. _$ ~& `# f
      <menuContribution
; b$ q. Q, T! g% ~' b) B2 g2 l* {" k- Q            locationURI="toolbar:navigator_Toolbar?after=additions">
8 w( R& V! A+ @              <toolbar
9 g# Y" N5 u# l* Y  U% {+ ~( i               id="com.plmhome.createFolder.toolbars.sampleToolbar">
7 M0 M) ?* _% k4 S  y% r            <command
' q  U/ G/ R  T7 T0 \: S' m/ F                  commandId="com.plmhome.createFolder.commands.sampleCommand"
+ e- H( M1 m- d( l: H' v" n% Q: Y                  icon="icons/sample.gif"" _7 [/ z  q4 R: D
                  tooltip="Say hello world"
' b& T, @  K5 t- p$ ]& J                  id="com.plmhome.createFolder.toolbars.sampleCommand">
/ Z1 z  }7 c. I3 Y6 m            </command>
8 Y  Z2 X& X$ O' J            </toolbar>; I" F! I& N  m0 _
          </menuContribution>+ y4 ]" z, f9 S* h$ a6 [' h

; R. ]) N) H/ D0 R
" Q: |% k$ W5 s9 P0 l   </extension>5 }5 E5 D  n; v- t; a6 E. A- n/ `# m

( ]& L; p! H4 v7 ]" E; d</plugin>- X- U* X( |$ h$ s+ ~4 h$ K, v+ q
) K2 W3 H6 u" P4 A9 a6 H* n
; U) C, j( E9 O" r: C7 \) h
- a# W0 v" j, r' U% u
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了