File tree Expand file tree Collapse file tree
remotesync-ui/src/main/java/org/piwigo/remotesync/ui/swing Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -88,14 +88,8 @@ public void paintComponent(Graphics graphics) {
8888
8989 @ Override
9090 public void actionPerformed (ActionEvent e ) {
91- if (e .getSource () == this .logBtn ) {
92- if (Desktop .isDesktopSupported ())
93- try {
94- Desktop .getDesktop ().edit (this .parent .getRemoteParent ().getLogFile ());
95- } catch (IOException e1 ) {
96- e1 .printStackTrace ();
97- }
98- }
91+ if (e .getSource () == this .logBtn )
92+ this .parent .openLogFile ();
9993 if (e .getSource () == this .syncBtn )
10094 this .parent .sendToSync ();
10195 }
Original file line number Diff line number Diff line change 1212
1313import java .awt .CardLayout ;
1414import java .awt .Color ;
15+ import java .awt .Desktop ;
1516import java .awt .Graphics ;
1617import java .awt .Image ;
1718import java .awt .event .ActionEvent ;
1819import java .awt .event .ActionListener ;
1920import java .io .File ;
21+ import java .io .IOException ;
2022
2123import javax .swing .ImageIcon ;
2224import javax .swing .JFileChooser ;
@@ -166,6 +168,14 @@ protected void selectDirectory()
166168 }
167169 }
168170
171+ protected void openLogFile ()
172+ {
173+ if (Desktop .isDesktopSupported ())
174+ try {
175+ Desktop .getDesktop ().edit (this .getRemoteParent ().getLogFile ());
176+ } catch (IOException e1 ) {}
177+ }
178+
169179 protected void sendToSync ()
170180 {
171181 CardLayout cardLayout = (CardLayout ) cards .getLayout ();
Original file line number Diff line number Diff line change @@ -36,8 +36,7 @@ public class RemotesyncUI {
3636
3737 private File logFile ;
3838
39- private SyncConfiguration syncConfiguration = ConfigurationUtil .INSTANCE .getUserConfiguration ()
40- .getCurrentSyncConfiguration ();
39+ private SyncConfiguration syncConfiguration = ConfigurationUtil .INSTANCE .getUserConfiguration ().getCurrentSyncConfiguration ();
4140
4241 /**
4342 * Launch the application.
@@ -96,13 +95,11 @@ private void initialize() {
9695 }
9796
9897 private void setCustomOut () {
99- logFile = new File ("./. log" );
98+ logFile = new File (ConfigurationUtil . INSTANCE . getUserHomeDirectory (), " log.txt " );
10099 PrintStream ps = null ;
101- try
102- {
100+ try {
103101 ps = new PrintStream (logFile );
104- } catch (FileNotFoundException e )
105- {
102+ } catch (FileNotFoundException e ) {
106103 return ;
107104 }
108105 System .setOut (ps );
You can’t perform that action at this time.
0 commit comments