Beispiel #1
0
  public static void register(
      @NotNull Disposable parent, @NotNull Disposable child, @NonNls @Nullable final String key) {
    assert parent != child : " Cannot register to itself";

    ourTree.register(parent, child);

    if (key != null) {
      assert get(key) == null;
      ourKeyDisposables.put(key, child);
      register(
          child,
          new Disposable() {
            @Override
            public void dispose() {
              ourKeyDisposables.remove(key);
            }
          });
    }
  }
Beispiel #2
0
 /**
  * @return object registered on parentDisposable which is equal to object, or null if not found
  */
 @Nullable
 public static <T extends Disposable> T findRegisteredObject(
     @NotNull Disposable parentDisposable, @NotNull T object) {
   return ourTree.findRegisteredObject(parentDisposable, object);
 }
Beispiel #3
0
 @TestOnly
 public static boolean isEmpty() {
   return ourDebugMode && ourTree.isEmpty();
 }
Beispiel #4
0
 public static void assertIsEmpty(boolean throwError) {
   if (ourDebugMode) {
     ourTree.assertIsEmpty(throwError);
   }
 }
Beispiel #5
0
 public static void disposeChildAndReplace(
     @NotNull Disposable toDispose, @NotNull Disposable toReplace) {
   ourTree.executeChildAndReplace(toDispose, toReplace, true, ourDisposeAction);
 }
Beispiel #6
0
 public static void dispose(@NotNull Disposable disposable, boolean processUnregistered) {
   ourTree.executeAll(disposable, true, ourDisposeAction, processUnregistered);
 }
Beispiel #7
0
 public static boolean isDisposed(@NotNull Disposable disposable) {
   return ourTree.getDisposalInfo(disposable) != null;
 }