append to new import stubs
This commit is contained in:
parent
c235a726bb
commit
57a5772d4e
2 changed files with 57 additions and 0 deletions
|
@ -1,8 +1,15 @@
|
||||||
package de.unibremen.informatik.hets.protege;
|
package de.unibremen.informatik.hets.protege;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.HeadlessException;
|
||||||
|
|
||||||
import org.protege.editor.owl.ui.action.ProtegeOWLAction;
|
import org.protege.editor.owl.ui.action.ProtegeOWLAction;
|
||||||
|
import org.protege.editor.core.ui.util.UIUtil;
|
||||||
|
|
||||||
public class CGIImportHetsAction extends ProtegeOWLAction {
|
public class CGIImportHetsAction extends ProtegeOWLAction {
|
||||||
|
|
||||||
|
@ -18,5 +25,15 @@ public class CGIImportHetsAction extends ProtegeOWLAction {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent event) {
|
public void actionPerformed(ActionEvent event) {
|
||||||
|
Set<String> exts = new HashSet<String>();
|
||||||
|
exts.add("het");
|
||||||
|
exts.add("owl");
|
||||||
|
File file = null;
|
||||||
|
try {
|
||||||
|
file = UIUtil.openFile(new JFrame(), "HetCASL", "Please select a *.het file", exts);
|
||||||
|
} catch (HeadlessException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,23 @@
|
||||||
package de.unibremen.informatik.hets.protege;
|
package de.unibremen.informatik.hets.protege;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.HeadlessException;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
import org.protege.editor.owl.ui.action.ProtegeOWLAction;
|
import org.protege.editor.owl.ui.action.ProtegeOWLAction;
|
||||||
|
import org.protege.editor.core.ui.util.UIUtil;
|
||||||
|
|
||||||
public class LocalImportHetsAction extends ProtegeOWLAction {
|
public class LocalImportHetsAction extends ProtegeOWLAction {
|
||||||
|
|
||||||
private static final long serialVersionUID = -4056096587762591108L;
|
private static final long serialVersionUID = -4056096587762591108L;
|
||||||
|
|
||||||
|
private Process process;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialise() throws Exception {
|
public void initialise() throws Exception {
|
||||||
}
|
}
|
||||||
|
@ -18,5 +28,35 @@ public class LocalImportHetsAction extends ProtegeOWLAction {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent event) {
|
public void actionPerformed(ActionEvent event) {
|
||||||
|
Set<String> exts = new HashSet<String>();
|
||||||
|
exts.add("het");
|
||||||
|
exts.add("owl");
|
||||||
|
File file = null;
|
||||||
|
try {
|
||||||
|
file = UIUtil.openFile(new JFrame(), "HetCASL", "Please select a *.het file", exts);
|
||||||
|
} catch (HeadlessException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(process != null) {
|
||||||
|
process.destroy();
|
||||||
|
process = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Runtime r = Runtime.getRuntime();
|
||||||
|
|
||||||
|
try {
|
||||||
|
process = r.exec("/usr/bin/hets" + " " + file.getAbsolutePath() + " -o pp.xml");
|
||||||
|
|
||||||
|
try {
|
||||||
|
process.waitFor();
|
||||||
|
} catch(InterruptedException irEx) {
|
||||||
|
irEx.printStackTrace();
|
||||||
|
}
|
||||||
|
} catch(IOException ioEx) {
|
||||||
|
ioEx.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue