CR-IC-6042#CFR-89165 "add Nullable and rename to mySession"

This commit is contained in:
Vladimir Krivosheev
2014-08-14 11:44:41 +02:00
parent 1d4769d999
commit 70f101e138
@@ -61,7 +61,8 @@ public class XDebugSessionTab extends DebuggerSessionTabBase {
private XWatchesViewImpl myWatchesView;
private final List<XDebugView> myViews = new ArrayList<XDebugView>();
private XDebugSessionImpl session;
@Nullable
private XDebugSessionImpl mySession;
@NotNull
public static XDebugSessionTab create(@NotNull XDebugSessionImpl session,
@@ -74,7 +75,7 @@ public class XDebugSessionTab extends DebuggerSessionTabBase {
XDebugSessionTab oldTab = TAB_KEY.getData(DataManager.getInstance().getDataContext(component));
if (oldTab != null) {
oldTab.setSession(session, environment, icon);
oldTab.attachToSession();
oldTab.attachToSession(session);
return oldTab;
}
}
@@ -90,14 +91,14 @@ public class XDebugSessionTab extends DebuggerSessionTabBase {
setSession(session, environment, icon);
myUi.addContent(createFramesContent(), 0, PlaceInGrid.left, false);
myUi.addContent(createVariablesContent(), 0, PlaceInGrid.center, false);
myUi.addContent(createWatchesContent(), 0, PlaceInGrid.right, false);
myUi.addContent(createVariablesContent(session), 0, PlaceInGrid.center, false);
myUi.addContent(createWatchesContent(session), 0, PlaceInGrid.right, false);
for (XDebugView view : myViews) {
Disposer.register(this, view);
}
attachToSession();
attachToSession(session);
DefaultActionGroup focus = new DefaultActionGroup();
focus.add(ActionManager.getInstance().getAction(XDebuggerActions.FOCUS_ON_BREAKPOINT));
@@ -107,7 +108,7 @@ public class XDebugSessionTab extends DebuggerSessionTabBase {
@Override
public void selectionChanged(ContentManagerEvent event) {
Content content = event.getContent();
XDebugSessionImpl session = XDebugSessionTab.this.session;
XDebugSessionImpl session = mySession;
if (session != null && content.isSelected() && DebuggerContentInfo.WATCHES_CONTENT.equals(ViewImpl.ID.get(content))) {
if (myWatchesView.rebuildNeeded()) {
myWatchesView.processSessionEvent(XDebugView.SessionEvent.SETTINGS_CHANGED, session);
@@ -124,7 +125,7 @@ public class XDebugSessionTab extends DebuggerSessionTabBase {
setEnvironment(environment);
}
this.session = session;
mySession = session;
myConsole = session.getConsoleView();
myRunContentDescriptor = new RunContentDescriptor(myConsole, session.getDebugProcess().getProcessHandler(), myUi.getComponent(), session.getSessionName(), icon);
}
@@ -139,22 +140,22 @@ public class XDebugSessionTab extends DebuggerSessionTabBase {
return this;
}
if (session != null) {
if (mySession != null) {
if (SESSION_KEY.is(dataId)) {
return session;
return mySession;
}
else if (LangDataKeys.CONSOLE_VIEW.is(dataId)) {
return session.getConsoleView();
return mySession.getConsoleView();
}
else if (XDebugSessionData.DATA_KEY.is(dataId)) {
return session.getSessionData();
return mySession.getSessionData();
}
}
return super.getData(dataId);
}
private Content createVariablesContent() {
private Content createVariablesContent(@NotNull XDebugSessionImpl session) {
final XVariablesView variablesView = new XVariablesView(session);
myViews.add(variablesView);
Content result = myUi.createContent(DebuggerContentInfo.VARIABLES_CONTENT, variablesView.getPanel(),
@@ -167,7 +168,7 @@ public class XDebugSessionTab extends DebuggerSessionTabBase {
return result;
}
private Content createWatchesContent() {
private Content createWatchesContent(@NotNull XDebugSessionImpl session) {
myWatchesView = new XWatchesViewImpl(session);
myViews.add(myWatchesView);
Content watchesContent = myUi.createContent(DebuggerContentInfo.WATCHES_CONTENT, myWatchesView.getMainPanel(),
@@ -194,8 +195,9 @@ public class XDebugSessionTab extends DebuggerSessionTabBase {
AppUIUtil.invokeLaterIfProjectAlive(getProject(), new Runnable() {
@Override
public void run() {
for (XDebugView view : myViews) {
if (session != null) {
XDebugSessionImpl session = mySession;
if (session != null) {
for (XDebugView view : myViews) {
view.processSessionEvent(XDebugView.SessionEvent.SETTINGS_CHANGED, session);
}
}
@@ -207,7 +209,7 @@ public class XDebugSessionTab extends DebuggerSessionTabBase {
return myWatchesView;
}
private void attachToSession() {
private void attachToSession(@NotNull XDebugSessionImpl session) {
for (XDebugView view : myViews) {
session.addSessionListener(new XDebugViewSessionListener(view, session), this);
}
@@ -291,8 +293,8 @@ public class XDebugSessionTab extends DebuggerSessionTabBase {
}
public void detachFromSession() {
assert session != null;
session = null;
assert mySession != null;
mySession = null;
}
@Override