CPP-694 Remove 'Start Using IDE' from welcome screen to make sure users setup toolchains

This commit is contained in:
Alexander Lobas
2014-08-28 19:28:30 +04:00
parent 8c22867949
commit f8dc4b1568
2 changed files with 23 additions and 31 deletions
@@ -21,6 +21,7 @@ import com.intellij.openapi.application.ApplicationNamesInfo;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.ui.JBCardLayout;
import com.intellij.util.PlatformUtils;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
@@ -33,9 +34,9 @@ import java.util.List;
public class CustomizeIDEWizardDialog extends DialogWrapper implements ActionListener {
private static final String BUTTONS = "BUTTONS";
private static final String NOBUTTONS = "NOBUTTONS";
private final JButton mySkipButton = new JButton("Skip All and Set Defaults");
private final JButton myBackButton = new JButton("Back");
private final JButton myNextButton = new JButton("Next");
private final JButton myStartUsingButton = new JButton("Start using " + ApplicationNamesInfo.getInstance().getFullProductName());
private final JBCardLayout myCardLayout = new JBCardLayout();
protected final List<AbstractCustomizeWizardStep> mySteps = new ArrayList<AbstractCustomizeWizardStep>();
@@ -52,9 +53,9 @@ public class CustomizeIDEWizardDialog extends DialogWrapper implements ActionLis
setTitle("Customize " + ApplicationNamesInfo.getInstance().getProductName());
getPeer().setAppIcons();
initSteps();
mySkipButton.addActionListener(this);
myBackButton.addActionListener(this);
myNextButton.addActionListener(this);
myStartUsingButton.addActionListener(this);
myNavigationLabel.setEnabled(false);
myFooterLabel.setEnabled(false);
init();
@@ -80,12 +81,6 @@ public class CustomizeIDEWizardDialog extends DialogWrapper implements ActionLis
protected void initSteps() {
provider.initSteps(this, mySteps);
}
@Override
protected void createButtons(JPanel buttonPanel, GridBagConstraints gbc) {
provider.addButtons(this, buttonPanel, gbc);
super.createButtons(buttonPanel, gbc);
}
}.show();
}
@@ -137,7 +132,17 @@ public class CustomizeIDEWizardDialog extends DialogWrapper implements ActionLis
gbc.fill = GridBagConstraints.BOTH;
gbc.gridx = 0;
gbc.gridy = 0;
createButtons(buttonPanel, gbc);
if (!PlatformUtils.isCppIde()) {
buttonPanel.add(mySkipButton, gbc);
gbc.gridx++;
}
buttonPanel.add(myBackButton, gbc);
gbc.gridx++;
gbc.weightx = 1;
buttonPanel.add(Box.createHorizontalGlue(), gbc);
gbc.gridx++;
gbc.weightx = 0;
buttonPanel.add(myNextButton, gbc);
buttonPanel.setBorder(BorderFactory.createEmptyBorder(8, 0, 0, 0));
myButtonWrapper.add(buttonPanel, BUTTONS);
myButtonWrapper.add(new JLabel(), NOBUTTONS);
@@ -145,25 +150,13 @@ public class CustomizeIDEWizardDialog extends DialogWrapper implements ActionLis
return myButtonWrapper;
}
protected void createButtons(JPanel buttonPanel, GridBagConstraints gbc) {
buttonPanel.add(myBackButton, gbc);
gbc.gridx++;
gbc.weightx = 1;
buttonPanel.add(Box.createHorizontalGlue(), gbc);
gbc.weightx = 0;
gbc.gridx++;
buttonPanel.add(myNextButton, gbc);
gbc.gridx++;
buttonPanel.add(myStartUsingButton, gbc);
}
void setButtonsVisible(boolean visible) {
myButtonWrapperLayout.show(myButtonWrapper, visible ? BUTTONS : NOBUTTONS);
}
@Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == myStartUsingButton) {
if (e.getSource() == mySkipButton) {
doOKAction();
return;
}
@@ -173,6 +166,10 @@ public class CustomizeIDEWizardDialog extends DialogWrapper implements ActionLis
return;
}
if (e.getSource() == myNextButton) {
if (myIndex >= mySteps.size() - 1) {
doOKAction();
return;
}
myIndex++;
initCurrentStep(true);
}
@@ -209,12 +206,11 @@ public class CustomizeIDEWizardDialog extends DialogWrapper implements ActionLis
if (myIndex > 0) {
myBackButton.setText("Back to " + mySteps.get(myIndex - 1).getTitle());
}
mySkipButton.setText("Skip " + (myIndex > 0 ? "Remaining" : "All") + " and Set Defaults");
myNextButton.setVisible(myIndex < mySteps.size() - 1);
if (myIndex < mySteps.size() - 1) {
myNextButton.setText("Next: " + mySteps.get(myIndex + 1).getTitle());
}
myNextButton.setText(myIndex < mySteps.size() - 1
? "Next: " + mySteps.get(myIndex + 1).getTitle()
: "Start using " + ApplicationNamesInfo.getInstance().getFullProductName());
myHeaderLabel.setText(myCurrentStep.getHTMLHeader());
myFooterLabel.setText(myCurrentStep.getHTMLFooter());
StringBuilder navHTML = new StringBuilder("<html><body>");
@@ -15,8 +15,6 @@
*/
package com.intellij.ide.customize;
import javax.swing.*;
import java.awt.*;
import java.util.List;
/**
@@ -24,6 +22,4 @@ import java.util.List;
*/
public interface CustomizeIDEWizardStepsProvider {
void initSteps(CustomizeIDEWizardDialog wizardDialog, List<AbstractCustomizeWizardStep> steps);
void addButtons(CustomizeIDEWizardDialog wizardDialog, JPanel buttonPanel, GridBagConstraints gbc);
}