コード例 #1
0
ファイル: EditorView.java プロジェクト: rostam/basex
 /**
  * Shows a quit dialog for all modified query files.
  *
  * @return {@code false} if confirmation was canceled
  */
 public boolean confirm() {
   for (final EditorArea edit : editors()) {
     tabs.setSelectedComponent(edit);
     if (!close(edit)) return false;
   }
   return true;
 }
コード例 #2
0
ファイル: EditorView.java プロジェクト: rostam/basex
  /**
   * Opens the specified query file.
   *
   * @param file query file
   * @return opened editor
   */
  public EditorArea open(final IOFile file) {
    if (!visible()) GUICommands.C_SHOWEDITOR.execute(gui);

    EditorArea edit = find(file, true);
    try {
      if (edit != null) {
        // display open file
        tabs.setSelectedComponent(edit);
        edit.reopen(true);
      } else {
        // get current editor
        edit = getEditor();
        // create new tab if current text is stored on disk or has been modified
        if (edit.opened() || edit.modified) edit = addTab();
        edit.initText(file.read());
        edit.file(file);
      }
    } catch (final IOException ex) {
      BaseXDialog.error(gui, FILE_NOT_OPENED);
    }
    return edit;
  }