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