Eclipse custom extension points

Source: Internet
Author: User
Composition

An extension point includes the ID, name, and schema file. The Shema file is named by ID and suffixed with. exsd, which is stored in the plug-in schema directory.

After you use the eclipse Wizard to create an extension point, an extension element is automatically generated. This element consists of three attributes: Point, ID, and name. You can add sub-elements to the extension element through the combination of choice and sequence to enhance the meaning of the extension point. For more information about the elements, attributes, choice, and sequence, see the w3school XML tutorial and schema tutorial.

Attribute details

NameAttribute name

DeprecatedIndicates whether to abolish this attribute.

UseIndicates whether this attribute is required when it is extended,

AvailableRequired, optional, and default,

If default is selected, if this attribute is not filled in, the value is filled in.

TypeAttribute type, which can be:Boolean, String, Java, Resource.

If the attribute is set to either true or false, use the boolean type,

If the attribute is a Java class or interface, use Java,

If the attribute represents a file, use resource,

In other cases, select string

ExtendsIf type is set to Java, enter the fully-restricted class name (class name + package name) of the class to be inherited)

ImplementsIf type is set to Java, enter the full-restricted Interface Name of the interface to be implemented.

TranslatableIf type is set to string, it indicates whether the string should be translated.

RestrictionsIf type is set to string, you can add the enumerated values of this string.

DescriptionAttribute document

ValueIf use is set to default, enter the default attribute value here.

Choice and sequence Add sub-elements

Common combinations are as follows:

----------------------------------------------------------------------------------

Declaration of XML format in Schema

----------------------------------------------------------------------------------

<Parent element...> + Sequence

<Child element.../> child element

</Parent element>

----------------------------------------------------------------------------------

<Parent element...> + Sequence

<Child element.../> child element

<Child element.../> [minoccurs = "0"]

... [Maxoccurs = "unbounded"]

</Parent element>

----------------------------------------------------------------------------------

<Parent element...> + Sequence

<Child element 1.../> child element 1

<Child element 1.../> [minoccurs = "0"]

... [Maxoccurs = "unbounded"]

<Child element 2.../> child element 2

<Child element 2.../> [minoccurs = "0"]

... [Maxoccurs = "unbounded"]

</Parent element>

----------------------------------------------------------------------------------

<Parent element...> + Sequence

<Child element 1.../> child element 1

<Child element 2.../> + choice

Or child element 2.

<Child element 1.../> child element 3

<Child element 3.../>

</Parent element>

Get extended point attributes and Instances
Iextension [] extensions = platform. getextensionregistry ()
. Getextensionpoint ("plug-in ID of a custom extension point", "extension point id ")
. Getextensions ();
......
Iconfigurationelement [] configelements =
Extensions [I]. getconfigurationelements ();
......
// Obtain the attribute value
Configelements [J]. getattribute ("attribute name ");
......
// Obtain the instance of the class or interface declared in the attribute
Configelements [J]. createexecutableextension ("attribute name ");
References

Eclipse plug-ins

W3school

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.