Customizing the Eclipse IDE's features (i)

Source: Internet
Author: User

Review above: Customizing the Eclipse IDE's interface chapter This article will document some of the Eclipse plug-in extensions (extension) and simply describe the usage of common extensions, but may not be so detailed. The expansion of my main plugin is as follows: First, Org.eclipse.ui.startupThis expansion can be said to be critical, and he can let us do some events at the time of Eclipse startup (and then a lot of small-function things depend on it). XML configuration:
< extension       Point = "Org.eclipse.ui.startup" >  < Startup           class = "Com.bingo.start.BTStart" >  </ Startup > </ extension >  
Corresponding implementation class:
 Public classBtstartImplementsistartup{ PublicBtstart () {} Public voidEarlystartup () {//irrelevant UI code can be written hereJob Job=NewUijob ("") {                Publicistatus runinuithread (Iprogressmonitor monitor) {Try {                                            //the code that touches the UI is written here, otherwise it won't work.}Catch(executionexception e) {e.printstacktrace (); returnStatus.cancel_status; }                    returnStatus.ok_status;          }          }; Job.schedule (300L);//300ms after execution              }}

Second, Org.eclipse.ui.newWizardsThis is the guide extension. Just like the new project, and then the next step. Here I used to do the new Application template project, in the wizard to expand the implementation of the application template generation. XML configuration:
<extension Point= "Org.eclipse.ui.newWizards">     <categoryID= "Bt_project"name= "%category.name">     </category>     <Wizardcategory= "Bt_project"class= "Com.bingo.perspective.ui.wizards.BTProjectWizard"finalperspective= "Com.bingo.ide.perspective"icon= "Icons/eclipse16.png"ID= "Com.bingo.perspective.wizards.BTProjectWizard"name= "%projcet.name"Project= "true">     </Wizard></extension>

Corresponding implementation class:

 Public class extends Implements
The specific code does not show, Btprojectwizard is just a container, he also needs to add wizardpage in. You can also add the wizard extension to the right-click menu. The XML configuration is as follows:
<extension Point= "Org.eclipse.ui.navigator.navigatorContent">  <CommonwizardAssociatedextensionid= "Org.eclipse.ui.navigator.resourceContent"type= "new"WizardID= "Com.bingo.perspective.wizards.BTProjectWizard">     <enablement>     </enablement>  </Commonwizard></extension>

Third, Org.eclipse.ui.menusAdd items individually in the menu bar. For example: I add a synchronization menu XML configuration:
<extension Point= "Org.eclipse.ui.menus">  <menucontributionallpopups= "false"Locationuri= "Menu:help?before=org.eclipse.equinox.p2.ui.sdk.install">       <CommandcommandId= "Com.bingo.perspective.ui.SyncHandler"label= "Synchronize Bingotouch template"style= "Push">     </Command>  </menucontribution></extension><extension Point= "Org.eclipse.ui.commands">   <CommandDefaultHandler= "Com.bingo.perspective.ui.handler.SyncHandler"ID= "Com.bingo.perspective.ui.SyncHandler"name= "Synchronize Bingotouch template">  </Command></extension> 
Implementation class:
 Public class extends abstracthandler{     public SyncHandler ()     {     }     public   Object Execute (executionevent event)          throws  executionexception     {             Check the template version           syncresource.start ()          ; return NULL ;     }}

Iv. org.eclipse.ui.perspectivesTo define a perspective XML configuration:
<extension Point= "Org.eclipse.ui.perspectives">  <Perspectiveclass= "Com.bingo.perspective.BingoTouchPerspective"fixed= "true"icon= "Icons/eclipse16.png"ID= "Com.bingo.ide.perspective"name= "%perspective.name">  </Perspective></extension>
Implementation class: The implementation of the class content is the layout of the view, in the first article is written. Wu, Org.eclipse.ui.actionSetsDefines an action action that can be placed on a menu bar or toolbar.
XML configuration:
<extension Point= "Org.eclipse.ui.actionSets">    <Actionsetlabel= "Bingotouch Action Set"Visible= "true"ID= "Com.bingo.functions.actionSet">          <Menulabel= "%document.name"ID= "Btdoc">          <Separatorname= "Btdocgroup">          </Separator>          </Menu>          <Actionclass= "Com.bingo.perspective.ui.actions.OnlineDocumentAction"icon= "Icons/icon/faq.png"ID= "Btfaq"label= "%faqdoc.name"Menubarpath= "Btdoc/btdocgroup"Toolbarpath= "Btdocgroup"tooltip= "%faqdoc.name">          </Action>          <Actionclass= "Com.bingo.perspective.ui.actions.OnlineDocumentAction"icon= "Icons/icon/uidoc.png"ID= "Btuidoc"label= "%uidoc.name"Menubarpath= "Btdoc/btdocgroup"Toolbarpath= "Btdocgroup"tooltip= "%uidoc.name">          </Action>          <Actionclass= "Com.bingo.perspective.ui.actions.OnlineDocumentAction"icon= "Icons/icon/apidoc.png"ID= "Btapidoc"label= "%apidoc.name"Menubarpath= "Btdoc/btdocgroup"Toolbarpath= "Btdocgroup"tooltip= "%apidoc.name">          </Action>    </Actionset></extension>

Inside Menubarpath, Toolbarpath operation Button put or not put, put where.

The usual expansion is introduced here, the purpose is to hope that you know there is this thing, rather than how to achieve the specific. This article for the original article, reproduced please retain the original source, convenient traceability, if there is the wrong place, thank you correct.
This address: http://www.cnblogs.com/lovesong/p/4693666.html

Customizing the Eclipse IDE's features (i)

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.