| 5 | 5 | repositories { |
| 6 | 6 | jcenter() |
| 7 | ||
| 8 | maven { | |
| 9 | url 'https://oss.sonatype.org/content/repositories/snapshots/' | |
| 10 | } | |
| 7 | 11 | } |
| 8 | 12 | |
| 9 | 13 | compileJava { |
| 10 | 14 | options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" |
| 11 | 15 | } |
| 12 | 16 | |
| 13 | 17 | dependencies { |
| 14 | 18 | compile 'org.controlsfx:controlsfx:8.40.12' |
| 15 | compile 'org.fxmisc.richtext:richtextfx:0.7-M3' | |
| 19 | //compile 'org.fxmisc.richtext:richtextfx:0.7-M4' | |
| 20 | compile group: 'org.fxmisc.richtext', name: 'richtextfx', version: '1.0.0-SNAPSHOT' | |
| 16 | 21 | compile 'com.miglayout:miglayout-javafx:5.0' |
| 17 | 22 | compile 'de.jensd:fontawesomefx-fontawesome:4.5.0' |
| 18 | 23 | compile 'org.ahocorasick:ahocorasick:0.3.0' |
| 19 | compile 'com.vladsch.flexmark:flexmark:0.9.0' | |
| 20 | compile 'com.vladsch.flexmark:flexmark-ext-gfm-tables:0.9.0' | |
| 21 | compile 'com.vladsch.flexmark:flexmark-ext-superscript:0.9.0' | |
| 22 | compile 'com.vladsch.flexmark:flexmark-ext-gfm-strikethrough:0.9.0' | |
| 24 | compile 'com.vladsch.flexmark:flexmark:0.18.5' | |
| 25 | compile 'com.vladsch.flexmark:flexmark-ext-tables:0.18.5' | |
| 26 | compile 'com.vladsch.flexmark:flexmark-ext-superscript:0.18.5' | |
| 27 | compile 'com.vladsch.flexmark:flexmark-ext-gfm-strikethrough:0.18.5' | |
| 23 | 28 | compile 'com.fasterxml.jackson.core:jackson-core:2.8.4' |
| 24 | 29 | compile 'com.fasterxml.jackson.core:jackson-databind:2.8.4' |
| 25 | 30 | compile 'com.fasterxml.jackson.core:jackson-annotations:2.8.4' |
| 26 | 31 | compile 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.8.4' |
| 27 | 32 | compile 'org.yaml:snakeyaml:1.17' |
| 28 | 33 | compile 'com.ximpleware:vtd-xml:2.13' |
| 29 | 34 | compile 'net.sf.saxon:Saxon-HE:9.7.0-14' |
| 30 | 35 | compile 'com.googlecode.juniversalchardet:juniversalchardet:1.0.3' |
| 31 | 36 | compile 'org.apache.commons:commons-configuration2:2.1' |
| 32 | compile files('libs/renjin-script-engine-0.8.2324-jar-with-dependencies.jar') | |
| 37 | compile files('libs/renjin-script-engine-0.8.2354-jar-with-dependencies.jar') | |
| 33 | 38 | } |
| 34 | 39 | |
| 35 | version = '1.2.6' | |
| 40 | version = '1.2.9' | |
| 36 | 41 | applicationName = 'scrivenvar' |
| 37 | 42 | mainClassName = 'com.scrivenvar.Main' |
| 104 | 104 | |
| 105 | 105 | private void initApplication() { |
| 106 | app = this; | |
| 106 | Main.app = this; | |
| 107 | 107 | } |
| 108 | 108 | |
| ... | ||
| 190 | 190 | |
| 191 | 191 | private static Application getApplication() { |
| 192 | return app; | |
| 192 | return Main.app; | |
| 193 | 193 | } |
| 194 | 194 | |
| 31 | 31 | import com.vladsch.flexmark.ast.Node; |
| 32 | 32 | import com.vladsch.flexmark.ext.gfm.strikethrough.StrikethroughSubscriptExtension; |
| 33 | import com.vladsch.flexmark.ext.gfm.tables.TablesExtension; | |
| 33 | import com.vladsch.flexmark.ext.tables.TablesExtension; | |
| 34 | 34 | import com.vladsch.flexmark.html.HtmlRenderer; |
| 35 | 35 | import com.vladsch.flexmark.parser.Parser; |
| 32 | 32 | import static com.ximpleware.VTDGen.TOKEN_CHARACTER_DATA; |
| 33 | 33 | import com.ximpleware.VTDNav; |
| 34 | import static java.nio.charset.StandardCharsets.UTF_8; | |
| 34 | 35 | import java.text.ParseException; |
| 35 | 36 | import javafx.beans.value.ObservableValue; |
| ... | ||
| 132 | 133 | final VTDGen vg = getParser(); |
| 133 | 134 | |
| 134 | // TODO: Use the document's encoding... | |
| 135 | vg.setDoc( xml.getBytes() ); | |
| 135 | // XML recommends UTF-8 encoding. | |
| 136 | // See: http://stackoverflow.com/a/36696214/59087 | |
| 137 | // | |
| 138 | // The encoding should be derived, not assumed. | |
| 139 | vg.setDoc( xml.getBytes( UTF_8 ) ); | |
| 136 | 140 | vg.parse( true ); |
| 137 | 141 | return vg.getNav(); |
| 28 | 28 | package com.scrivenvar.service.events; |
| 29 | 29 | |
| 30 | import java.io.File; | |
| 31 | import java.io.FileWriter; | |
| 32 | import java.io.IOException; | |
| 33 | import java.io.PrintWriter; | |
| 30 | 34 | import java.util.Observer; |
| 31 | 35 | import javafx.scene.control.Alert; |
| ... | ||
| 57 | 61 | */ |
| 58 | 62 | default public void notify( final Exception ex ) { |
| 63 | log( ex ); | |
| 59 | 64 | notify( ex.getMessage() ); |
| 65 | } | |
| 66 | ||
| 67 | /** | |
| 68 | * Writes the exception to a log file. The log file should be written | |
| 69 | * in the System's temporary directory. | |
| 70 | * | |
| 71 | * @param ex The exception to show in the status bar and log to a file. | |
| 72 | */ | |
| 73 | default public void log( final Exception ex ) { | |
| 74 | try ( | |
| 75 | final FileWriter fw = new FileWriter( getLogPath(), true ); | |
| 76 | final PrintWriter pw = new PrintWriter( fw ) | |
| 77 | ) { | |
| 78 | ||
| 79 | ex.printStackTrace( pw ); | |
| 80 | } catch (final IOException ioe) { | |
| 81 | // The notify method will display the message on the status | |
| 82 | // bar. | |
| 83 | } | |
| 60 | 84 | } |
| 85 | ||
| 86 | /** | |
| 87 | * Returns the fully qualified path to the log file to write to when | |
| 88 | * an exception occurs. | |
| 89 | * | |
| 90 | * @return Location of the log file for writing unexpected exceptions. | |
| 91 | */ | |
| 92 | public File getLogPath(); | |
| 61 | 93 | |
| 62 | 94 | /** |
| 28 | 28 | package com.scrivenvar.service.events.impl; |
| 29 | 29 | |
| 30 | import static com.scrivenvar.Constants.APP_TITLE; | |
| 30 | 31 | import static com.scrivenvar.Constants.STATUS_BAR_DEFAULT; |
| 31 | 32 | import com.scrivenvar.service.events.Notification; |
| 32 | 33 | import com.scrivenvar.service.events.Notifier; |
| 34 | import java.io.File; | |
| 35 | import java.nio.file.Paths; | |
| 33 | 36 | import java.util.Observable; |
| 34 | 37 | import javafx.scene.control.Alert; |
| ... | ||
| 109 | 112 | public Alert createError( final Window parent, final Notification message ) { |
| 110 | 113 | return createAlertDialog( parent, ERROR, message ); |
| 114 | } | |
| 115 | ||
| 116 | @Override | |
| 117 | public File getLogPath() { | |
| 118 | return Paths.get( | |
| 119 | System.getProperty("java.io.tmpdir"), APP_TITLE + ".log").toFile(); | |
| 111 | 120 | } |
| 112 | 121 | } |