From NeOn Wiki

To let the plugin know that a different project/ontology has been selected in the TreeView, use the following code:

Add a listener somewhere (e.g. in createPartControl):

// add listener to get notified when user clicks on ontology/project
IWorkbenchWindow window = getViewSite().getWorkbenchWindow();
window.getSelectionService().addPostSelectionListener(this);


Update the plugin view based on the event:

public void selectionChanged(IWorkbenchPart part, ISelection selection) {
  if (selection instanceof TreeSelection) {
    TreeSelection ts = (TreeSelection)selection;
    Object elem = ts.getFirstElement();
    if (elem instanceof OntologyTreeElement) {
       OntologyTreeElement ote = (OntologyTreeElement)elem;
       ontologyID = ote.getOntologyUri();
       projectName = ote.getProjectName();
       setFocus();
    }
  }
}