Ejemplo n.º 1
0
 @Override
 public void refreshMark() {
   final EditorArea edit = getEditor();
   go.setEnabled(edit.script || edit.xquery && !gui.gprop.is(GUIProp.EXECRT));
   final Nodes mrk = gui.context.marked;
   filter.setEnabled(!gui.gprop.is(GUIProp.FILTERRT) && mrk != null && mrk.size() != 0);
 }
Ejemplo n.º 2
0
  /**
   * Notifies all views of a selection change. The mode flag determines what happens:
   *
   * <ul>
   *   <li>0: set currently focused node as marked node
   *   <li>1: add currently focused node
   *   <li>2: toggle currently focused node
   * </ul>
   *
   * @param mode mark mode
   * @param vw the calling view
   */
  public void mark(final int mode, final View vw) {
    final int f = gui.context.focused;
    if (f == -1) return;

    final Context ctx = gui.context;
    Nodes nodes = ctx.marked;
    if (mode == 0) {
      nodes = new Nodes(f, ctx.data());
    } else if (mode == 1) {
      nodes.union(new int[] {f});
    } else {
      nodes.toggle(f);
    }
    mark(nodes, vw);
  }
Ejemplo n.º 3
0
  /**
   * Notifies all views of a context change.
   *
   * @param nodes new context set (may be {@code null} if root nodes are addressed)
   * @param quick quick switch
   * @param vw the calling view
   */
  public void context(final Nodes nodes, final boolean quick, final View vw) {
    final Context ctx = gui.context;

    // add new entry if current node set has not been cached yet
    final Nodes newn = nodes.checkRoot();
    final Nodes empty = new Nodes(new int[0], ctx.data(), ctx.marked.ftpos);
    final Nodes curr = quick ? ctx.current() : null;
    final Nodes cmp = quick ? curr : ctx.marked;
    if (cont[hist] == null ? cmp != null : cmp == null || !cont[hist].sameAs(cmp)) {
      checkHist();
      if (quick) {
        // store history entry
        queries[hist] = "";
        marked[hist] = new Nodes(ctx.data());
        // add current entry
        cont[++hist] = curr;
      } else {
        // store history entry
        final String in = gui.input.getText();
        queries[hist] = in;
        marked[hist] = ctx.marked;
        // add current entry
        cont[++hist] = newn;
        queries[hist] = in;
        marked[hist] = empty;
      }
      histsize = hist;
    }
    ctx.set(newn, empty);

    for (final View v : view) if (v != vw && v.visible()) v.refreshContext(true, quick);
    gui.refreshControls();
  }
Ejemplo n.º 4
0
 /**
  * Notifies all views of a selection change.
  *
  * @param mark marked nodes
  * @param vw the calling view
  */
 public void mark(final Nodes mark, final View vw) {
   final Context ctx = gui.context;
   ctx.marked = mark;
   for (final View v : view) if (v != vw && v.visible()) v.refreshMark();
   gui.filter.setEnabled(mark.size() != 0);
   gui.refreshControls();
 }