Extending the Rodin Database: Difference between revisions
imported>Son |
imported>Son |
||
Line 2: | Line 2: | ||
== Adding a New Attribute to Existing Elements == | == Adding a New Attribute to Existing Elements == | ||
=== Declare a New Attribute === | |||
The extension point <code>org.rodinp.core.attributeTypes</code> to declare a new attribute. | The extension point <code>org.rodinp.core.attributeTypes</code> to declare a new attribute. | ||
Line 16: | Line 18: | ||
</extension> | </extension> | ||
The attribute has an ID (which should be always unique) which also contain the project name, i.e. <code>org.eventb.developer.examples.stringAttr</code>. This unique ID will be used for access the value corresponding to this attribute of an element later. The name of the attribute is a string that could be externalised to be used for displaying to the users in the future. There are five different attribute kinds: ''boolean'', ''handle'', ''integer'', ''long'', ''string''. | The attribute has an ID (which should be always unique) which also contain the project name, i.e. <code>org.eventb.developer.examples.stringAttr</code>. This unique ID will be used for access the value corresponding to this attribute of an element later. The name of the attribute is a string that could be externalised to be used for displaying to the users in the future. There are five different attribute kinds: ''boolean'', ''handle'', ''integer'', ''long'', ''string''. | ||
=== Access the Newly Created Attribute === | |||
Depending on the kind of the attribute, one can use one of the following method to access the value corresponding to the attribute of any |
Revision as of 16:30, 24 March 2010
Adding a New Element
Adding a New Attribute to Existing Elements
Declare a New Attribute
The extension point org.rodinp.core.attributeTypes
to declare a new attribute.
In the example below, we assume that the extensions are developed within a plug-in project with name org.eventb.developer.examples
The following extension declares a new string attribute.
<extension point="org.rodinp.core.attributeTypes"> <attributeType id="stringAttr" kind="string" name="%eventBStringAttribute"> </attributeType> </extension>
The attribute has an ID (which should be always unique) which also contain the project name, i.e. org.eventb.developer.examples.stringAttr
. This unique ID will be used for access the value corresponding to this attribute of an element later. The name of the attribute is a string that could be externalised to be used for displaying to the users in the future. There are five different attribute kinds: boolean, handle, integer, long, string.
Access the Newly Created Attribute
Depending on the kind of the attribute, one can use one of the following method to access the value corresponding to the attribute of any