correct fix "frames not available"

This solution should be reviewed and moved to platorfm data manager.
This commit is contained in:
Vladimir Krivosheev
2014-08-14 18:04:23 +02:00
parent 845c022e07
commit c717f89274
2 changed files with 13 additions and 2 deletions
@@ -15,8 +15,11 @@
*/
package com.intellij.xdebugger.impl.frame;
import com.intellij.execution.ui.layout.ViewContext;
import com.intellij.ide.DataManager;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.ui.content.ContentManager;
import com.intellij.util.SingleAlarm;
import com.intellij.xdebugger.XDebugSession;
import com.intellij.xdebugger.impl.ui.XDebugSessionTab;
@@ -64,6 +67,15 @@ public abstract class XDebugView implements Disposable {
@Nullable
public static XDebugSession getSession(@NotNull Component component) {
return XDebugSessionTab.SESSION_KEY.getData(DataManager.getInstance().getDataContext(component));
DataContext dataContext = DataManager.getInstance().getDataContext(component);
ViewContext viewContext = ViewContext.CONTEXT_KEY.getData(dataContext);
ContentManager contentManager = viewContext == null ? null : viewContext.getContentManager();
if (contentManager != null) {
XDebugSession session = XDebugSessionTab.SESSION_KEY.getData(DataManager.getInstance().getDataContext(contentManager.getComponent()));
if (session != null) {
return session;
}
}
return XDebugSessionTab.SESSION_KEY.getData(dataContext);
}
}
@@ -184,7 +184,6 @@ public class XDebugSessionTab extends DebuggerSessionTabBase {
Content framesContent = myUi.createContent(DebuggerContentInfo.FRAME_CONTENT, framesView.getMainPanel(),
XDebuggerBundle.message("debugger.session.tab.frames.title"), AllIcons.Debugger.Frame, null);
framesContent.setCloseable(false);
DataManager.registerDataProvider(framesView.getMainPanel(), this);
return framesContent;
}