org.ow2.mindEd.adl.editor.graphic.ui.mindAnnotation extension
To define your own annotation, this extension point can be used.
If you are familiar with Eclipse's extension points,
define a new extension org.ow2.mindEd.adl.editor.graphic.ui.mindAnnotation and see
the extension point description for help.
If you are not, these steps will help you declare the extension :
Creating the plug-in project
- Open the New Project... wizard (File > New > Project...)
and choose Plug-in Project from the Plug-in Development category
and click Next.
- On the Plug-in Project page, set the project name and check the box for Create a Java project
(this should be the default). Leave the other settings on the page with their default
settings and then click Next to accept the default plug-in project structure.
- On the Plug-in Content page, look at the default settings. The wizard sets the project name
as the id of the plug-in. The wizard will also generate a plug-in class for your plug-in and allow you to supply additional information about
contributing to the UI. These defaults are acceptable, so click Next.
- Next page is the Templates page. We don't need any of the features proposed by
the templates so uncheck the box for Create a plug-in using one of the templates.
Click Finish.
Creating the extension
- Open the MANIFEST.MF and go to the Extensions tab.
- Click on Add... then search for mindAnnotation using the Extension Point Filter
- You'll notice that the extension point is not visible ; it's because we did not add mindEd plugin in our dependencies list.
Uncheck the box Show only extension points from the required plug-ins and the extension point appears. Select it and Finish.
Eclipse asks if you want to add declaring plug-in in the dependencies list, answer Yes.
Setting up the annotation
The extension is declared, we now have to set our annotation.
- You've got a first element created : (Annotation).
Click on it and notice a field annotationName. Fill it with the annotation which you want to
alter the behavior. e.g. : singleton.
- Right click on (Annotation) and select New > Appearance. Now you can select
how the annotation will alter the appearance of affected elements.
Color : select a color or let the field blank. The element will take this color if it has the annotation.
Icon : select an icon in your project path. The element will display this icon at its upper right.
- By default, the Appearance will have an Components (Element).
This is the type of elements affected by the appearance. It is possible to modify the element type, or add a new one
to let the appearance affect multiple types.
A single annotation can also have multiple appearances for different element types. If it is redundant, only the first one will be applied.
Deploying the plug-in
The plug-in must now be deployed in your Eclipse installation.
- Click on your project and select Export. In the wizard, open the category
Plug-in Development and select Deployable plug-ins and fragments.
Click Next.
- Set the destination directory to your Eclipse folder. e.g. D:\MindEd\eclipse. Click Finish
- The jar plug-in is installed in the eclipse/plugins directory. Eclipse needs to be restarted to take it in account.