Search in sources :

Example 1 with Disposer.newDisposable

use of com.intellij.openapi.util.Disposer.newDisposable in project intellij-community by JetBrains.

the class DisposerTest method testMustNotRegisterWithAlreadyDisposed.

public void testMustNotRegisterWithAlreadyDisposed() {
    Disposable disposable = Disposer.newDisposable();
    Disposer.register(myRoot, disposable);
    Disposer.dispose(disposable);
    try {
        Disposer.register(disposable, Disposer.newDisposable());
        fail("Must not be able to register with already disposed parent");
    } catch (IncorrectOperationException ignored) {
    }
}
Also used : Disposer.newDisposable(com.intellij.openapi.util.Disposer.newDisposable) Disposable(com.intellij.openapi.Disposable) IncorrectOperationException(com.intellij.util.IncorrectOperationException)

Example 2 with Disposer.newDisposable

use of com.intellij.openapi.util.Disposer.newDisposable in project intellij-community by JetBrains.

the class DisposerTest method testRegisterThenDisposeThenRegisterAgain.

public void testRegisterThenDisposeThenRegisterAgain() {
    Disposable disposable = Disposer.newDisposable();
    Disposer.register(myRoot, disposable);
    Disposer.dispose(disposable);
    Disposer.register(myRoot, disposable);
    Disposer.register(disposable, Disposer.newDisposable());
}
Also used : Disposer.newDisposable(com.intellij.openapi.util.Disposer.newDisposable) Disposable(com.intellij.openapi.Disposable)

Aggregations

Disposable (com.intellij.openapi.Disposable)2 Disposer.newDisposable (com.intellij.openapi.util.Disposer.newDisposable)2 IncorrectOperationException (com.intellij.util.IncorrectOperationException)1