Skip to content
Snippets Groups Projects
Commit c3039cf0 authored by Dr Nikos Dimokas's avatar Dr Nikos Dimokas
Browse files

No commit message

No commit message
parent 44491da3
No related branches found
No related tags found
No related merge requests found
......@@ -13,10 +13,27 @@ public class Startup{
private static String filesDir = new String("owlfiles");
private static URL owlFilesDir = null;
public boolean earlyStartup() {
boolean res=false;
IPath ipath = Activator.getDefault().getStateLocation();
//System.out.println("ipath="+ipath);
try {
File parentDir = ipath.toFile();
File owlDir = new File(parentDir.toString(),filesDir);
boolean result = owlDir.mkdir();
//if(result)
//System.out.println("Directory for owl files have been created.");
res = RepositoryClient.downloadAllOntologies(owlDir.toString());
}
catch (Exception e) { e.printStackTrace(); }
return res;
}
/*
public boolean earlyStartup() {
boolean res=false;
IPath ipath = new Path(codeAssistantDir+File.separator);
owlFilesDir = FileLocator.find(Platform.getBundle("org.universaal.tools.codeAssistant"), ipath, null);
try {
//System.out.println("owlFilesDir="+owlFilesDir);
......@@ -36,7 +53,7 @@ public class Startup{
catch (Exception e) { e.printStackTrace(); }
return res;
}
*/
/*
public boolean earlyStartup() {
boolean res=false;
......
......@@ -17,6 +17,7 @@ import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.graphics.Image;
import org.universaal.tools.codeassistantapplication.Activator;
import org.universaal.tools.codeassistantapplication.editor.model.TreeNode;
import com.hp.hpl.jena.ontology.OntClass;
......@@ -283,17 +284,13 @@ public class TreeConstruction{
private static File[] getDirectoryFiles() throws IOException{
File[] files = null;
ArrayList owlfiles = new ArrayList();
IPath ipath = new Path(codeAssistantDir+File.separator+filesDir+File.separator);
owlFilesDir = FileLocator.find(Platform.getBundle("org.universaal.tools.codeAssistant"), ipath, null);
//owlFilesDir = (URL)Platform.getBundle("org.universaal.tools.codeAssistant").getEntry(codeAssistantDir+File.separator+filesDir+File.separator);
IPath ipath = Activator.getDefault().getStateLocation();
try {
//File directory = new File(FileLocator.resolve(directoryName).toURI());
owlFilesDir = FileLocator.toFileURL(owlFilesDir);
String tmp = owlFilesDir.toString();
if (tmp.indexOf(" ")!=-1)
tmp = (owlFilesDir.toString()).replaceAll(" ", "%20");
owlFilesDir = new URL(tmp);
File directory = new File(FileLocator.resolve(owlFilesDir).toURI());
File parentDir = ipath.toFile();
File directory = new File(parentDir.toString(),filesDir);
if (directory.isDirectory()){
files=directory.listFiles();
for (int i=0; i<files.length; i++){
......
......@@ -56,7 +56,7 @@ public class RepositoryClient {
}
static public boolean downloadOntologyFile(String versionID) {
//System.out.println("pathToSaveFiles"+pathToSaveFiles);
if (getLatestOntologiesMetadata()) {
String ontologyName = "";
// find ontology name in metadata by parsing the xml file
......@@ -125,6 +125,7 @@ public class RepositoryClient {
initFiles();
boolean res=false;
pathToSaveFiles = directory + File.separator;
//System.out.println("pathToSaveFiles="+pathToSaveFiles);
// Rename the old Ontologies.xml
String previousXmlFile = renameFile(directory, "latest_Ontologies.xml");
// Read the new Ontologies.xml
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment