The open software architecture of Protégé allows programmers to develop custom-tailored extensions which can be integrated into the user interface. These extensions are called Plugins, and this page will help you getting started in developing plugins. Additional information in the context of Protégé in general (independent from the OWL Plugin) can be found in the Protégé Programming Development Kit.
In addition to the default plugin types supported by Protege (e.g. tab widgets, slot widgets, storage plugins and project plugins), the OWL Plugin supports two other types of plugins called OWLTests and FrameActions.
The following steps create and install a simple Protégé Tab Plugin which makes use of OWL-specific services. The Plugin itself will appear as a separate Tab in the main window of Protege, and can be used to list all named classes in the current OWL ontology. Note that this toy example can be taken as a template for your own projects.
Download and Install Protégé and the OWL Plugin
Although many people develop Java software with pure text editors such as
emacs, I will focus on those of you using IDE tools such as Eclipse
or IntelliJ. I personally
prefer using IntelliJ, and so the following steps apply to this nice tool.
It should be pretty straight-forward for you to adapt the procedure to your
other favourite development tool.
To host your project, please create a new folder such as c:/java/protege-owl-tutorial which will contain your working files, source code, etc. You should keep this separate from the rest of Protege itself, because then you can much easier update to the most recent Protege version without overwriting anything. With any new Protege release, you should completely wipe out its folder and reinstall it cleanly.
In your project folder, create a new (IntelliJ) project with the following configuration:

An important issue is that you should take the plugins directory of the Protege installation is the output directory. Thus, the compiler will write the .class files directly into the Protege plugins folder so that Protege will automatically find your custom extensions.
In the next step, let the system generate a folder for your source files, such as c:/java/protege-owl-tutorial/src
Then specify the classpath of your project. Simply add the protege.jar, and all .jar files from the plugins folder to your project. This will make sure you don't get compile-time or run-time errors on missing classes. Note that the jar files shown below may vary in future versions of the OWL Plugin.

In addition to the compiled classes, it will be helpful for you to get the latest source code of Protege and the OWL Plugin, so that you can more easily look what's happening under the hood and debug. To do so, extract the source code of Protege (which can be found in the source folder of your Protege installation, i.e. c:/java/protege-owl/source/protege_src.2.0.zip). Extract this zip file into the source directory. Also download the source code of the OWL Plugin, which you can then directly add to the source path in your project. Add the src folder of the Protege source code to your project, but (in IntelliJ) don't add the folder itself to the project path. It should look approximately like the following screenshot:

Now you are essentially able to start hacking... Whenever you need information on the existing Protege and OWL classes, you can directly jump into their source code (in IntelliJ, just press CTRL+B on a class name such as NamedCls).
Each Protege Plugin is essentially a Java class plus an entry in a so-called
manifest file. The Java class should be derived from the Protege base class
AbstractTabWidget. Here is the source code.
The manifest file is used to tell Protege that a new Plugin has been installed.
The manifest file has to be placed in a directory
called meta-inf in the plugins folder, i.e. in c:/java/protege-owl/plugins/META-INF/MANIFEST.MF.
It must have one entry for each new plugin.
The most important classes you may need are in the edu.stanford.smi.protegex.owl.model package: This package contains interfaces which provide access to the ontology objects, i.e. the classes, properties, individuals, etc. We provide a small UML Diagram of the OWL model interfaces for your convenience. Note that the model interfaces are based on the Protege model interfaces (Cls, Slot, SimpleInstance). As a consequence, we always use the term slot when we talk about properties.
Test
your Plugin
If everything is installed correctly, you can now start and debug your new Plugin from inside of the Java IDE. To execute it, use the Protege folder as the base execution directory:

In order to see your plugin inside Protege, you may need to activate it in the Project/Configure... dialog:

Now, you should see something like the following:

The full IntelliJ project and configuration can be found in this zip file. This is a very simple tab only, and far from being bug-free. It simply demonstrates how to react to knowledge base changes, and how to access the elements inside of a knowledge base.
Distribute your plugin
In order to make your plugin executable from normal Protege installations (outside of the IDE), you need to put it into a subfolder of the plugins directory, and distribute this subfolder (zipped) to others. Please look at how other plugins such as OWLViz are being distributed. You could for example create a subfolder com.mycompany.myplugin and place the jar files and a plugin.properties file into it. Note that all plugins must reside in their own folder, so that they don't conflict with each other. You need however to tell Protege that your plugin depends on the classes of the OWL Plugin, so that you can access them. To do so, please declare dependency on the OWL Plugin using the plugin.properties file. For more information on how to distribute your plugin, please check the general information on developing Protege plugins at http://protege.stanford.edu/doc/pdk/index.html
As usual in the Protege community, please don't hesitate to contact the help and discussion lists to get information. Finally, whenever you have developed something interesting, please let us know. Please contribute your plugin to the Plugins library if it is of general use.