From 44ed8f190a2f2c80b03f1149c1b74bb8b2f04edc Mon Sep 17 00:00:00 2001 From: mzouink Date: Sun, 15 Jan 2023 16:25:37 -0500 Subject: [PATCH 1/2] input file path as args to main --- src/main/java/bdv/BigDataViewer.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/bdv/BigDataViewer.java b/src/main/java/bdv/BigDataViewer.java index 7e05d08e..6d76c784 100644 --- a/src/main/java/bdv/BigDataViewer.java +++ b/src/main/java/bdv/BigDataViewer.java @@ -775,7 +775,7 @@ public void collapseCardPanel() public static void main( final String[] args ) { - final String fn = "/Users/pietzsch/workspace/data/111010_weber_resave.xml"; +// final String fn = "/Users/pietzsch/workspace/data/111010_weber_resave.xml"; try { System.setProperty( "apple.laf.useScreenMenuBar", "true" ); @@ -783,9 +783,13 @@ public static void main( final String[] args ) UIUtils.installFlatLafInfos(); System.out.println( "reading config files from \"" + configDir + "\"" ); - final BigDataViewer bdv = open( fn, new File( fn ).getName(), new ProgressWriterConsole(), ViewerOptions.options() ); - + if(args.length>0){ + final String fn = args[0]; + final BigDataViewer bdv = open( fn, new File( fn ).getName(), new ProgressWriterConsole(), ViewerOptions.options() ); // DumpInputConfig.writeToYaml( System.getProperty( "user.home" ) + "/.bdv/bdvkeyconfig.yaml", bdv.getViewerFrame() ); + }else { + throw new IOException("No input file selected !"); + } } catch ( final Exception e ) { From f837c6ab53ee2cd7c555469a556f4f9a4005b6e0 Mon Sep 17 00:00:00 2001 From: mzouink Date: Wed, 18 Jan 2023 08:36:15 -0500 Subject: [PATCH 2/2] fix code formatting --- src/main/java/bdv/BigDataViewer.java | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/main/java/bdv/BigDataViewer.java b/src/main/java/bdv/BigDataViewer.java index 6d76c784..3c284bdd 100644 --- a/src/main/java/bdv/BigDataViewer.java +++ b/src/main/java/bdv/BigDataViewer.java @@ -773,26 +773,22 @@ public void collapseCardPanel() viewer.requestFocusInWindow(); } - public static void main( final String[] args ) - { + public static void main(final String[] args) { // final String fn = "/Users/pietzsch/workspace/data/111010_weber_resave.xml"; - try - { - System.setProperty( "apple.laf.useScreenMenuBar", "true" ); + try { + System.setProperty("apple.laf.useScreenMenuBar", "true"); // System.setProperty( "apple.awt.application.appearance", "system" ); UIUtils.installFlatLafInfos(); - System.out.println( "reading config files from \"" + configDir + "\"" ); - if(args.length>0){ + System.out.println("reading config files from \"" + configDir + "\""); + if (args.length > 0) { final String fn = args[0]; - final BigDataViewer bdv = open( fn, new File( fn ).getName(), new ProgressWriterConsole(), ViewerOptions.options() ); + final BigDataViewer bdv = open(fn, new File(fn).getName(), new ProgressWriterConsole(), ViewerOptions.options()); // DumpInputConfig.writeToYaml( System.getProperty( "user.home" ) + "/.bdv/bdvkeyconfig.yaml", bdv.getViewerFrame() ); - }else { + } else { throw new IOException("No input file selected !"); } - } - catch ( final Exception e ) - { + } catch (final Exception e) { e.printStackTrace(); } }