This tutorial lets you create a module which defines a
way to add a service to the IDE's lookup system using an XML file.
In this simple case, the interface that will be provided is
java.awt.Shape
. The actual objects will be quad curves
with parameters defined by the XML file. You will see both how to
define the XML format and translate it into a live Java object, and
how to register such services.
org.yourorg.QuadCurveXMLProcessor
.
<filesystem>
element) into your layer.
<!ELEMENT quadcurve EMPTY> <!ATTLIST quadcurve x1 CDATA #REQUIRED y1 CDATA #REQUIRED x2 CDATA #REQUIRED y2 CDATA #REQUIRED ctrlx CDATA #REQUIRED ctrly CDATA #REQUIRED >(Registering the DTD is not strictly necessary. But if an XML editing module is installed, having the DTD available locally and registered by its public ID will mean that structure editing will be possible on it without making a network connection. So it is always a good habit to keep the IDE's internal entity catalog current this way.)
instanceClass
points
to your processor class. If the ID is mistyped, the processor will never be used.
<filesystem>
element):
<folder name="Services"> <folder name="Hidden"> <file name="org-yourorg-sample-shape.xml" url="sample-shape.xml"/> </folder> </folder>You also need to make the XML file, in this case in the same folder as the layer, and named sample-shape.xml (you can use the text file template again and choose the extension xml - be careful not to add it to the list of general extensions for text files though):
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE quadcurve PUBLIC "-//Your Org//DTD Some Description 1.0//EN" "http://yourorg.org/dtds/some_description-1_0.dtd"> <quadcurve x1="0" y1="0" x2="100" y2="100" ctrlx=".5" ctrly=".5"/>It is important that there be a
DOCTYPE
and that the public ID
match what you registered.
QuadCurve2D$Float
.