From: Valentina Kiryushkina Date: Fri, 7 Oct 2016 11:23:13 +0000 (+0300) Subject: Fix PY-14096 Minor Refactor output panel creation X-Git-Tag: appcode/171.432~63 X-Git-Url: https://git.jetbrains.org/?p=idea%2Fcommunity.git;a=commitdiff_plain;h=87f6ff8372bf92c8af950add8b7afc033edaf048 Fix PY-14096 Minor Refactor output panel creation --- diff --git a/python/ipnb/src/org/jetbrains/plugins/ipnb/editor/panels/code/IpnbCodePanel.java b/python/ipnb/src/org/jetbrains/plugins/ipnb/editor/panels/code/IpnbCodePanel.java index 85857c98a19f..e933564146f1 100644 --- a/python/ipnb/src/org/jetbrains/plugins/ipnb/editor/panels/code/IpnbCodePanel.java +++ b/python/ipnb/src/org/jetbrains/plugins/ipnb/editor/panels/code/IpnbCodePanel.java @@ -87,17 +87,16 @@ public class IpnbCodePanel extends IpnbEditablePanel { } public JPanel createHideableOutputPanel() { - OnePixelSplitter splitter = new OnePixelSplitter(true); - JPanel firstComponent = createToggleBar(splitter); - JPanel secondComponent = createOutputPanel(createHideOutputListener(splitter, firstComponent)); - + final OnePixelSplitter splitter = new OnePixelSplitter(true); + final JPanel secondComponent = createOutputPanel(splitter); splitter.setSecondComponent(secondComponent); return splitter; } @NotNull - private JPanel createOutputPanel(MouseAdapter hideOutputListener) { + private JPanel createOutputPanel(@NotNull OnePixelSplitter splitter) { + final MouseAdapter hideOutputListener = createHideOutputListener(splitter); final JPanel outputPanel = new JPanel(new VerticalFlowLayout(VerticalFlowLayout.TOP, true, false)); outputPanel.setBackground(IpnbEditorUtil.getBackground()); for (IpnbOutputCell outputCell : myCell.getCellOutputs()) { @@ -109,7 +108,8 @@ public class IpnbCodePanel extends IpnbEditablePanel { } @NotNull - private MouseAdapter createHideOutputListener(final OnePixelSplitter splitter, final JPanel firstComponent) { + private MouseAdapter createHideOutputListener(final OnePixelSplitter splitter) { + final JPanel toggleBar = createToggleBar(splitter); return new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { @@ -120,7 +120,7 @@ public class IpnbCodePanel extends IpnbEditablePanel { private void hideOutputPanel() { setOutputStateInCell(true); - splitter.setFirstComponent(firstComponent); + splitter.setFirstComponent(toggleBar); splitter.setSecondComponent(null); } }; @@ -155,7 +155,7 @@ public class IpnbCodePanel extends IpnbEditablePanel { setOutputStateInCell(false); updateBackground(IpnbEditorUtil.getBackground()); splitter.setFirstComponent(null); - splitter.setSecondComponent(createOutputPanel(createHideOutputListener(splitter, secondPanel))); + splitter.setSecondComponent(createOutputPanel(splitter)); } }; }