diff options
Diffstat (limited to 'src/main/java/org/cristalise/gui/Main.java')
| -rw-r--r-- | src/main/java/org/cristalise/gui/Main.java | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/src/main/java/org/cristalise/gui/Main.java b/src/main/java/org/cristalise/gui/Main.java new file mode 100644 index 0000000..230abf2 --- /dev/null +++ b/src/main/java/org/cristalise/gui/Main.java @@ -0,0 +1,71 @@ +package org.cristalise.gui;
+
+
+import java.io.File;
+import java.util.Arrays;
+
+import javax.swing.JFileChooser;
+
+import org.cristalise.kernel.process.Gateway;
+import org.cristalise.kernel.process.StandardClient;
+import org.cristalise.kernel.utils.Logger;
+
+
+
+/**
+ *
+ * @version $Revision: 1.15 $ $Date: 2004/10/26 11:33:56 $
+ * @author $Author: abranson $
+ */
+public class Main extends StandardClient
+{
+ static public void main(String[] args)
+ {
+ try
+ {
+ if (args[args.length-1].equals("-connect")) { // prompt for connect file
+ JFileChooser clcChooser = new JFileChooser();
+ clcChooser.setDialogTitle("Please choose a CRISTAL connect file.");
+ clcChooser.addChoosableFileFilter(
+ new javax.swing.filechooser.FileFilter() {
+ @Override
+ public String getDescription() {
+ return "CRISTAL Connect Files";
+ }
+ @Override
+ public boolean accept(File f) {
+ if (f.isDirectory() || (f.isFile() && f.getName().endsWith(".clc"))) {
+ return true;
+ }
+ return false;
+ }
+ });
+ int returnVal = clcChooser.showOpenDialog(null);
+ if (returnVal == JFileChooser.APPROVE_OPTION) {
+ File targetFile = clcChooser.getSelectedFile();
+ args = Arrays.copyOf(args, args.length+1);
+ args[args.length-1] = targetFile.getCanonicalPath();
+ }
+
+ }
+ Gateway.init(readC2KArgs(args));
+ Logger.initConsole("GUI");
+ MainFrame client = new MainFrame();
+ client.showLogin();
+
+ }
+ catch( Exception ex )
+ {
+ ex.printStackTrace();
+
+ try
+ {
+ Gateway.close();
+ }
+ catch(Exception ex1)
+ {
+ ex1.printStackTrace();
+ }
+ }
+ }
+}
|
