예제 #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);
            }
          });
    }
  }
예제 #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);
 }
예제 #3
0
 @TestOnly
 public static boolean isEmpty() {
   return ourDebugMode && ourTree.isEmpty();
 }
예제 #4
0
 public static void assertIsEmpty(boolean throwError) {
   if (ourDebugMode) {
     ourTree.assertIsEmpty(throwError);
   }
 }
예제 #5
0
 public static void disposeChildAndReplace(
     @NotNull Disposable toDispose, @NotNull Disposable toReplace) {
   ourTree.executeChildAndReplace(toDispose, toReplace, true, ourDisposeAction);
 }
예제 #6
0
 public static void dispose(@NotNull Disposable disposable, boolean processUnregistered) {
   ourTree.executeAll(disposable, true, ourDisposeAction, processUnregistered);
 }
예제 #7
0
 public static boolean isDisposed(@NotNull Disposable disposable) {
   return ourTree.getDisposalInfo(disposable) != null;
 }