Search in sources :

Example 36 with Disposable

use of com.intellij.openapi.Disposable in project intellij-community by JetBrains.

the class InvokerTest method testQueueOnBgPool.

@Test
public void testQueueOnBgPool() {
    Disposable parent = InvokerTest::dispose;
    testQueue(parent, new Invoker.BackgroundPool(parent), false);
}
Also used : Disposable(com.intellij.openapi.Disposable) Test(org.junit.Test)

Example 37 with Disposable

use of com.intellij.openapi.Disposable in project intellij-community by JetBrains.

the class TestTreeView method attachToModel.

public void attachToModel(final TestFrameworkRunningModel model) {
    setModel(new DefaultTreeModel(new DefaultMutableTreeNode(model.getRoot())));
    getSelectionModel().setSelectionMode(model.getProperties().getSelectionMode());
    myModel = model;
    Disposer.register(myModel, myModel.getRoot());
    Disposer.register(myModel, new Disposable() {

        public void dispose() {
            setModel(null);
            myModel = null;
        }
    });
    installHandlers();
    setCellRenderer(getRenderer(myModel.getProperties()));
}
Also used : Disposable(com.intellij.openapi.Disposable) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) DefaultTreeModel(javax.swing.tree.DefaultTreeModel)

Example 38 with Disposable

use of com.intellij.openapi.Disposable in project intellij-community by JetBrains.

the class TestTreeExpander method setModel.

public void setModel(final TestFrameworkRunningModel model) {
    myModel = model;
    Disposer.register(model, new Disposable() {

        public void dispose() {
            myModel = null;
        }
    });
}
Also used : Disposable(com.intellij.openapi.Disposable)

Example 39 with Disposable

use of com.intellij.openapi.Disposable in project intellij-community by JetBrains.

the class ReadWriteDirectBufferWrapper method flush.

@Override
public void flush() {
    final ByteBuffer buffer = getCachedBuffer();
    if (buffer == null || !isDirty())
        return;
    Disposable disposable = doFlush(null, buffer);
    if (disposable != null) {
        Disposer.dispose(disposable);
    }
}
Also used : Disposable(com.intellij.openapi.Disposable) ByteBuffer(java.nio.ByteBuffer)

Example 40 with Disposable

use of com.intellij.openapi.Disposable in project intellij-community by JetBrains.

the class MessageListenerList method add.

public void add(@NotNull final T listener, @NotNull Disposable parentDisposable) {
    Disposer.register(parentDisposable, new Disposable() {

        @Override
        public void dispose() {
            myListenerToConnectionMap.remove(listener);
        }
    });
    final MessageBusConnection connection = myMessageBus.connect(parentDisposable);
    connection.subscribe(myTopic, listener);
    myListenerToConnectionMap.put(listener, connection);
}
Also used : Disposable(com.intellij.openapi.Disposable) MessageBusConnection(com.intellij.util.messages.MessageBusConnection)

Aggregations

Disposable (com.intellij.openapi.Disposable)282 NotNull (org.jetbrains.annotations.NotNull)52 Test (org.junit.Test)25 Project (com.intellij.openapi.project.Project)18 TestOnly (org.jetbrains.annotations.TestOnly)17 ArrayList (java.util.ArrayList)13 VirtualFile (com.intellij.openapi.vfs.VirtualFile)11 RelativePoint (com.intellij.ui.awt.RelativePoint)11 Nullable (org.jetbrains.annotations.Nullable)10 Document (com.intellij.openapi.editor.Document)9 File (java.io.File)9 ProcessHandler (com.intellij.execution.process.ProcessHandler)6 Editor (com.intellij.openapi.editor.Editor)6 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)6 VirtualFilePointer (com.intellij.openapi.vfs.pointers.VirtualFilePointer)6 Content (com.intellij.ui.content.Content)6 ProcessCanceledException (com.intellij.openapi.progress.ProcessCanceledException)5 Alarm (com.intellij.util.Alarm)5 ActionEvent (java.awt.event.ActionEvent)5 ListSelectionEvent (javax.swing.event.ListSelectionEvent)5