Пример #1
0
    @Override
    public void execute(final GUI gui) {
      final boolean rt = gui.gprop.invert(GUIProp.FILTERRT);
      gui.stop();
      // refresh buttons in input bar
      gui.refreshControls();
      // refresh editor buttons
      gui.editor.refreshMark();

      final Context ctx = gui.context;
      final boolean root = ctx.root();
      final Data data = ctx.data();
      if (!rt) {
        if (!root) {
          gui.notify.context(new Nodes(0, data), true, null);
          gui.notify.mark(ctx.current(), null);
        }
      } else {
        if (root) {
          gui.notify.mark(new Nodes(data), null);
        } else {
          final Nodes mark = ctx.marked;
          ctx.marked = new Nodes(data);
          gui.notify.context(mark, true, null);
        }
      }
    }
Пример #2
0
 @Override
 public void execute(final GUI gui) {
   gui.gprop.invert(GUIProp.EXECRT);
   gui.stop();
   // refresh buttons in input bar
   gui.refreshControls();
   // refresh editor buttons
   gui.editor.refreshMark();
 }
Пример #3
0
 @Override
 public void execute(final GUI gui) {
   final StringBuilder sb = new StringBuilder();
   final Nodes n = gui.context.copied;
   for (int i = 0; i < n.size(); ++i) {
     if (i > 0) sb.append(',');
     sb.append(openPre(n, i));
   }
   gui.context.copied = null;
   gui.execute(new XQuery("insert nodes (" + sb + ") into " + openPre(gui.context.marked, 0)));
 }
Пример #4
0
    @Override
    public void execute(final GUI gui) {
      final Nodes n = gui.context.marked;
      final DialogEdit edit = new DialogEdit(gui, n.pres[0]);
      if (!edit.ok()) return;

      String rename = null;
      String replace = null;
      final int k = edit.kind;
      if (k == Data.ELEM || k == Data.PI || k == Data.ATTR) {
        rename = edit.result.get(0);
        if (k != Data.ELEM) replace = edit.result.get(1);
      } else {
        replace = edit.result.get(0);
      }

      if (rename != null)
        gui.execute(new XQuery("rename node " + openPre(n, 0) + " as " + quote(rename)));
      if (replace != null)
        gui.execute(
            new XQuery("replace value of node " + openPre(n, 0) + " with " + quote(replace)));
    }
Пример #5
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 + ')'));
 }
Пример #6
0
 @Override
 public void execute(final GUI gui) {
   // skip operation for root context
   final Context ctx = gui.context;
   if (ctx.root()) return;
   // check if all nodes are document nodes
   boolean doc = true;
   final Data data = ctx.data();
   for (final int pre : ctx.current().pres) doc &= data.kind(pre) == Data.DOC;
   if (doc) {
     // if yes, jump to database root
     ctx.update();
     gui.notify.context(ctx.current(), false, null);
   } else {
     // otherwise, jump to parent nodes
     gui.execute(new Cs(".."));
   }
 }
Пример #7
0
    @Override
    public void execute(final GUI gui) {
      final Nodes n = gui.context.marked;
      final DialogInsert insert = new DialogInsert(gui);
      if (!insert.ok()) return;

      final StringList sl = insert.result;
      final NodeType type = ANode.type(insert.kind);
      String item = Token.string(type.string()) + " { " + quote(sl.get(0)) + " }";

      if (type == NodeType.ATT || type == NodeType.PI) {
        item += " { " + quote(sl.get(1)) + " }";
      } else if (type == NodeType.ELM) {
        item += " { () }";
      }

      gui.context.copied = null;
      gui.execute(new XQuery("insert node " + item + " into " + openPre(n, 0)));
    }
Пример #8
0
 @Override
 public void execute(final GUI gui) {
   gui.execute(new XQuery("/"));
 }
Пример #9
0
 @Override
 public void execute(final GUI gui) {
   gui.fullscreen();
 }
Пример #10
0
 @Override
 public void execute(final GUI gui) {
   gui.gprop.invert(GUIProp.SHOWEXPLORE);
   gui.layoutViews();
 }
Пример #11
0
 @Override
 public void execute(final GUI gui) {
   gui.updateControl(gui.status, gui.gprop.invert(GUIProp.SHOWSTATUS), BorderLayout.SOUTH);
 }
Пример #12
0
 @Override
 public void execute(final GUI gui) {
   gui.updateControl(gui.nav, gui.gprop.invert(GUIProp.SHOWINPUT), BorderLayout.SOUTH);
 }
Пример #13
0
 @Override
 public void execute(final GUI gui) {
   gui.gprop.invert(GUIProp.SHOWBUTTONS);
   gui.updateControl(gui.buttons, gui.gprop.is(GUIProp.SHOWBUTTONS), BorderLayout.CENTER);
 }
Пример #14
0
 @Override
 public void execute(final GUI gui) {
   gui.dispose();
 }
Пример #15
0
 @Override
 public void execute(final GUI gui) {
   gui.execute(new Close());
 }