Updated to suppot later Java versions
This commit is contained in:
parent
040aa01d2f
commit
b11268ec9c
13 changed files with 198 additions and 161 deletions
|
|
@ -30,7 +30,7 @@
|
|||
</configuration>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>assembly</goal>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
|
|
|
|||
|
|
@ -47,6 +47,17 @@ public class PropertiesUtil {
|
|||
algorithm = new Algorithm(GlobalConstants.KISAO_EULER);
|
||||
} else if (sim.contains("rk8pd")) {
|
||||
algorithm = new Algorithm(GlobalConstants.KISAO_RUNGE_KUTTA_PRINCE_DORMAND);
|
||||
} else if (sim.contains("rk4imp")) {
|
||||
algorithm = new Algorithm(GlobalConstants.KISAO_RUNGE_KUTTA_IMPLICIT);
|
||||
} else if (sim.contains("gear1")||sim.contains("gear2")) {
|
||||
algorithm = new Algorithm(GlobalConstants.KISAO_GEAR);
|
||||
AlgorithmParameter order;
|
||||
if (sim.contains("gear1")) {
|
||||
order = new AlgorithmParameter(GlobalConstants.KISAO_ORDER, "1");
|
||||
} else {
|
||||
order = new AlgorithmParameter(GlobalConstants.KISAO_ORDER, "2");
|
||||
}
|
||||
algorithm.addAlgorithmParameter(order);
|
||||
} else if (sim.contains("rkf45") || sim.contains("Runge-Kutta-Fehlberg")) {
|
||||
algorithm = new Algorithm(GlobalConstants.KISAO_RUNGE_KUTTA_FEHLBERG);
|
||||
para.setAttribute("method", sim);
|
||||
|
|
@ -57,6 +68,10 @@ public class PropertiesUtil {
|
|||
} else if (properties.isSsa()) {
|
||||
if (sim.equals("gillespie")) {
|
||||
algorithm = new Algorithm(GlobalConstants.KISAO_GILLESPIE_DIRECT);
|
||||
} else if (sim.equals("bunker")) {
|
||||
algorithm = new Algorithm(GlobalConstants.KISAO_BUNKER);
|
||||
} else if (sim.equals("emc")) {
|
||||
algorithm = new Algorithm(GlobalConstants.KISAO_EMC);
|
||||
}
|
||||
|
||||
else if (sim.contains("Mixed")) {
|
||||
|
|
@ -146,6 +161,12 @@ public class PropertiesUtil {
|
|||
} else if (kisaoId.equals(GlobalConstants.KISAO_RUNGE_KUTTA_PRINCE_DORMAND)) {
|
||||
properties.setOde();
|
||||
properties.setSim("rk8pd");
|
||||
} else if (kisaoId.equals(GlobalConstants.KISAO_BUNKER)) {
|
||||
properties.setOde();
|
||||
properties.setSim("bunker");
|
||||
} else if (kisaoId.equals(GlobalConstants.KISAO_EMC)) {
|
||||
properties.setOde();
|
||||
properties.setSim("emc");
|
||||
} else if (kisaoId.equals(GlobalConstants.KISAO_GILLESPIE) || kisaoId.equals(GlobalConstants.KISAO_GILLESPIE_DIRECT)) {
|
||||
properties.setSsa();
|
||||
properties.setSim("gillespie");
|
||||
|
|
|
|||
|
|
@ -8,4 +8,4 @@ export PATH=$BIOSIM/bin:/usr/local/lib:$PATH
|
|||
export DYLD_LIBRARY_PATH=/usr/local/lib:$DYLD_LIBRARY_PATH
|
||||
export DDLD_LIBRARY_PATH=/usr/local/lib:$DDLD_LIBRARY_PATH
|
||||
|
||||
exec java -Xmx2048M -Xms2048M -Djava.library.path=/usr/local/lib -XX:+UseSerialGC -Dapple.laf.useScreenMenuBar=true -Xdock:name="iBioSim" -Xdock:icon=$BIOSIM/gui/src/main/resources/edu/utah/ece/async/ibiosim/gui/icons/iBioSim.jpg -jar iBioSim.jar
|
||||
java --add-exports java.desktop/com.apple.eawt=ALL-UNNAMED -Xmx2048M -Xms2048M -Djava.library.path=/usr/local/lib -XX:+UseSerialGC -Dapple.laf.useScreenMenuBar=true -Xdock:name="iBioSim" -Xdock:icon=$BIOSIM/gui/src/main/resources/edu/utah/ece/async/ibiosim/gui/icons/iBioSim.jpg -jar iBioSim.jar
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
</configuration>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>assembly</goal>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
|
|
@ -69,6 +69,16 @@
|
|||
<groupId>org.apache.jena</groupId>
|
||||
<artifactId>jena-arq</artifactId>
|
||||
<version>3.0.0</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>xml-apis</groupId>
|
||||
<artifactId>xml-apis</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<repositories>
|
||||
|
|
|
|||
|
|
@ -16,21 +16,11 @@
|
|||
<name>The JSBML Snapshot repository</name>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>ebi</id>
|
||||
<name>ebi</name>
|
||||
<url>http://www.ebi.ac.uk/intact/maven/nexus/content/repositories/ebi-repo/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<repository>
|
||||
<id>jboss</id>
|
||||
<name>jboss</name>
|
||||
<url>https://repository.jboss.org/nexus/content/repositories/thirdparty-releases/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>netbeans</id>
|
||||
<name>netbeans</name>
|
||||
<url>http://bits.netbeans.org/maven2/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>osgeo</id>
|
||||
<name>osgeo</name>
|
||||
|
|
@ -54,8 +44,26 @@
|
|||
<groupId>jaxen</groupId>
|
||||
<artifactId>jaxen</artifactId>
|
||||
<version>1.1.4</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>xml-apis</groupId>
|
||||
<artifactId>xml-apis</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>xom</groupId>
|
||||
<artifactId>xom</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>dom4j</groupId>
|
||||
<artifactId>dom4j</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>xom</groupId>
|
||||
<artifactId>xom</artifactId>
|
||||
|
|
@ -85,6 +93,20 @@
|
|||
<groupId>org.sbolstandard</groupId>
|
||||
<artifactId>libSBOLj</artifactId>
|
||||
<version>2.4.1-SNAPSHOT</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>xml-apis</groupId>
|
||||
<artifactId>xml-apis</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>dom4j</groupId>
|
||||
<artifactId>dom4j</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-math3 -->
|
||||
|
|
@ -98,17 +120,56 @@
|
|||
<groupId>org.jfree</groupId>
|
||||
<artifactId>jfreechart</artifactId>
|
||||
<version>1.0.14</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>xml-apis</groupId>
|
||||
<artifactId>xml-apis</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>xml-apis</groupId>
|
||||
<artifactId>xml-apis-ext</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.xmlgraphics</groupId>
|
||||
<artifactId>batik-dom</artifactId>
|
||||
<version>1.8</version>
|
||||
<version>1.16</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>xml-apis</groupId>
|
||||
<artifactId>xml-apis</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>xml-apis</groupId>
|
||||
<artifactId>xml-apis-ext</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.xmlgraphics</groupId>
|
||||
<artifactId>batik-svggen</artifactId>
|
||||
<version>1.8</version>
|
||||
<version>1.16</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>xml-apis</groupId>
|
||||
<artifactId>xml-apis</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
|
@ -122,11 +183,29 @@
|
|||
<artifactId>VectorGraphics2D</artifactId>
|
||||
<version>0.13</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.jlibsedml</groupId>
|
||||
<artifactId>jlibsedml</artifactId>
|
||||
<version>2.3.0-SNAPSHOT</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>xml-apis</groupId>
|
||||
<artifactId>xml-apis</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>xom</groupId>
|
||||
<artifactId>xom</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>jaxen</groupId>
|
||||
<artifactId>jaxen</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
|
|
|||
|
|
@ -19,8 +19,6 @@ import java.util.Scanner;
|
|||
|
||||
import javax.swing.JComboBox;
|
||||
|
||||
import org.apache.batik.dom.GenericDOMImplementation;
|
||||
import org.apache.batik.svggen.SVGGraphics2D;
|
||||
import org.jfree.chart.ChartFactory;
|
||||
import org.jfree.chart.ChartUtilities;
|
||||
import org.jfree.chart.JFreeChart;
|
||||
|
|
@ -53,7 +51,8 @@ import org.jlibsedml.SEDMLDocument;
|
|||
import org.jlibsedml.SedML;
|
||||
import org.jlibsedml.Variable;
|
||||
import org.jlibsedml.modelsupport.SBMLSupport;
|
||||
import org.w3c.dom.DOMImplementation;
|
||||
import org.apache.batik.svggen.SVGGraphics2D;
|
||||
import org.apache.batik.dom.GenericDOMImplementation;
|
||||
|
||||
import com.lowagie.text.Document;
|
||||
import com.lowagie.text.Rectangle;
|
||||
|
|
@ -301,6 +300,7 @@ public class GraphData extends CoreObservable {
|
|||
doc.writeTo(new FileOutputStream(file));
|
||||
}
|
||||
else if (output == 4) {
|
||||
/*
|
||||
DOMImplementation domImpl = GenericDOMImplementation.getDOMImplementation();
|
||||
org.w3c.dom.Document document = domImpl.createDocument(null, "svg", null);
|
||||
SVGGraphics2D svgGenerator = new SVGGraphics2D(document);
|
||||
|
|
@ -311,6 +311,7 @@ public class GraphData extends CoreObservable {
|
|||
svgGenerator.stream(out, useCSS);
|
||||
out.close();
|
||||
outStream.close();
|
||||
*/
|
||||
}
|
||||
else if ((output == 5) || (output == 6) || (output == 7)) {
|
||||
exportDataFile(file, output);
|
||||
|
|
|
|||
31
gui/pom.xml
31
gui/pom.xml
|
|
@ -30,7 +30,7 @@
|
|||
</configuration>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>assembly</goal>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
|
|
@ -38,31 +38,16 @@
|
|||
</plugins>
|
||||
</build>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>staging</id>
|
||||
<name>staging</name>
|
||||
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>ossrh</id>
|
||||
<name>ossrh</name>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>ebi</id>
|
||||
<name>ebi</name>
|
||||
<url>https://www.ebi.ac.uk/intact/maven/nexus/content/repositories/ebi-repo/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>jboss</id>
|
||||
<name>jboss</name>
|
||||
<url>https://repository.jboss.org/nexus/content/repositories/thirdparty-releases/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>netbeans</id>
|
||||
<name>netbeans</name>
|
||||
<url>https://bits.netbeans.org/maven2/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>osgeo</id>
|
||||
<name>osgeo</name>
|
||||
|
|
@ -92,6 +77,20 @@
|
|||
<groupId>org.jfree</groupId>
|
||||
<artifactId>jfreechart</artifactId>
|
||||
<version>1.0.14</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>xml-apis</groupId>
|
||||
<artifactId>xml-apis</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>dom4j</groupId>
|
||||
<artifactId>dom4j</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
|
|
|||
|
|
@ -36,6 +36,8 @@ import java.awt.event.MouseWheelEvent;
|
|||
import java.awt.event.MouseWheelListener;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.awt.event.WindowListener;
|
||||
import java.awt.Desktop;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
|
@ -210,7 +212,6 @@ import edu.utah.ece.async.ibiosim.gui.synthesisView.SynthesisView;
|
|||
import edu.utah.ece.async.ibiosim.gui.synthesisView.SynthesisViewATACS;
|
||||
import edu.utah.ece.async.ibiosim.gui.util.FileTree;
|
||||
import edu.utah.ece.async.ibiosim.gui.util.Log;
|
||||
import edu.utah.ece.async.ibiosim.gui.util.OSXHandlers;
|
||||
import edu.utah.ece.async.ibiosim.gui.util.Utility;
|
||||
import edu.utah.ece.async.ibiosim.gui.util.preferences.EditPreferences;
|
||||
import edu.utah.ece.async.ibiosim.gui.util.preferences.PreferencesDialog;
|
||||
|
|
@ -334,7 +335,7 @@ public class Gui implements BioObserver, MouseListener, ActionListener, MouseMot
|
|||
|
||||
public static Object ICON_COLLAPSE = UIManager.get("Tree.collapsedIcon");
|
||||
|
||||
protected static final String iBioSimVersion = "3.1.0";
|
||||
protected static final String iBioSimVersion = "3.2.0";
|
||||
|
||||
protected SEDMLDocument sedmlDocument = null;
|
||||
|
||||
|
|
@ -882,9 +883,31 @@ public class Gui implements BioObserver, MouseListener, ActionListener, MouseMot
|
|||
|
||||
help.add(manual);
|
||||
help.add(bugReport);
|
||||
if (System.getProperty("os.name").toLowerCase().startsWith("mac os")) {
|
||||
OSXHandlers osxHandlers = new OSXHandlers(this);
|
||||
osxHandlers.addEventHandlers();
|
||||
if (Desktop.isDesktopSupported()) {
|
||||
Desktop desktop = Desktop.getDesktop();
|
||||
|
||||
// Set the "About" menu handler
|
||||
desktop.setAboutHandler(e -> {
|
||||
about();
|
||||
});
|
||||
|
||||
// Set the "Preferences" menu handler
|
||||
desktop.setPreferencesHandler(e -> {
|
||||
PreferencesDialog.showPreferences(Gui.frame);
|
||||
getFileTree().setExpandibleIcons(!IBioSimPreferences.INSTANCE.isPlusMinusIconsEnabled());
|
||||
if (getSBOLDocument() != null) {
|
||||
getSBOLDocument().setDefaultURIprefix(SBOLEditorPreferences.INSTANCE.getUserInfo().getURI().toString());
|
||||
}
|
||||
});
|
||||
|
||||
// Set the "Quit" menu handler
|
||||
desktop.setQuitHandler((e, response) -> {
|
||||
exit();
|
||||
// If we have returned from the above call the user has decided not to quit
|
||||
response.cancelQuit();
|
||||
// Perform cleanup before exiting
|
||||
//response.performQuit(); // or response.cancelQuit();
|
||||
});
|
||||
} else {
|
||||
edit.addSeparator();
|
||||
edit.add(pref);
|
||||
|
|
@ -1040,7 +1063,7 @@ public class Gui implements BioObserver, MouseListener, ActionListener, MouseMot
|
|||
final String developers;
|
||||
name = new JLabel("iBioSim", SwingConstants.CENTER);
|
||||
version = new JLabel("Version " + iBioSimVersion, SwingConstants.CENTER);
|
||||
developers = "Nathan Barker\nScott Glass\nKevin Jones\nHiroyuki Kuwahara\n"
|
||||
developers = "Nathan Barker\nLukas Buecherl\nPedro Fontanarrosa\nScott Glass\nKevin Jones\nHiroyuki Kuwahara\n"
|
||||
+ "Curtis Madsen\nChris Myers\nNam Nguyen\nTramy Nguyen\nTyler Patterson\nNicholas Roehner\nJason Stevens\nLeandro Watanabe\nMichael Zhang\nZhen Zhang\nZach Zundel";
|
||||
Font font = name.getFont();
|
||||
font = font.deriveFont(Font.BOLD, 36.0f);
|
||||
|
|
@ -2407,7 +2430,12 @@ public class Gui implements BioObserver, MouseListener, ActionListener, MouseMot
|
|||
} else if (e.getSource().equals(importArchive)) {
|
||||
importArchive();
|
||||
} else if (e.getSource().equals(downloadSynBioHub)) {
|
||||
downloadSynBioHub();
|
||||
try {
|
||||
downloadSynBioHub();
|
||||
} catch (SBOLValidationException e1) {
|
||||
// TODO Auto-generated catch block
|
||||
e1.printStackTrace();
|
||||
}
|
||||
} else if (e.getSource() == downloadBioModel) {
|
||||
downloadBioModel();
|
||||
} else if (e.getSource() == downloadVirtualPart) {
|
||||
|
|
@ -4524,7 +4552,7 @@ public class Gui implements BioObserver, MouseListener, ActionListener, MouseMot
|
|||
}
|
||||
}
|
||||
|
||||
public void createCombineArchive(File archiveFile, String filename) throws IOException, JDOMException, ParseException, CombineArchiveException, TransformerException {
|
||||
public void createCombineArchive(File archiveFile, String filename) throws IOException, JDOMException, ParseException, CombineArchiveException {
|
||||
CombineArchive archive = new CombineArchive(archiveFile);
|
||||
File baseDir = new File(root);
|
||||
if (filename == null) {
|
||||
|
|
@ -4534,7 +4562,11 @@ public class Gui implements BioObserver, MouseListener, ActionListener, MouseMot
|
|||
} else {
|
||||
addFileToCombineArchive(archive,baseDir,filename);
|
||||
}
|
||||
archive.pack();
|
||||
try {
|
||||
archive.pack();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
archive.close();
|
||||
}
|
||||
|
||||
|
|
@ -4569,8 +4601,7 @@ public class Gui implements BioObserver, MouseListener, ActionListener, MouseMot
|
|||
try {
|
||||
createCombineArchive(file,null);
|
||||
}
|
||||
catch (IOException | JDOMException | ParseException | CombineArchiveException
|
||||
| TransformerException e) {
|
||||
catch (IOException | JDOMException | ParseException | CombineArchiveException e) {
|
||||
JOptionPane.showMessageDialog(frame, "Unable to export COMBINE Archive file.", "Error",
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
|
|
@ -4605,7 +4636,7 @@ public class Gui implements BioObserver, MouseListener, ActionListener, MouseMot
|
|||
return null;
|
||||
}
|
||||
|
||||
public void downloadSynBioHub() {
|
||||
public void downloadSynBioHub() throws SBOLValidationException {
|
||||
RegistryInputDialog registryInputDialog = new RegistryInputDialog(Gui.frame, RegistryInputDialog.ALL_PARTS,
|
||||
edu.utah.ece.async.sboldesigner.sbol.SBOLUtils.Types.All_types, null, sbolDocument);
|
||||
registryInputDialog.allowCollectionSelection();
|
||||
|
|
@ -4638,7 +4669,7 @@ public class Gui implements BioObserver, MouseListener, ActionListener, MouseMot
|
|||
getSBOLDocument().createCopy(selection);
|
||||
writeSBOLDocument();
|
||||
}
|
||||
catch (SBOLValidationException | SynBioHubException | IOException e) {
|
||||
catch (SynBioHubException | IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
JOptionPane.showMessageDialog(frame, "Unable to download from SynBioHub.", "Error Exporting to SynBioHub",
|
||||
|
|
|
|||
|
|
@ -1,104 +0,0 @@
|
|||
package edu.utah.ece.async.ibiosim.gui.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.InvocationHandler;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Proxy;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
|
||||
import org.apache.commons.lang3.JavaVersion;
|
||||
|
||||
import com.apple.eawt.AboutHandler;
|
||||
import com.apple.eawt.Application;
|
||||
import com.apple.eawt.PreferencesHandler;
|
||||
import com.apple.eawt.QuitHandler;
|
||||
import com.apple.eawt.QuitResponse;
|
||||
import com.apple.eawt.AppEvent.AboutEvent;
|
||||
import com.apple.eawt.AppEvent.PreferencesEvent;
|
||||
import com.apple.eawt.AppEvent.QuitEvent;
|
||||
|
||||
import edu.utah.ece.async.ibiosim.dataModels.util.IBioSimPreferences;
|
||||
import edu.utah.ece.async.ibiosim.gui.Gui;
|
||||
import edu.utah.ece.async.ibiosim.gui.util.preferences.PreferencesDialog;
|
||||
import edu.utah.ece.async.sboldesigner.sbol.editor.SBOLEditorPreferences;
|
||||
|
||||
public class OSXHandlers implements InvocationHandler {
|
||||
|
||||
Gui gui;
|
||||
|
||||
public OSXHandlers(Gui gui) {
|
||||
this.gui = gui;
|
||||
}
|
||||
|
||||
public void addEventHandlers() throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException,
|
||||
InvocationTargetException, InstantiationException {
|
||||
|
||||
// using reflection to avoid Mac specific classes being required for compiling KSE on other platforms
|
||||
Class<?> applicationClass = Class.forName("com.apple.eawt.Application");
|
||||
Class<?> quitHandlerClass;
|
||||
Class<?> aboutHandlerClass;
|
||||
Class<?> openFilesHandlerClass;
|
||||
Class<?> preferencesHandlerClass;
|
||||
|
||||
String version = System.getProperty("java.version");
|
||||
String[] versionElements = version.split("\\.|_|-b");
|
||||
|
||||
if (Double.parseDouble(versionElements[0]) >= 9) {
|
||||
quitHandlerClass = Class.forName("java.awt.desktop.QuitHandler");
|
||||
aboutHandlerClass = Class.forName("java.awt.desktop.AboutHandler");
|
||||
openFilesHandlerClass = Class.forName("java.awt.desktop.OpenFilesHandler");
|
||||
preferencesHandlerClass = Class.forName("java.awt.desktop.PreferencesHandler");
|
||||
} else {
|
||||
quitHandlerClass = Class.forName("com.apple.eawt.QuitHandler");
|
||||
aboutHandlerClass = Class.forName("com.apple.eawt.AboutHandler");
|
||||
openFilesHandlerClass = Class.forName("com.apple.eawt.OpenFilesHandler");
|
||||
preferencesHandlerClass = Class.forName("com.apple.eawt.PreferencesHandler");
|
||||
}
|
||||
|
||||
Object application = applicationClass.getConstructor((Class[]) null).newInstance((Object[]) null);
|
||||
Object proxy = Proxy.newProxyInstance(OSXHandlers.class.getClassLoader(), new Class<?>[]{
|
||||
quitHandlerClass, aboutHandlerClass, openFilesHandlerClass, preferencesHandlerClass}, this);
|
||||
|
||||
applicationClass.getDeclaredMethod("setQuitHandler", quitHandlerClass).invoke(application, proxy);
|
||||
applicationClass.getDeclaredMethod("setAboutHandler", aboutHandlerClass).invoke(application, proxy);
|
||||
applicationClass.getDeclaredMethod("setOpenFileHandler", openFilesHandlerClass).invoke(application, proxy);
|
||||
applicationClass.getDeclaredMethod("setPreferencesHandler", preferencesHandlerClass).invoke(application,
|
||||
proxy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||
/*if ("openFiles".equals(method.getName())) {
|
||||
if (args[0] != null) {
|
||||
Object files = args[0].getClass().getMethod("getFiles").invoke(args[0]);
|
||||
if (files instanceof List) {
|
||||
OpenAction openAction = new OpenAction(kseFrame);
|
||||
for (File file : (List<File>) files) {
|
||||
openAction.openKeyStore(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else */if ("handleQuitRequestWith".equals(method.getName())) {
|
||||
gui.exit();
|
||||
// If we have returned from the above call the user has decied not to quit
|
||||
if (args[1] != null) {
|
||||
args[1].getClass().getDeclaredMethod("cancelQuit").invoke(args[1]);
|
||||
}
|
||||
} else if ("handleAbout".equals(method.getName())) {
|
||||
gui.about();
|
||||
} else if ("handlePreferences".equals(method.getName())) {
|
||||
PreferencesDialog.showPreferences(Gui.frame);
|
||||
//EditPreferences editPreferences = new EditPreferences(frame, async);
|
||||
//editPreferences.preferences();
|
||||
gui.getFileTree().setExpandibleIcons(!IBioSimPreferences.INSTANCE.isPlusMinusIconsEnabled());
|
||||
if (gui.getSBOLDocument() != null) {
|
||||
gui.getSBOLDocument().setDefaultURIprefix(SBOLEditorPreferences.INSTANCE.getUserInfo().getURI().toString());
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -30,7 +30,7 @@
|
|||
</configuration>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>assembly</goal>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
|
|
|
|||
6
pom.xml
6
pom.xml
|
|
@ -72,10 +72,10 @@
|
|||
<plugin>
|
||||
<!-- settings for javac. -->
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<source>11</source>
|
||||
<target>11</target>
|
||||
|
||||
<testExcludes>
|
||||
<exclude>edu/utah/ece/async/ibiosim/conversion/gcm2sbml/*.java</exclude>
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@
|
|||
</configuration>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>assembly</goal>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
</configuration>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>assembly</goal>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue