public boolean handleNewRequest() throws Exception {
   if (5 > 4) return super.handleNewRequest();
   boolean handleNewSuccess = false;
   CreateHGOntologyWizard w = new CreateHGOntologyWizard(null, this);
   int result = w.showModalDialog();
   if (result == Wizard.FINISH_RETURN_CODE) {
     OWLOntologyID oid = w.getOntologyID();
     if (oid != null) {
       HGOwlModelManagerImpl mm = (HGOwlModelManagerImpl) getOWLModelManager();
       // check if already exists
       // we are catching specific exceptions here instead of checking
       // the cases before the
       // call to mm.createNewOntology.
       try {
         mm.createNewOntology(oid, w.getLocationURI());
         // addToRecent(URI.create(prop.getProperty("hibernate.connection.url")));
         addRecent(w.getLocationURI());
         handleNewSuccess = true;
       } catch (OWLOntologyAlreadyExistsException e) {
         showNewExistsOntologyIDMessage(oid, e.getDocumentIRI());
       } catch (OWLOntologyDocumentAlreadyExistsException e) {
         showNewExistsDocumentLoadedMessage(oid, e.getOntologyDocumentIRI());
       } catch (HGDBOntologyAlreadyExistsByDocumentIRIException e) {
         showNewExistsDocumentRepoMessage(oid, e.getOntologyDocumentIRI());
       }
     }
   }
   return handleNewSuccess;
 }
 /**
  * Deletes an ontology from Hypergraph Repository.
  *
  * @param physicalURI
  * @return
  */
 protected boolean handleDeleteFrom(OntologyRepositoryEntry ontologyEntry) {
   // A) Check, if the ontology is already loaded and/or managed and
   // whether it can be found in
   // the repository.
   OWLOntologyID oID = ((HGOntologyRepositoryEntry) ontologyEntry).getOntologyID();
   if (oID == null) throw new IllegalStateException();
   HGOwlModelManagerImpl hmm = (HGOwlModelManagerImpl) getOWLModelManager();
   PHGDBOntologyManagerImpl hom = (PHGDBOntologyManagerImpl) hmm.getOWLOntologyManager();
   OWLOntology loadedOntoToDelete = hom.getOntology(oID);
   // will be null if not loaded.
   // getOntologyCatalogManager().Ontologies()
   // B) Provide a confirmation Dialog with as much information as
   // possible.
   boolean userConfirmsDelete =
       showDeleteConfirmation(oID, ontologyEntry.getPhysicalURI(), loadedOntoToDelete);
   if (userConfirmsDelete) {
     // C) Actual Removal:
     // C-A) if ontology managed, remove from OwlModelManager,
     // Owlontologymanager
     if (loadedOntoToDelete != null) {
       if (!(hom.getOntologyFormat(loadedOntoToDelete) instanceof HGDBOntologyFormat)) {
         hmm.removeOntology(loadedOntoToDelete);
       } else {
         System.out.println(
             "File based ontology not unloaded :" + loadedOntoToDelete.getOntologyID());
       }
     }
     // C-B) delete in repository
     boolean repoDeleteOk = hom.getOntologyRepository().deleteOntology(oID);
     showDeleteSuccessOrFailure(repoDeleteOk, oID, ontologyEntry.getPhysicalURI());
     return repoDeleteOk;
   } else {
     JOptionPane.showMessageDialog(
         getWorkspace(),
         "Delete cancelled by user.                                ",
         "Delete Hypergraph Database Backed Ontology - Cancelled",
         JOptionPane.WARNING_MESSAGE);
     return false;
   }
 }
  @SuppressWarnings("deprecation")
  protected void initialise() {
    // DO NOT DO THIS: super.initialise();
    // THIS SETS OUR MODEL MANAGER
    modelManager = new HGOwlModelManagerImpl();
    System.out.println("Using OWL API version " + VersionInfo.getVersionInfo().getVersion());
    // logger.info("Using OWL API version " +
    // VersionInfo.getVersionInfo().getVersion());
    modelManager.setExplanationManager(new ExplanationManager(this));
    modelManager.setMissingImportHandler(new MissingImportHandlerUI(this));
    modelManager.setSaveErrorHandler(
        new SaveErrorHandler() {
          public void handleErrorSavingOntology(
              OWLOntology ont, URI physicalURIForOntology, OWLOntologyStorageException e)
              throws Exception {
            if (e.getCause() != null && e.getCause() instanceof ProtocolException) {
              hghandleSaveAs(ont);
            } else {
              throw e;
            }
          }
        });
    modelManager.setLoadErrorHandler(new OntologyLoadErrorHandlerUI(this));

    //		searchManager = new SearchManager(this, new SearchMetadataImportManager());

    this.getWorkspace().getStatusArea();
    setOWLModelManager(modelManager);

    ontologyChangeListener =
        new OWLOntologyChangeListener() {
          public void ontologiesChanged(List<? extends OWLOntologyChange> owlOntologyChanges)
              throws OWLException {
            modifiedDocument = true;
          }
        };
    modelManager.addOntologyChangeListener(ontologyChangeListener);

    OntologyLoadErrorHandlerUI loadErrorHandler = new OntologyLoadErrorHandlerUI(this);
    modelManager.setLoadErrorHandler(loadErrorHandler);

    IOListenerPluginLoader loader = new IOListenerPluginLoader(this);
    for (IOListenerPlugin pl : loader.getPlugins()) {
      try {
        IOListenerPluginInstance instance = pl.newInstance();
        getModelManager().addIOListener(instance);
      } catch (Throwable e) {
        ProtegeApplication.getErrorLog().logError(e);
      }
    }

    // loadIOListenerPlugins();
    registration =
        ProtegeOWL.getBundleContext()
            .registerService(
                EditorKit.class.getCanonicalName(), this, new Hashtable<String, Object>());

    getWorkspace().refreshComponents();
  }
 public OWLOntology getActiveOntology() {
   HGOwlModelManagerImpl m = (HGOwlModelManagerImpl) getOWLModelManager();
   return m.getActiveOntology();
 }