Loading A Plugin Project in the IDE    (9PR)

This example assumes that you want to put the OWViz tab sources in your IDE. We first checkout the sources for the OWL Viz tab and we configure the IDE to understand these as Java sources. The url for the OWLViz tab is    (9PV)

  http://smi-protege.stanford.edu/repos/protege/protege4/protege-standalone/branches/equinox/plugins/org.coode.owlviz.    (9PW)

Since you are working with your favorite IDE we will assume that you know how to do this step. You should end up with a project that looks something like this.    (9PX)

http://protege.cim3.net/file/work/images/RunningTheOSGiEditor/InitialProject.jpg    (9PY)

Now at this point there are a bunch of compiler errors all due to missing classes. This occurs because the owlviz build tree has been designed to compile in a larger environment which contains references to all of the classes needed to develop the OWLViz tab. But never mind - there are several ways to proceed that satisfy the dependencies. In particular we can either check out the source code of the dependencies or we can use the binary jars from a Protege distribution.    (9PZ)

Personally I have a strong preference for checking out the sources and compiling against them. This takes more time and effort but it has major advantages for the programmer who is trying to debug a problem. It is also the simpler case. But just to keep this relatively short and to cover the more complicated case I will suppose that we want to compile against binary jars. So we look in the manifest of the OWLViz to find out what it depends on (the MANIFEST is in the META-INF directory). Inside the MANIFEST we see a required bundles statement that indicates that OWLViz depends on    (9Q0)

So we make a dependencies directory in the project and get the jar files for these bundles from our Protege distribution. Then we modify the build path for the project to include these jars.    (9Q5)

http://protege.cim3.net/file/work/images/RunningTheOSGiEditor/Dependencies-1.jpg    (9Q6)

At this point you are probably still getting errors. But far fewer - in my case I went from 470+ errors to 24 errors. The reason for the remaining errors is that there are jar files hidden in the bundles that are needed to compile. This is an OSGi thing that probably is not understood by most IDE environments. But it is easy to extract the jars. For graphically minded folk, you can use the fact that a jar file is a specialized form of a zip file and use your favorite unzipper to extract the hidden jar files inside. I generally use unix and use a simple command line call:    (9Q7)

   jar -xf org.protege.common.jar lib    (9Q8)

I just needed to do this with the org.protege.common.jar bundle and everything compiled fine. My resulting set of jars in the dependencies folder were as follows:    (9Q9)

http://protege.cim3.net/file/work/images/RunningTheOSGiEditor/Dependencies-2.jpg    (9QA)