use of com.intellij.openapi.Disposable in project intellij-community by JetBrains.
the class ExternalResourceManagerExImpl method addTestResource.
@TestOnly
public static void addTestResource(final String url, final String location, Disposable parentDisposable) {
final ExternalResourceManagerExImpl instance = (ExternalResourceManagerExImpl) getInstance();
ApplicationManager.getApplication().runWriteAction(() -> instance.addResource(url, location));
Disposer.register(parentDisposable, new Disposable() {
@Override
public void dispose() {
ApplicationManager.getApplication().runWriteAction(() -> instance.removeResource(url));
}
});
}
use of com.intellij.openapi.Disposable in project intellij-community by JetBrains.
the class ExternalResourceManagerExImpl method registerResourceTemporarily.
@TestOnly
public static void registerResourceTemporarily(final String url, final String location, Disposable disposable) {
ApplicationManager.getApplication().runWriteAction(() -> getInstance().addResource(url, location));
Disposer.register(disposable, new Disposable() {
@Override
public void dispose() {
ApplicationManager.getApplication().runWriteAction(() -> getInstance().removeResource(url));
}
});
}
use of com.intellij.openapi.Disposable in project intellij-community by JetBrains.
the class ValueHint method createInspectTree.
public static InspectDebuggerTree createInspectTree(final NodeDescriptorImpl descriptor, Project project) {
final InspectDebuggerTree tree = new InspectDebuggerTree(project);
final AnAction setValueAction = ActionManager.getInstance().getAction(DebuggerActions.SET_VALUE);
setValueAction.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0)), tree);
Disposer.register(tree, new Disposable() {
@Override
public void dispose() {
setValueAction.unregisterCustomShortcutSet(tree);
}
});
tree.setInspectDescriptor(descriptor);
DebuggerContextImpl context = DebuggerManagerEx.getInstanceEx(project).getContext();
tree.rebuild(context);
return tree;
}
use of com.intellij.openapi.Disposable in project intellij-community by JetBrains.
the class DebuggerAction method installEditAction.
public static Disposable installEditAction(final JTree tree, String actionName) {
final DoubleClickListener listener = new DoubleClickListener() {
@Override
protected boolean onDoubleClick(MouseEvent e) {
if (tree.getPathForLocation(e.getX(), e.getY()) == null)
return false;
DataContext dataContext = DataManager.getInstance().getDataContext(tree);
GotoFrameSourceAction.doAction(dataContext);
return true;
}
};
listener.installOn(tree);
Disposable disposable = () -> listener.uninstall(tree);
DebuggerUIUtil.registerActionOnComponent(actionName, tree, disposable);
return disposable;
}
use of com.intellij.openapi.Disposable in project intellij-community by JetBrains.
the class CompilerCacheManager method flushCaches.
synchronized void flushCaches() {
for (Disposable disposable : myCacheDisposables) {
try {
Disposer.dispose(disposable);
} catch (Throwable e) {
LOG.info(e);
}
}
myCacheDisposables.clear();
myGenericCachesMap.clear();
myCompilerToCacheMap.clear();
}
Aggregations