@@ -76,7 +76,7 @@ public class Config {
76
76
*/
77
77
private static File applicationDir ;
78
78
private static File unitexToolLogger ;
79
-
79
+
80
80
/**
81
81
* Path of the directory <code>.../Unitex</code>
82
82
*/
@@ -489,15 +489,15 @@ public static JFileChooser getFileEditionDialogBox() {
489
489
fileEditionDialogBox .setDialogTitle ("Select a file to edit" );
490
490
return fileEditionDialogBox ;
491
491
}
492
-
492
+
493
493
public static JFileChooser initializeJFileChooser (JFileChooser jFileChooser ,
494
494
String extension , String description , String subfolder )
495
495
{
496
496
if (jFileChooser != null )
497
497
return jFileChooser ;
498
498
jFileChooser = new JFileChooser ();
499
499
final PersonalFileFilter fileFilter =new PersonalFileFilter (extension ,
500
- description );
500
+ description );
501
501
jFileChooser .addChoosableFileFilter (fileFilter );
502
502
jFileChooser .setFileFilter (fileFilter );
503
503
jFileChooser .setDialogType (JFileChooser .OPEN_DIALOG );
@@ -507,7 +507,7 @@ public static JFileChooser initializeJFileChooser(JFileChooser jFileChooser,
507
507
jFileChooser .setDialogTitle ("Select a file to edit" );
508
508
return jFileChooser ;
509
509
}
510
-
510
+
511
511
public static JFileChooser getFileEditionDialogBox (String extension ) {
512
512
JFileChooser chooser ;
513
513
if (extension == null )
@@ -563,7 +563,7 @@ public static JFileChooser getTransducerListDialogBox() {
563
563
//transducerListDialogBox.setControlButtonsAreShown(false);
564
564
return transducerListDialogBox ;
565
565
}
566
-
566
+
567
567
public static JFileChooser getExploreGraphOutputDialogBox () {
568
568
if (exploreGraphOutputDialogBox != null )
569
569
return exploreGraphOutputDialogBox ;
@@ -847,7 +847,7 @@ public static String getUnitexToolLoggerSemVer() {
847
847
try {
848
848
CommandBuilder cmd = new VersionInfoCommand ().getSemver ();
849
849
String [] comm = cmd .getCommandArguments (true );
850
-
850
+
851
851
final Process p = Runtime .getRuntime ().exec (comm );
852
852
final BufferedReader in = new BufferedReader (
853
853
new InputStreamReader (p .getInputStream (), "UTF8" ));
@@ -887,13 +887,13 @@ private static void setApplicationDir(String appPath, File s) {
887
887
888
888
/**
889
889
* Setup the UnitexToolLogger executable
890
- *
890
+ *
891
891
* @param path
892
892
* external programs directory
893
893
*
894
894
* @author martinec
895
895
*/
896
- public static File setupUnitexToolLogger (File path ) {
896
+ public static File setupUnitexToolLogger (File path ) {
897
897
// define the default unitexToolLogger path
898
898
File UnitexToolLogger = new File (path , "UnitexToolLogger" +
899
899
(Config .getSystem () == Config .WINDOWS_SYSTEM ? ".exe" : "" ));
@@ -902,7 +902,7 @@ public static File setupUnitexToolLogger(File path) {
902
902
// Windows, try to install it
903
903
if (!UnitexToolLogger .exists () &&
904
904
Config .getSystem () != Config .WINDOWS_SYSTEM ) {
905
- // define the default setup script path
905
+ // define the default setup script path
906
906
File setupScript = new File (path , "install" + File .separatorChar + "setup" );
907
907
if (setupScript .exists ()) {
908
908
// setup ProcessBuilder
@@ -912,36 +912,36 @@ public static File setupUnitexToolLogger(File path) {
912
912
StringBuilder sb = new StringBuilder ();
913
913
sb .append (setupScript .getAbsolutePath ()).append (' ' );
914
914
sb .append ("> " ).append ("install" + File .separatorChar + "setup.log" );
915
- String cmd [] = new String [] { "sh" , "-c" , sb .toString () };
915
+ String cmd [] = new String [] { "sh" , "-c" , sb .toString () };
916
916
final ProcessBuilder pb = new ProcessBuilder (cmd );
917
-
917
+
918
918
// Java 7+ only
919
919
//final ProcessBuilder pb = new ProcessBuilder(setupScript.getAbsolutePath());
920
920
//pb.redirectOutput(ProcessBuilder.Redirect.INHERIT);
921
921
922
922
pb .directory (path );
923
923
pb .redirectErrorStream (true );
924
-
924
+
925
925
// show a "Please wait" message dialog. This was adapted from
926
926
// @source http://www.coding-dude.com/wp/java/modal-progress-bar-dialog-java-swing
927
927
java .awt .Frame f =null ;
928
928
929
929
final JDialog dlgProgress = new JDialog (f , "Please wait until installation is finished" , true );
930
930
dlgProgress .setAlwaysOnTop (true );
931
-
931
+
932
932
JLabel lblStatus = new JLabel ("Compiling " + UnitexToolLogger .getName () + "..." );
933
-
933
+
934
934
JProgressBar pbProgress = new JProgressBar (0 , 100 );
935
935
pbProgress .setIndeterminate (true );
936
936
937
937
dlgProgress .add (BorderLayout .NORTH , lblStatus );
938
938
dlgProgress .add (BorderLayout .CENTER , pbProgress );
939
-
939
+
940
940
// prevent the user from closing the dialog
941
941
dlgProgress .setDefaultCloseOperation (JDialog .DO_NOTHING_ON_CLOSE );
942
942
943
943
dlgProgress .setSize (400 , 90 );
944
-
944
+
945
945
// center on screen
946
946
Dimension screenSize = Toolkit .getDefaultToolkit ().getScreenSize ();
947
947
dlgProgress .setLocation ((screenSize .width - dlgProgress .getWidth ()) / 2 ,
@@ -952,20 +952,20 @@ public static File setupUnitexToolLogger(File path) {
952
952
@ Override
953
953
protected Void doInBackground () throws Exception {
954
954
// execute the setup script
955
- try {
955
+ try {
956
956
// star script
957
957
Process p = pb .start ();
958
958
// wait to finish
959
959
p .waitFor ();
960
960
} catch (Exception e ) {
961
961
// do nothing
962
- }
962
+ }
963
963
return null ;
964
964
}
965
965
966
966
@ Override
967
967
protected void done () {
968
- //close the modal dialog
968
+ //close the modal dialog
969
969
dlgProgress .dispose ();
970
970
}
971
971
};
@@ -976,7 +976,7 @@ protected void done() {
976
976
dlgProgress .setVisible (true );
977
977
}
978
978
}
979
-
979
+
980
980
// check if UnitexToolLogger exists
981
981
if (!UnitexToolLogger .exists ()) {
982
982
JOptionPane .showMessageDialog (null ,
@@ -986,7 +986,7 @@ protected void done() {
986
986
UnitexToolLogger .getName () + " not found" ,
987
987
JOptionPane .INFORMATION_MESSAGE );
988
988
}
989
-
989
+
990
990
return UnitexToolLogger ;
991
991
}
992
992
@@ -1307,24 +1307,24 @@ private static void chooseInitialLanguage() {
1307
1307
final TreeSet <String > languages = new TreeSet <String >();
1308
1308
collectLanguage (getUnitexDir (), languages );
1309
1309
collectLanguage (getUserDir (), languages );
1310
-
1310
+
1311
1311
String [] langArr = languages .toArray (new String [0 ]);
1312
1312
int defaultLangIndex = -1 ;
1313
1313
String preferedLanguage = PreferencesManager .getUserPreferences ().getPreferedLanguage ();
1314
1314
if (preferedLanguage != null )
1315
1315
for (int i =0 ; i <langArr .length && defaultLangIndex == -1 ; i ++)
1316
1316
if (preferedLanguage .equals (langArr [i ]))
1317
1317
defaultLangIndex = i ;
1318
-
1318
+
1319
1319
final JComboBox langList = new JComboBox (langArr );
1320
1320
if (defaultLangIndex != -1 )
1321
1321
langList .setSelectedIndex (defaultLangIndex );
1322
-
1322
+
1323
1323
p .add (new JLabel ("User: " + getUserName ()));
1324
1324
p .add (new JLabel ("Choose the language you want" ));
1325
1325
p .add (new JLabel ("to work on:" ));
1326
1326
p .add (langList );
1327
-
1327
+
1328
1328
final JFrame frame = new JFrame ();
1329
1329
frame .setAlwaysOnTop (true );
1330
1330
final String [] options = { "OK" , "Exit" };
@@ -1336,7 +1336,7 @@ private static void chooseInitialLanguage() {
1336
1336
String selectedItem = (String ) (langList .getSelectedItem ());
1337
1337
setCurrentLanguage (selectedItem );
1338
1338
PreferencesManager .getUserPreferences ().setPreferedLanguage (selectedItem );
1339
-
1339
+
1340
1340
}
1341
1341
1342
1342
/**
0 commit comments