| 14 | 14 | import com.keenwrite.events.spelling.LexiconLoadedEvent; |
| 15 | 15 | import com.keenwrite.io.MediaType; |
| 16 | import com.keenwrite.io.MediaTypeExtension; |
| 16 | 17 | import com.keenwrite.preferences.Workspace; |
| 17 | 18 | import com.keenwrite.preview.HtmlPreview; |
| ... |
| 73 | 74 | import static com.keenwrite.events.StatusEvent.clue; |
| 74 | 75 | import static com.keenwrite.io.MediaType.*; |
| 76 | import static com.keenwrite.io.MediaType.TypeName.TEXT; |
| 75 | 77 | import static com.keenwrite.preferences.AppKeys.*; |
| 76 | 78 | import static com.keenwrite.processors.IdentityProcessor.IDENTITY; |
| 77 | 79 | import static com.keenwrite.processors.ProcessorContext.Mutator; |
| 78 | 80 | import static com.keenwrite.processors.ProcessorContext.builder; |
| 79 | 81 | import static com.keenwrite.processors.ProcessorFactory.createProcessors; |
| 82 | import static java.awt.Desktop.getDesktop; |
| 80 | 83 | import static java.util.concurrent.Executors.newFixedThreadPool; |
| 81 | 84 | import static java.util.concurrent.Executors.newScheduledThreadPool; |
| ... |
| 282 | 285 | } |
| 283 | 286 | |
| 284 | | runLater( () -> open( eventFile ) ); |
| 287 | final var mediaType = MediaTypeExtension.fromFile( eventFile ); |
| 288 | |
| 289 | runLater( () -> { |
| 290 | // Open text files locally. |
| 291 | if( mediaType.isType( TEXT ) ) { |
| 292 | open( eventFile ); |
| 293 | } |
| 294 | else { |
| 295 | try { |
| 296 | // Delegate opening all other file types to the operating system. |
| 297 | getDesktop().open( eventFile ); |
| 298 | } catch( final Exception ex ) { |
| 299 | clue( ex ); |
| 300 | } |
| 301 | } |
| 302 | } ); |
| 285 | 303 | } |
| 286 | 304 | |