Thursday, February 16, 2006

Forgotten datatypes part 2....

It was just pointed out to me that many people many not know how to get the code for a custom renderer into an extension that SQL Developer will use. So here's the rest of the steps to getting your custom column renderer into SQL Developer.


The first thing which will be needed is an extensio.xml file to describe the extension.


<extension xmlns="http://jcp.org/jsr/198/extension-manifest"
id="net.jokr.columnrenderer"
version="0.0.0.1"
esdk-version="1.0">
<name>Example Custom Column Renderer</name>
<owner>Kris Rice</owner>
<hooks>
<jdeveloper-hook xmlns="http://xmlns.oracle.com/jdeveloper/1013/extension">
<addins>
<addin>CustomColRendererAddin</addin>
</addins>
</jdeveloper-hook>
<feature-hook>
<description>Example Column Display</description>
<optional>true</optional>
</feature-hook>
</hooks>
</extension>


Now to stich it all together, here's the ant build file I used for this example. There's a few properties to setup the location of SQL Developer which will of course have to be changed per install. The extension.xml from above is use in the jar which created. The final step to getting this all to work is simply putting the produced jar file into the /jdev/extensions folder.


<project name="Custom Columns Renderer" default="deploy">
<target name="init">
<property name="sdev.home" value="../raptor/ide/" />
<property name="extension.filename" value="net.jokr.xmlcolumnrenderer.jar" />
<property name="built" value="build" />

<path id="compile.classpath">
<fileset dir="${sdev.home}/ide/lib" includes="*.jar" />
<fileset dir="${sdev.home}/jdbc/lib" includes="*.jar" />
<fileset dir="${sdev.home}/jdev/extensions" includes="oracle.onlinedb.jar" />
<fileset dir="${sdev.home}/jdev/extensions" includes="oracle.sqldeveloper.jar" />
<fileset dir="${sdev.home}/jdev/lib" includes="jdev.jar, ojc.jar, jdev-patch.jar" />
</path>
</target>

<target name="compile" depends="init"
description="Compile java code">
<delete dir="${built}/classes" />
<mkdir dir="${built}/classes" />
<javac classpathref="compile.classpath" destdir="${built}/classes"
source="1.5" target="1.5" debug="true" includeAntRuntime="false">
<src path="src" />
</javac>
</target>

<target name="jar" depends="compile"
description="Create the extension jar">

<jar basedir="${built}/classes"
destfile="${built}/${extension.filename}">
<zipfileset prefix="META-INF" dir="." includes="extension.xml" />
</jar>
</target>

<target name="deploy" depends="jar"
description="Deploy into the ide extensions directory">
<copy file="${built}/${extension.filename}"
tofile="${sdev.home}/jdev/extensions/${extension.filename}" />
</target>

</project>

No comments: