/******************************************************************************* * This file is part of the Coporate Semantic Web Project. * * This work has been partially supported by the ``InnoProfile-Corporate Semantic Web" project funded by the German Federal * Ministry of Education and Research (BMBF) and the BMBF Innovation Initiative for the New German Laender - Entrepreneurial Regions. * * http://www.corporate-semantic-web.de/ * * * Freie Universitaet Berlin * Copyright (c) 2007-2013 * * * Institut fuer Informatik * Working Group Coporate Semantic Web * Koenigin-Luise-Strasse 24-26 * 14195 Berlin * * http://www.mi.fu-berlin.de/en/inf/groups/ag-csw/ * * * * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or see <http://www.gnu.org/licenses/> ******************************************************************************/ package de.fuberlin.agcsw.heraclitus.backend.ui.actions; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; import org.eclipse.jface.action.IAction; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ITreeSelection; import org.eclipse.ui.IActionDelegate; import org.eclipse.ui.IObjectActionDelegate; import org.eclipse.ui.IWorkbenchPart; import org.semanticweb.owl.inference.OWLReasonerException; import de.fuberlin.agcsw.heraclitus.backend.OntoEclipseManager; import de.fuberlin.agcsw.heraclitus.backend.core.OntologyStore; import de.fuberlin.agcsw.heraclitus.backend.core.conceptTree.ConceptTree; public class CreateOntologyProjectAction implements IObjectActionDelegate { private IWorkbenchPart part; /** * Constructor for Action1. */ public CreateOntologyProjectAction() { super(); } /** * @see IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart) */ public void setActivePart(IAction action, IWorkbenchPart targetPart) { part = targetPart; } /** * @see IActionDelegate#run(IAction) */ public void run(IAction action) { ITreeSelection sel= (ITreeSelection) part.getSite().getSelectionProvider().getSelection(); IProject p = (IProject) sel.iterator().next(); OntologyStore os; try { os = OntoEclipseManager.createNewOntologyStore(p); if (os != null) ConceptTree.refreshConceptTree(os, os.getMainOntologyURI()); } catch (CoreException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (OWLReasonerException e) { // TODO Auto-generated catch block e.printStackTrace(); } } /** * @see IActionDelegate#selectionChanged(IAction, ISelection) */ public void selectionChanged(IAction action, ISelection selection) { } }