public void OpenCommand() {
    fileBrowserStatus = FileBrowserStatus.Open;

    fileBrowser = new FileBrowser(this, midlet.display);

    fileBrowser.setCurrentDir(currentDirName);

    fileBrowser.browse();
  }
  public void commandAction(Command c, Displayable s) {
    if (c == exit) {
      ExitCommand();
    } else if (c == newFile) {
      NewFileCommand();
    } else if (c == save) {
      SaveCommand();
    } else if (c == saveAs) {
      SaveAsCommand();
    } else if (c == open) {
      OpenCommand();
    } else if (c == FileBrowser.select) {
      currentDirName = fileBrowser.getCurrentDir();
      currentFileName = fileBrowser.getCurrentFile();

      if (currentDirName != null && currentFileName != null) {
        setAndViewStatus(currentDirName + currentFileName);
      }

      switch (fileBrowserStatus) {
        case FileBrowserStatus.Open:
          Open();
          break;
        case FileBrowserStatus.Save:
          Save();
          break;
        case FileBrowserStatus.None:
          break;
        default:
          break;
      }

      fileBrowserStatus = FileBrowserStatus.None;

      midlet.display.setCurrent(this);
    } else if (c == FileBrowser.cancel) {
      if (currentDirName != null && currentFileName != null) {
        setAndViewStatus(currentDirName + currentFileName);
      }

      midlet.display.setCurrent(this);
    } else if (c == eval) {
      EvalCommand();
    } else if (c == output) {
      SwitchOutputCommand();
    } else if (c == cls) {
      ClsCommand();
    }
  }
  public void SaveCommand() {
    fileBrowser = new FileBrowser(this, midlet.display);

    if (currentDirName != null && currentFileName != null) {
      fileBrowser.setCurrentDir(currentDirName);

      fileBrowser.setCurrentFile(currentFileName);

      Save();
    } else {
      fileBrowser.setCurrentDir(currentDirName);

      fileBrowser.browse();
    }
  }