Eclipse plug-in development: org. Eclipse. UI. popupmenus multi-level sub-menu

Source: Internet
Author: User

A year ago, the plan was to develop a set of MDD tools to simplify R & D, standardize and provideCodeQuality.

The mdd I understand consists of four parts:

First, modeling (data model and Object Model)

Second, a set of universal generators (freemarker)

Third, the company edition dedicated eclipse

4. High-quality code templates (long-term accumulation process)

Steps 1 and 4 are the foundation, but they depend on steps 2 and 3. Comments
Let's talk about the code.

<! -- Right-click Project menu -->
< Extension Point = "Org. Eclipse. UI. popupmenus" >

< Objectcontribution Objectclass = "Org. Eclipse. jdt. Internal. Core. javaproject" ID = "Cn.net. comsys. mdd. Frame. porjectmenu" >

< Menu ID = "Ucittools" Label = "Ucit Tools" >
< Separator Name = "Dir1" >   </ Separator >
</ Menu >
< Menu ID = "Is" Label = "Is Tools" Path = "Ucittools/dir1" >

< Separator Name = "Istools" >   </ Separator >
</ Menu >
< Menu ID = "Ut" Label = "Ut Tools" Path = "Ucittools/dir1" >
< Separator Name = "Uttools" >   </ Separator >
</ Menu >

< Action
Enablesfor = "1"
Label = "Add is module"
Icon = "Icons/sample.gif"
Class = "Cn.net. comsys. mdd. Frame. Is. Actions. isprojectaddmodule"
ID = "Addismodule"
Menubarpath = "Ucittools/is/istools" >

</ Action >
< Action
Enablesfor = "1"
Label = "Add ut module"
Icon = "Icons/sample.gif"
Class = "Cn.net. comsys. mdd. Frame. ut. Actions. utprojectaddmodule"
ID = "Addutmodule"
Menubarpath = "Ucittools/UT/uttools" >

</Action>
</Objectcontribution>
</Extension>

Java code:

Package Cn.net. comsys. mdd. Frame. ut. actions;

ImportOrg. Eclipse. jface. Action. iaction;
ImportOrg. Eclipse. jface. dialogs. messagedialog;
ImportOrg. Eclipse. jface. Viewers. iselection;
ImportOrg. Eclipse. UI. iobjectactiondelegate;
ImportOrg. Eclipse. UI. iworkbenchpart;
ImportOrg. Eclipse. UI. iworkbenchwindow;

/**
* @ author Jif
* @ version Creation Time: 05:41:40
* E-mail: liaojifeng@163.com
* class description:
*
*/
Public class utprojectaddmodule implements iobjectactiondelegate {
private iworkbenchwindow window;

@ override
Public void setactivepart (iaction arg0, iworkbenchpart arg1) {
// todo auto-generated method stub

}

@ override
Public void Run (iaction arg0) {
// todo auto-generated method stub
system. out. println ( " ut framework, Run mouse client ...... " );
}

@ Override
Public VoidSelectionchanged (iaction arg0, iselection arg1 ){
//Todo auto-generated method stub

}

}

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.