Difference between revisions of "PluginTypes"

From Protege Wiki
Jump to: navigation, search
(EditorKitMenuAction: Added example plugin.xml code)
(Existing Plugin Types: Tabs added, EditorKitFactory added)
Line 17: Line 17:
  
 
=== Core Plugins ===
 
=== Core Plugins ===
 
==== EditorKitFactory ====
 
 
==== WorkspaceTab ====
 
  
 
==== ViewComponent ====
 
==== ViewComponent ====
Line 30: Line 26:
 
* Implement: '''org.protege.editor.core.ui.view.ViewComponent'''
 
* Implement: '''org.protege.editor.core.ui.view.ViewComponent'''
 
* Example: '''org.protege.editor.owl.ui.clshierarchy.ToldOWLClassHierarchyViewComponent'''
 
* Example: '''org.protege.editor.owl.ui.clshierarchy.ToldOWLClassHierarchyViewComponent'''
 +
 +
<hr>
  
 
==== ViewAction ====
 
==== ViewAction ====
 +
 +
<hr>
  
 
==== menu.window ====
 
==== menu.window ====
 +
 +
<hr>
  
 
==== EditorKitMenuAction ====
 
==== EditorKitMenuAction ====
Line 64: Line 66:
  
 
''editorKitId'' = the type of editor kit this plugin works with
 
''editorKitId'' = the type of editor kit this plugin works with
 +
 +
<hr>
  
 
==== ToolBarAction ====
 
==== ToolBarAction ====
 +
 +
<hr>
  
 
==== preferencespanel ====
 
==== preferencespanel ====
Line 79: Line 85:
 
* Implement: '''org.protege.editor.owl.ui.preferences.PreferencesPanel'''
 
* Implement: '''org.protege.editor.owl.ui.preferences.PreferencesPanel'''
 
* Example: '''org.protege.editor.owl.ui.tree.OWLTreePreferencesPanel'''
 
* Example: '''org.protege.editor.owl.ui.tree.OWLTreePreferencesPanel'''
 +
 +
<hr>
 +
 +
==== WorkspaceTab ====
 +
 +
Unless your tab requires some special handling for events or non-standard layout you will probably not need to implement a class for this plugin.
 +
You can just point the plugin.xml configuration to WorkspaceViewsTab (or OWLWorkspaceViewsTab) implementation and the rest of the plugin description
 +
should be enough to customise the tab - ie give it a name and point to a default layout (see below).
 +
 +
* Implement: '''org.protege.editor.core.ui.workspace.WorkspaceTab'''
 +
* Example: '''org.protege.editor.owl.ui.OWLClassesTab'''
 +
 +
===== Creating a tabbed view layout =====
 +
* First, create or decide on which views you wish to have on your tab - make sure these are all implemented
 +
* Open Protege 4.0
 +
* Create a new tab ('''Tabs | Create new tab...''')
 +
