Package com.google.collide.shared.util.ListenerRegistrar

Examples of com.google.collide.shared.util.ListenerRegistrar.Remover


    assertEquals("variable set", createStringSet(
        "aaa", "bbb", "ccc", "ddd", "eee", "fff"), createNameSet(proposals));

    Document document = helper.editor.getDocument();

    Remover remover = document.getLineListenerRegistrar().add(new Document.LineListener() {
      @Override
      public void onLineAdded(Document document, int lineNumber, JsonArray<Line> addedLines) {
      }

      @Override
      public void onLineRemoved(Document document, int lineNumber,
          JsonArray<Line> removedLines) {
        JsonArray<TaggableLine> deletedLines = JsonCollections.createArray();
        for (final Line line : removedLines.asIterable()) {
          deletedLines.add(line);
        }
        analyzer.onLinesDeleted(deletedLines);
      }
    });

    LineFinder lineFinder = document.getLineFinder();
    LineInfo line2 = lineFinder.findLine(2);
    LineInfo line4 = lineFinder.findLine(4);
    String textToDelete = LineUtils.getText(line2.line(), 0, line4.line(), 0);
    helper.editor.getEditorDocumentMutator().deleteText(line2.line(), 2, 0, textToDelete.length());
    remover.remove();

    JsonArray<IncrementalScheduler.Task> parseRequests = helper.parseScheduler.requests;
    assertEquals("reparse scheduled", 1, parseRequests.size());
    parseRequests.get(0).run(50);
View Full Code Here


  }

  public void testRemover() {
    final TestCallback callback = new TestCallback();

    Remover remover = listenerManager.add(callback);
    listenerManager.dispatch(new Dispatcher());
    remover.remove();
    listenerManager.dispatch(new Dispatcher());
    assertEquals(1, callback.count);
  }
View Full Code Here

  public static Remover createAndAttach(Element element, Callback callback) {
    MouseGestureListener instance = new MouseGestureListener(callback);
    final EventRemover eventRemover = element.addEventListener(
        Event.MOUSEDOWN, instance.captureListener, false);
    return new Remover() {
      @Override
      public void remove() {
        eventRemover.remove();
      }
    };
View Full Code Here

    if (manager == null) {
      manager = ListenerManager.create();
      listenerManagers.put(key, manager);
    }

    final Remover listenerRemover = manager.add(listener);
    updateEditorListeners();

    return new Remover() {
      @Override
      public void remove() {
        removeMouseHoverListener(listenerRemover, keyModifier, listener);
      }
    };
View Full Code Here

              header.getAwesomeBoxComponentHost().show();
            }
          }
        }, true);
    // Track this for removal in cleanup
    keyListenerRemoverManager.track(new Remover() {
      @Override
      public void remove() {
        eventRemover.remove();
      }
    });
View Full Code Here

        }
      }
    }, true);

    // Track this for removal in cleanup
    keyListenerRemoverManager.track(new Remover() {
      @Override
      public void remove() {
        eventRemover.remove();
      }
    });
View Full Code Here

TOP

Related Classes of com.google.collide.shared.util.ListenerRegistrar.Remover

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.