About developing plugins in Eclipse (ii)

Source: Internet
Author: User

Description of the various settings for the original Plugin.xml file:

Attach the generated file code:

1 <?XML version= "1.0" encoding= "UTF-8"?>2 <?Eclipse version= "3.4"?>3 <plugin>4    <extension5           Point= "Org.eclipse.ui.actionSets">6       <Actionset7             label= "Sample Action Set"8 Visible= "true"9 ID= "Myplugin.actionset">Ten          <Menu One                label= "Sample &amp; Menu " A ID= "Samplemenu"> -             <Separator -                   name= "Samplegroup"> the             </Separator> -          </Menu> -          <Action -                label= "&amp; Sample Action " + icon= "Icons/sample.gif" - class= "Myplugin.actions.SampleAction" + tooltip= "Hello, Eclipse World" A Menubarpath= "Samplemenu/samplegroup" at Toolbarpath= "Samplegroup" - ID= "Myplugin.actions.SampleAction"> -          </Action> -       </Actionset> -    </extension> - </plugin>

The following settings are described in detail:

(1) <plugin>

<plugin

Id= "Myplugin2"

Name= "Myplugin2 Plugin"

version= "1.0.0"

Privider-name= ""

Class= "Myplugin2. Myplugin2plugin ">

<plugin> is the main body of Plugin.xml.

ID: The unique identity of the plug-in. The actual project typically adds a package name or URL to name the ID. For example: The Tomcat plugin for Eclipse is named this way: Org.eclipse.tomcat, so

In the world there will be no plug-in identity name and you have the same name. Later, the properties in some extension points will also use identifiers as prefixes for names.

Name: Plug-in names, can not be unique.

Version: the plug-in revision number.

Provider-name: The name of the plugin developer. You can write the author's name or company name.

Class: The name of the plug-in class. That is, the class of the Mypluginplugin2.java file that the plug-in project automatically generates. Add the package name in front.

(2) <runtime>

<runtime>

<library name= "Myplugin2.jar" >

<export name= ""/>

</library>

</runtime>

Description This is the jar package that is required to declare the plug-in to run. For example, a plugin needs a package to connect to the MySQL database.

is defined as follows, where "lib\" is the path to the package. The jar package of the plug-in itself is also declared. And when the plugin is packaged,

will be packaged in the name Myplugin2.jar.

<runtime>

<library name= "Myplugin2.jar" >

<export name= ""/>

</library>

<library name = "Lib\mysql-connector-java-3.0.9-stable-bin.jar" >

</runtime>

(3) <requires>

<requires>

<import plugin= "Org.eclipse.ui" >

<import plugin= "Org.eclipse.core.runtime"/>

</requires>

Description: In the requires domain, you define the dependency plug-in that the plugin will use, and now there are two. As the development continues to deepen.

More references to other plugins will be added here.

<extension> sets the extension point to be extended, which is a very important item.

<extension point= "Org.eclipse.ui.actionSets" > sets the extension point of this plugin, actionsets is the extension point of the Eclipse's menu, menus, and toolbar buttons.

The <actionSet> item represents an action group (menu, Button). The label is the name that is displayed, the ID of its unique identifier.

Just make sure that there is no duplicate ID in this plugin.xml file. Visible refers to whether the button or menu set is displayed. If set to False, it is not displayed. (Note: To see the effect of the visible setting, first turn the perspective off and back on)

<menu> is a subkey under <actionSet>, which indicates that inserting a main menu named "Sample menu (M)" In Eclipse is displayed.

The separator tag is a terminator that can group menus.

<action> is also a sub-item under <actionSet>, set by It menu, button, icon is the path of the picture.

If the package name is also added, Menubarpath indicates that the action is made into a menu item. Put it on the top <menu> define the main menu,

Toolbarpath says to make this action a toolbar button. ID is an identifier and is recommended to be set to the same name as the class item.

The above is only one of the extension points of the Eclispe. There are also other extension points that are more than 100. We just need to be familiar with some of the common ones.

such as the extension point of the view org.eclipse.ui.views the org.eclipse.ui.editors of the editor.

Modify Plugin.xml for HelloWorld

The most important thing is the setup of the Plugin.xml file. Mastering it is the only way to master plug-in development.

About developing plugins in Eclipse (ii)

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.