Search in sources :

Example 56 with Disposable

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

the class LowMemoryWatcher method register.

/**
   * Registers a runnable to run on low memory events. The notifications will be issued until parentDisposable is disposed.
   */
public static void register(@NotNull Runnable runnable, @NotNull Disposable parentDisposable) {
    final LowMemoryWatcher watcher = new LowMemoryWatcher(runnable);
    Disposer.register(parentDisposable, new Disposable() {

        @Override
        public void dispose() {
            watcher.stop();
        }
    });
}
Also used : Disposable(com.intellij.openapi.Disposable)

Example 57 with Disposable

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

the class FrequentEventDetector method disableUntil.

public static void disableUntil(@NotNull Disposable reenable) {
    enabled = false;
    Disposer.register(reenable, new Disposable() {

        @Override
        public void dispose() {
            enabled = true;
        }
    });
}
Also used : Disposable(com.intellij.openapi.Disposable)

Example 58 with Disposable

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

the class ChangesViewContentManager method setUp.

public void setUp(ToolWindow toolWindow) {
    final ContentManager contentManager = toolWindow.getContentManager();
    myContentManagerListener = new MyContentManagerListener();
    contentManager.addContentManagerListener(myContentManagerListener);
    Disposer.register(myProject, new Disposable() {

        public void dispose() {
            contentManager.removeContentManagerListener(myContentManagerListener);
        }
    });
    loadExtensionTabs();
    myContentManager = contentManager;
    final List<Content> ordered = doPresetOrdering(myAddedContents);
    for (Content content : ordered) {
        myContentManager.addContent(content);
    }
    myAddedContents.clear();
    if (contentManager.getContentCount() > 0) {
        contentManager.setSelectedContent(contentManager.getContent(0));
    }
    myInitializationWaiter.countDown();
}
Also used : Disposable(com.intellij.openapi.Disposable)

Example 59 with Disposable

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

the class BreakpointsDialogFactory method setBalloonToHide.

public void setBalloonToHide(final Balloon balloonToHide, Object breakpoint) {
    myBalloonToHide = balloonToHide;
    myBreakpoint = breakpoint;
    Disposer.register(myBalloonToHide, new Disposable() {

        @Override
        public void dispose() {
            if (myBalloonToHide == balloonToHide) {
                myBalloonToHide = null;
                myBreakpoint = null;
            }
        }
    });
}
Also used : Disposable(com.intellij.openapi.Disposable)

Example 60 with Disposable

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

the class XBreakpointPanelProvider method addListener.

@Override
public void addListener(final BreakpointsListener listener, Project project, Disposable disposable) {
    XBreakpointManager breakpointManager = XDebuggerManager.getInstance(project).getBreakpointManager();
    final MyXBreakpointListener listener1 = new MyXBreakpointListener(listener, breakpointManager);
    breakpointManager.addBreakpointListener(listener1);
    myListeners.add(listener1);
    Disposer.register(disposable, new Disposable() {

        @Override
        public void dispose() {
            removeListener(listener);
        }
    });
}
Also used : Disposable(com.intellij.openapi.Disposable)

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