* Select your new tab and start customising it by adding views (see [Protege4GettingStarted#Reconfigure_the_User_Interface])
 +
* Select '''Tabs | Save current layout''' or quit Protege
 +
* Find the new layout in the Protege installation directory ''Data/ViewConfigurations/viewconfig-custom-YOUR_TAB_NAME.xml''
 +
* Rename this without the ''custom'' and copy to somewhere in your plugin source like a ''resources/'' folder
 +
* Make sure this folder is on your classpath and that it gets added to you compiler output path
 +
* Add the layout ('''defaultViewConfigFileName''') to the plugin description in plugin.xml
 +
 +
    <extension id="OWLOntologyTab"
 +
                point="org.protege.editor.core.application.WorkspaceTab">
 +
        <label value="Active Ontology"/>
 +
        <class value="org.protege.editor.core.ui.workspace.WorkspaceViewsTab"/>
 +
        <defaultViewConfigFileName value="viewconfig-ontologytab.xml"/>
 +
        <index value="A"/>
 +
        <editorKitId value="OWLEditorKit"/>
 +
    </extension>
 +
 +
 +
 +
<hr>
 +
 +
==== EditorKitFactory ====
 +
 +
An EditorKit is the access point for a particular type of model (or ontology) and a GUI to handle that model.
 +
 +
Currently, there is just one implementation - the OWLEditorKit
 +
 +
Implement this type of plugin if you require a new type of model to be supported (eg a Frames-based model).
 +
 +
There is obviously considerable work needed to implement a new editor kit (along with its model manager and workspace).
 +
 +
* Implement: '''org.protege.editor.core.editorkit.EditorKitFactory'''
 +
* Example: '''org.protege.editor.owl.OWLEditorKitFactory'''
  
 
=== OWL Plugins ===
 
=== OWL Plugins ===
  
 
==== inference.reasonerfactory ====
 
==== inference.reasonerfactory ====
 +
 +
<hr>
  
 
==== ui.renderer.entitycolorprovider ====
 
==== ui.renderer.entitycolorprovider ====
 +
 +
<hr>
  
 
==== model.libraryfactory ====
 
==== model.libraryfactory ====

Revision as of 01:51, July 18, 2008

Protege 4 Plugin types

This page summarises the default types of plugin that can be implemented for Protege 4.



Back to Protege4DevDocs


Existing Plugin Types

This is a snapshot of the existing types of plugins that can be added to Protege4.0. The current set of plugin types can always be found in the code by looking at the plugin.xml file for the core.application and the owl bundles. Just look for the extension-points in these files - these point to the schemas that are used for describing each type of plugin. Plenty of examples can be found in the plugin.xml files themselves.

Core Plugins

ViewComponent

Implementation of this plugin is demonstrated in the TabbedHierarchyView example.

There are many abstract implementations of this plugin to use as a base, for example each entity type (Class, Property and Individual) has an abstract base.

  • Implement: org.protege.editor.core.ui.view.ViewComponent
  • Example: org.protege.editor.owl.ui.clshierarchy.ToldOWLClassHierarchyViewComponent

ViewAction


menu.window


EditorKitMenuAction

Create an entry in a menu (and supply a mnemonic) and its associated action.

  • Implement: org.protege.editor.core.ui.action.ProtegeAction
  • Example: org.protege.editor.owl.ui.action.RemoveAllDisjointAxiomsAction
   <extension id="menu.RemoveAllDisjointAxioms"
              point="org.protege.editor.core.application.EditorKitMenuAction">
       <name value="Remove all disjoint axioms..."/> 
       <toolTip value="Removes all of the disjoint axioms."/>
       <class value="org.protege.editor.owl.ui.action.RemoveAllDisjointAxiomsAction"/>
       <path value="org.protege.editor.core.application.menu.EditMenu/SlotM-H"/>
       <editorKitId value="OWLEditorKit"/>
   </extension>

id = an ID for this plugin

point = the type of plugin

name = the name as it appears in the menu

toolTip = a description of the action shown in a tooltip

class = the implementing class (full package name)

path = the relative position in the menu (section pos, subsection pos)

editorKitId = the type of editor kit this plugin works with


ToolBarAction


preferencespanel

Create a panel that will be loaded into the preferences dialog.

This should be for controlling a particular aspect of Protege4.0 in general or can be used as part of a bundle to control the behaviour of other plugins.

Preferences should be used to persist over sessions.

The applyChanges() method should be used to update the appropriate values in Protege's PreferencesManager.

  • Implement: org.protege.editor.owl.ui.preferences.PreferencesPanel
  • Example: org.protege.editor.owl.ui.tree.OWLTreePreferencesPanel

WorkspaceTab

Unless your tab requires some special handling for events or non-standard layout you will probably not need to implement a class for this plugin. You can just point the plugin.xml configuration to WorkspaceViewsTab (or OWLWorkspaceViewsTab) implementation and the rest of the plugin description should be enough to customise the tab - ie give it a name and point to a default layout (see below).

  • Implement: org.protege.editor.core.ui.workspace.WorkspaceTab
  • Example: org.protege.editor.owl.ui.OWLClassesTab
Creating a tabbed view layout
  • First, create or decide on which views you wish to have on your tab - make sure these are all implemented
  • Open Protege 4.0
  • Create a new tab (Tabs | Create new tab...)
  • Select your new tab and start customising it by adding views (see [Protege4GettingStarted#Reconfigure_the_User_Interface])
  • Select Tabs | Save current layout or quit Protege
  • Find the new layout in the Protege installation directory Data/ViewConfigurations/viewconfig-custom-YOUR_TAB_NAME.xml
  • Rename this without the custom and copy to somewhere in your plugin source like a resources/ folder
  • Make sure this folder is on your classpath and that it gets added to you compiler output path
  • Add the layout (defaultViewConfigFileName) to the plugin description in plugin.xml
   <extension id="OWLOntologyTab"
               point="org.protege.editor.core.application.WorkspaceTab">
       <label value="Active Ontology"/>
       <class value="org.protege.editor.core.ui.workspace.WorkspaceViewsTab"/>
       <defaultViewConfigFileName value="viewconfig-ontologytab.xml"/>
       <index value="A"/>
       <editorKitId value="OWLEditorKit"/>
   </extension>



EditorKitFactory

An EditorKit is the access point for a particular type of model (or ontology) and a GUI to handle that model.

Currently, there is just one implementation - the OWLEditorKit

Implement this type of plugin if you require a new type of model to be supported (eg a Frames-based model).

There is obviously considerable work needed to implement a new editor kit (along with its model manager and workspace).

  • Implement: org.protege.editor.core.editorkit.EditorKitFactory
  • Example: org.protege.editor.owl.OWLEditorKitFactory

OWL Plugins

inference.reasonerfactory


ui.renderer.entitycolorprovider


model.libraryfactory