/* use JFileChooser jfc to browse files */
        private void BrowseFiles()
        {
            jfc.SetDialogTitle("Open file");
            int status = jfc.ShowOpenDialog(this);

            if (status == JFileChooser.ApproveOption)
            {
                urlTextField.SetText(jfc.GetSelectedFile().GetPath());
                openButton.SetEnabled(true);
            }
        }
예제 #2
0
        // end class SaveOutputThread
        /// <summary>Opens dialog to load a serialized parser</summary>
        public virtual void LoadParser()
        {
            jfc.SetDialogTitle("Load parser");
            int status = jfc.ShowOpenDialog(this);

            if (status == JFileChooser.ApproveOption)
            {
                string filename = jfc.GetSelectedFile().GetPath();
                if (filename.EndsWith(".jar"))
                {
                    string model = chooseJarParser.Show(filename, jfcLocation.location);
                    if (model != null)
                    {
                        LoadJarParser(filename, model);
                    }
                }
                else
                {
                    LoadParser(filename);
                }
            }
        }
예제 #3
0
        public virtual File GetFile(bool open)
        {
            File file = null;
            int  returnVal;

            if (open)
            {
                returnVal = fileChooser.ShowOpenDialog(frame);
            }
            else
            {
                returnVal = fileChooser.ShowSaveDialog(frame);
            }
            if (returnVal == JFileChooser.ApproveOption)
            {
                file = fileChooser.GetSelectedFile();
                if (open && !CheckFile(file))
                {
                    file = null;
                }
            }
            return(file);
        }