/// <summary>
        /// Opens a dialog and saves the output of the parser on the current
        /// text.
        /// </summary>
        /// <remarks>
        /// Opens a dialog and saves the output of the parser on the current
        /// text.  If there is no current text, yell at the user and make
        /// them feel bad instead.
        /// </remarks>
        public virtual void SaveOutput()
        {
            if (textPane.GetText().Trim().Length == 0)
            {
                JOptionPane.ShowMessageDialog(this, "No text to parse ", null, JOptionPane.ErrorMessage);
                return;
            }
            jfc.SetDialogTitle("Save file");
            int status = jfc.ShowSaveDialog(this);

            if (status == JFileChooser.ApproveOption)
            {
                SaveOutput(jfc.GetSelectedFile().GetPath());
            }
        }
        /* 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);
            }
        }
Esempio n. 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);
        }