From 87f6ff8372bf92c8af950add8b7afc033edaf048 Mon Sep 17 00:00:00 2001 From: Valentina Kiryushkina Date: Fri, 7 Oct 2016 14:23:13 +0300 Subject: [PATCH] Fix PY-14096 Minor Refactor output panel creation --- .../ipnb/editor/panels/code/IpnbCodePanel.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) 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)); } }; } -- 2.32.0