Esempio n. 1
0
    @Override
    public void execute(final GUI gui) {
      final DialogExport dialog = new DialogExport(gui);
      if (!dialog.ok()) return;

      final IOFile root = new IOFile(dialog.path());

      // check if existing files will be overwritten
      if (root.exists()) {
        IO file = null;
        boolean overwrite = false;
        final Data d = gui.context.data();
        final IntList il = d.resources.docs();
        final int is = il.size();
        for (int i = 0; i < is; i++) {
          file = root.merge(Token.string(d.text(il.get(i), true)));
          if (file.exists()) {
            if (overwrite) {
              // more than one file will be overwritten; check remaining tests
              file = null;
              break;
            }
            overwrite = true;
          }
        }
        if (overwrite) {
          // show message for overwriting files or directories
          final String msg = file == null ? FILES_REPLACE_X : FILE_EXISTS_X;
          if (file == null) file = root;
          if (!BaseXDialog.confirm(gui, Util.info(msg, file))) return;
        }
      }
      DialogProgress.execute(gui, new Export(root.path()));
    }
Esempio n. 2
0
 @Override
 public void cancel() {
   final boolean sn = gui.gprop.is(GUIProp.SHOWNAME);
   gui.gprop.set(GUIProp.SHOWNAME, oldShowNames);
   if (sn != oldShowNames) gui.notify.layout();
   super.cancel();
 }
Esempio n. 3
0
 /** Open all selected files externally. */
 private void openExternal() {
   for (final IOFile file : selectedValues()) {
     try {
       file.open();
     } catch (final IOException ex) {
       BaseXDialog.error(project.gui, Util.info(FILE_NOT_OPENED_X, file));
     }
   }
 }
Esempio n. 4
0
 @Override
 public void execute(final GUI gui) {
   if (!BaseXDialog.confirm(gui, DELETE_NODES)) return;
   final StringBuilder sb = new StringBuilder();
   final Nodes n = gui.context.marked;
   for (int i = 0; i < n.size(); ++i) {
     if (i > 0) sb.append(',');
     sb.append(openPre(n, i));
   }
   gui.context.marked = new Nodes(n.data);
   gui.context.copied = null;
   gui.context.focused = -1;
   gui.execute(new XQuery("delete nodes (" + sb + ')'));
 }
Esempio n. 5
0
 @Override
 public void execute(final GUI gui) {
   BaseXDialog.browse(gui, UPDATE_URL);
 }
Esempio n. 6
0
 @Override
 public void execute(final GUI gui) {
   BaseXDialog.browse(gui, COMMUNITY_URL);
 }
Esempio n. 7
0
 @Override
 public void execute(final GUI gui) {
   if (new DialogManage(gui).nodb() && BaseXDialog.confirm(gui, NEW_DB_QUESTION))
     C_CREATE.execute(gui);
 }