diff --git a/src/main/java/org/sonarlint/intellij/ui/SonarLintWalkthroughToolWindow.java b/src/main/java/org/sonarlint/intellij/ui/SonarLintWalkthroughToolWindow.java index f01e24fe3..062a4e4ea 100644 --- a/src/main/java/org/sonarlint/intellij/ui/SonarLintWalkthroughToolWindow.java +++ b/src/main/java/org/sonarlint/intellij/ui/SonarLintWalkthroughToolWindow.java @@ -163,7 +163,8 @@ public void createToolWindowContent(Project project, ToolWindow toolWindow) { var reachOutToUsBackButtonPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); reachOutToUsBackButtonPanel.add(reachOutToUsBackButton); - createReachOutToUsPageLayout(reachOutToUsStepLabel, project, reachOutToUsLAbel, reachOutToUsPane, reachOutToUsBackButtonPanel, reachOutToUsPage, + createReachOutToUsPageLayout(reachOutToUsStepLabel, project, reachOutToUsLAbel, reachOutToUsPane, reachOutToUsBackButtonPanel, + reachOutToUsPage, reachOutToUsImageLabel); mainPanel.add(welcomePage, "Page 1"); @@ -213,99 +214,100 @@ private static void addButtons(JButton welcomePageNextButton, JPanel mainPanel, }); } - private static void createWelcomePageLayout(JLabel stepLabel, JLabel titleLabel, JScrollPane scrollPane1, JPanel nextButtonPanel1, - JPanel page1, JLabel imageLabel1) { + private static void createWelcomePageLayout(JLabel stepLabel, JLabel titleLabel, JScrollPane welcomePageScrollPane, + JPanel welcomePageNextButtonPanel, JPanel welcomePagePanel, JLabel welcomePageImageLabel) { var gbc = new GridBagConstraints(); - var page1CenterPanel = createCenterPanel(stepLabel, titleLabel, scrollPane1, gbc); + var centerPanel = createCenterPanel(stepLabel, titleLabel, welcomePageScrollPane, gbc); gbc.gridy = 3; gbc.anchor = GridBagConstraints.SOUTHEAST; gbc.fill = GridBagConstraints.NONE; gbc.weightx = 0; gbc.weighty = 0; - page1CenterPanel.add(nextButtonPanel1, gbc); + centerPanel.add(welcomePageNextButtonPanel, gbc); - page1.add(imageLabel1, BorderLayout.NORTH); - page1.add(page1CenterPanel, BorderLayout.CENTER); + welcomePagePanel.add(welcomePageImageLabel, BorderLayout.NORTH); + welcomePagePanel.add(centerPanel, BorderLayout.CENTER); } - private static void createLearnAsYouCodePageLayout(JLabel stepLabel, JLabel page2Label, JScrollPane scrollPane2, - JPanel backButtonPanel2, JPanel nextButtonPanel2, - JPanel page2, JLabel imageLabel2) { - var gbc2 = new GridBagConstraints(); - - var page2CenterPanel = createCenterPanel(stepLabel, page2Label, scrollPane2, gbc2); - - gbc2.gridy = 3; - gbc2.anchor = GridBagConstraints.SOUTHWEST; - gbc2.fill = GridBagConstraints.NONE; - gbc2.weightx = 0; - gbc2.weighty = 0; - page2CenterPanel.add(backButtonPanel2, gbc2); - - gbc2.gridy = 3; - gbc2.anchor = GridBagConstraints.SOUTHEAST; - gbc2.fill = GridBagConstraints.NONE; - gbc2.weightx = 0; - gbc2.weighty = 0; - page2CenterPanel.add(nextButtonPanel2, gbc2); - - page2.add(imageLabel2, BorderLayout.NORTH); - page2.add(page2CenterPanel, BorderLayout.CENTER); + private static void createLearnAsYouCodePageLayout(JLabel stepLabel, JLabel label, JScrollPane pane, + JPanel backButtonPanel, JPanel nextButtonPanel, + JPanel page, JLabel imageLabel) { + var gbc = new GridBagConstraints(); + + var centerPanel = createCenterPanel(stepLabel, label, pane, gbc); + + gbc.gridy = 3; + gbc.anchor = GridBagConstraints.SOUTHWEST; + gbc.fill = GridBagConstraints.NONE; + gbc.weightx = 0; + gbc.weighty = 0; + centerPanel.add(backButtonPanel, gbc); + + gbc.gridy = 3; + gbc.anchor = GridBagConstraints.SOUTHEAST; + gbc.fill = GridBagConstraints.NONE; + gbc.weightx = 0; + gbc.weighty = 0; + centerPanel.add(nextButtonPanel, gbc); + + page.add(imageLabel, BorderLayout.NORTH); + page.add(centerPanel, BorderLayout.CENTER); } - private static void createConnectWithYourTeamLayout(JLabel stepLabel, JLabel page3Label, JScrollPane scrollPane3, - JPanel backButtonPanel3, JPanel nextButtonPanel3, - JPanel page3, JLabel imageLabel3) { + private static void createConnectWithYourTeamLayout(JLabel stepLabel, JLabel connectWithYourTeamLabel, + JScrollPane connectWithYourTeamPane, + JPanel connectWithYourTeamBackButtonPanel, JPanel connectWithYourTeamNextButtonPanel, + JPanel page, JLabel imageLabel) { var gbc3 = new GridBagConstraints(); - var page3CenterPanel = createCenterPanel(stepLabel, page3Label, scrollPane3, gbc3); + var page3CenterPanel = createCenterPanel(stepLabel, connectWithYourTeamLabel, connectWithYourTeamPane, gbc3); gbc3.gridy = 3; gbc3.anchor = GridBagConstraints.SOUTHEAST; gbc3.fill = GridBagConstraints.NONE; gbc3.weightx = 0; gbc3.weighty = 0; - page3CenterPanel.add(nextButtonPanel3, gbc3); + page3CenterPanel.add(connectWithYourTeamNextButtonPanel, gbc3); gbc3.gridy = 3; gbc3.anchor = GridBagConstraints.SOUTHWEST; gbc3.fill = GridBagConstraints.NONE; gbc3.weightx = 0; gbc3.weighty = 0; - page3CenterPanel.add(backButtonPanel3, gbc3); + page3CenterPanel.add(connectWithYourTeamBackButtonPanel, gbc3); - page3.add(imageLabel3, BorderLayout.NORTH); - page3.add(page3CenterPanel, BorderLayout.CENTER); + page.add(imageLabel, BorderLayout.NORTH); + page.add(page3CenterPanel, BorderLayout.CENTER); } - private static void createReachOutToUsPageLayout(JLabel stepLabel, Project project, JLabel page4Label, JScrollPane scrollPane4, - JPanel backButtonPanel4, JPanel page4, JLabel imageLabel4) { - var gbc4 = new GridBagConstraints(); + private static void createReachOutToUsPageLayout(JLabel stepLabel, Project project, JLabel pageLabel, JScrollPane scrollPane, + JPanel backButtonPanel, JPanel panel, JLabel imageLabel) { + var gbc = new GridBagConstraints(); - var page4CenterPanel = createCenterPanel(stepLabel, page4Label, scrollPane4, gbc4); + var page4CenterPanel = createCenterPanel(stepLabel, pageLabel, scrollPane, gbc); var closeButton = new JButton("Close"); var closeButtonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); closeButtonPanel.add(closeButton); - gbc4.gridy = 3; - gbc4.anchor = GridBagConstraints.SOUTHWEST; - gbc4.fill = GridBagConstraints.NONE; - gbc4.weightx = 0; - gbc4.weighty = 0; - page4CenterPanel.add(backButtonPanel4, gbc4); + gbc.gridy = 3; + gbc.anchor = GridBagConstraints.SOUTHWEST; + gbc.fill = GridBagConstraints.NONE; + gbc.weightx = 0; + gbc.weighty = 0; + page4CenterPanel.add(backButtonPanel, gbc); - gbc4.gridy = 3; - gbc4.anchor = GridBagConstraints.SOUTHEAST; - gbc4.fill = GridBagConstraints.NONE; - gbc4.weightx = 0; - gbc4.weighty = 0; - page4CenterPanel.add(closeButtonPanel, gbc4); + gbc.gridy = 3; + gbc.anchor = GridBagConstraints.SOUTHEAST; + gbc.fill = GridBagConstraints.NONE; + gbc.weightx = 0; + gbc.weighty = 0; + page4CenterPanel.add(closeButtonPanel, gbc); - page4.add(imageLabel4, BorderLayout.NORTH); - page4.add(page4CenterPanel, BorderLayout.CENTER); + panel.add(imageLabel, BorderLayout.NORTH); + panel.add(page4CenterPanel, BorderLayout.CENTER); closeButton.addActionListener(e -> { var toolWindow = ToolWindowManager.getInstance(project).getToolWindow("Welcome to SonarQube for IDE"); @@ -315,17 +317,17 @@ private static void createReachOutToUsPageLayout(JLabel stepLabel, Project proje }); } - private static @NotNull JEditorPane createReachOutToUsPageText(Font descriptionPane1Font, Project project) { - var descriptionPane4 = new JEditorPane(EDITOR_PANE_TYPE, "
" + + private static @NotNull JEditorPane createReachOutToUsPageText(Font font, Project project) { + var descriptionPane = new JEditorPane(EDITOR_PANE_TYPE, "" + "You suspect any issue with " + SONARQUBE_FOR_IDE + "? Check the log view.