From a14471c72ff5d81fcdff50c4431d7d231d4eeda3 Mon Sep 17 00:00:00 2001 From: Aleksey Pivovarov Date: Thu, 17 Nov 2016 13:18:02 +0300 Subject: [PATCH] vcs: cleanup - initialize fields in constructor --- .../changes/ui/CommitChangeListDialog.java | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitChangeListDialog.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitChangeListDialog.java index eddab93a2af7..d77ef03fe2df 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitChangeListDialog.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitChangeListDialog.java @@ -83,12 +83,12 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj @NotNull private final CommitContext myCommitContext; @NotNull private final CommitMessage myCommitMessageArea; - private Splitter mySplitter; + @NotNull private final Splitter mySplitter; @Nullable private final JPanel myAdditionalOptionsPanel; @NotNull private final ChangesBrowserBase myBrowser; - private CommitLegendPanel myLegend; + @NotNull private final CommitLegendPanel myLegend; @NotNull private final MyChangeProcessor myDiffDetails; @NotNull private final List myAdditionalComponents = ContainerUtil.newArrayList(); @@ -114,7 +114,7 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj @NotNull private final Map myListComments; private String myLastSelectedListName; - private ChangeInfoCalculator myChangesInfoCalculator; + @NotNull private final ChangeInfoCalculator myChangesInfoCalculator; @NotNull private final PseudoMap myAdditionalData; @Nullable private final String myHelpId; @@ -122,7 +122,7 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj private SplitterWithSecondHideable myDetailsSplitter; private final String myOkActionText; @Nullable private final CommitAction myCommitAction; - @Nullable private CommitResultHandler myResultHandler; + @Nullable private final CommitResultHandler myResultHandler; @NotNull private final Runnable myUpdateButtonsRunnable = () -> { updateButtons(); @@ -313,6 +313,16 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj myCommitMessageArea = new CommitMessage(project); + mySplitter = new Splitter(true); + mySplitter.setHonorComponentsMinimumSize(true); + mySplitter.setFirstComponent(myBrowser); + mySplitter.setSecondComponent(myCommitMessageArea); + initMainSplitter(); + + myChangesInfoCalculator = new ChangeInfoCalculator(); + myLegend = new CommitLegendPanel(myChangesInfoCalculator); + myBrowser.getBottomPanel().add(JBUI.Panels.simplePanel().addToRight(myLegend.getComponent()), BorderLayout.SOUTH); + if (!myVcsConfiguration.CLEAR_INITIAL_COMMIT_MESSAGE) { setComment(initialSelection, comment); } @@ -441,6 +451,7 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj myWarningLabel = new JLabel(); myWarningLabel.setUI(new MultiLineLabelUI()); myWarningLabel.setForeground(JBColor.RED); + myWarningLabel.setBorder(JBUI.Borders.empty(5, 5, 0, 5)); updateWarning(); @@ -949,17 +960,6 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj @Override @Nullable protected JComponent createCenterPanel() { - mySplitter = new Splitter(true); - mySplitter.setHonorComponentsMinimumSize(true); - mySplitter.setFirstComponent(myBrowser); - mySplitter.setSecondComponent(myCommitMessageArea); - initMainSplitter(); - - myChangesInfoCalculator = new ChangeInfoCalculator(); - myLegend = new CommitLegendPanel(myChangesInfoCalculator); - - myBrowser.getBottomPanel().add(JBUI.Panels.simplePanel().addToRight(myLegend.getComponent()), BorderLayout.SOUTH); - JPanel mainPanel; if (myAdditionalOptionsPanel != null) { JScrollPane optionsPane = ScrollPaneFactory.createScrollPane(myAdditionalOptionsPanel, true); @@ -972,7 +972,6 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj mainPanel = mySplitter; } - myWarningLabel.setBorder(JBUI.Borders.empty(5, 5, 0, 5)); final JPanel panel = new JPanel(new GridBagLayout()); panel.add(myWarningLabel, new GridBag().anchor(GridBagConstraints.NORTHWEST).weightx(1));