File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ public void start(Stage primaryStage) throws Exception{
18
18
19
19
CsvViewerController controller = loader .<CsvViewerController >getController ();
20
20
controller .setApplication (this );
21
+ controller .openFileCliArgs (getParameters ().getUnnamed ());
21
22
22
23
primaryStage .setTitle ("kana0011/csv-viewer" );
23
24
primaryStage .setMinWidth (APP_WIDTH );
Original file line number Diff line number Diff line change 16
16
import java .util .List ;
17
17
import java .util .Map ;
18
18
19
+ import static javafx .scene .control .Alert .AlertType ;
20
+
19
21
public class CsvViewerController {
20
22
21
23
@ FXML private AnchorPane rootPane ;
@@ -43,6 +45,12 @@ public void setApplication(Application application) {
43
45
this .application = application ;
44
46
}
45
47
48
+ public void openFileCliArgs (List <String > args ) {
49
+ args .stream ()
50
+ .map (File ::new )
51
+ .forEach (this ::openCsvTab );
52
+ }
53
+
46
54
private FileChooser createFileChooser () {
47
55
FileChooser fileChooser = new FileChooser ();
48
56
File userHome = new File (System .getProperty ("user.home" ));
@@ -125,7 +133,7 @@ private void openLink(String url) {
125
133
}
126
134
127
135
private void reportError (Exception e ) {
128
- Alert alert = new Alert (Alert . AlertType .ERROR );
136
+ Alert alert = new Alert (AlertType .ERROR );
129
137
alert .setTitle ("CSV Viewer Error!" );
130
138
alert .setHeaderText (e .getClass ().getSimpleName ());
131
139
alert .setContentText ("Failed to open file!\n CSV format might be broken." );
You can’t perform that action at this time.
0 commit comments