Start plugins wizard #26 better color for selection (Darcula), hide dialog buttons when in "Customize plugin group" mode

This commit is contained in:
Vassiliy
2014-04-30 14:25:31 +04:00
parent 4f97e929fc
commit 985bef30e6
3 changed files with 38 additions and 12 deletions
@@ -37,7 +37,7 @@ public abstract class AbstractCustomizeWizardStep extends JPanel {
@NotNull
protected static Color getSelectionBackground() {
return ColorUtil.mix(UIUtil.getListSelectionBackground(), UIUtil.getLabelBackground(), .75);
return ColorUtil.mix(UIUtil.getListSelectionBackground(), UIUtil.getLabelBackground(), UIUtil.isUnderDarcula() ? .5 : .75);
}
protected static JPanel createBigButtonPanel(LayoutManager layout, final JToggleButton anchorButton, final Runnable action) {
@@ -32,6 +32,8 @@ import java.util.ArrayList;
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");
@@ -42,6 +44,8 @@ public class CustomizeIDEWizardDialog extends DialogWrapper implements ActionLis
private final JLabel myNavigationLabel = new JLabel();
private final JLabel myHeaderLabel = new JLabel();
private final JLabel myFooterLabel = new JLabel();
private final CardLayout myButtonWrapperLayout = new CardLayout();
private final JPanel myButtonWrapper = new JPanel(myButtonWrapperLayout);
private JPanel myContentPanel;
public CustomizeIDEWizardDialog() {
@@ -99,23 +103,30 @@ public class CustomizeIDEWizardDialog extends DialogWrapper implements ActionLis
@Override
protected JComponent createSouthPanel() {
final JPanel result = new JPanel(new GridBagLayout());
final JPanel buttonPanel = new JPanel(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.insets.right = 5;
gbc.fill = GridBagConstraints.BOTH;
gbc.gridx = 0;
gbc.gridy = 0;
result.add(mySkipButton, gbc);
buttonPanel.add(mySkipButton, gbc);
gbc.gridx++;
result.add(myBackButton, gbc);
buttonPanel.add(myBackButton, gbc);
gbc.gridx++;
gbc.weightx = 1;
result.add(Box.createHorizontalGlue(), gbc);
buttonPanel.add(Box.createHorizontalGlue(), gbc);
gbc.gridx++;
gbc.weightx = 0;
result.add(myNextButton, gbc);
result.setBorder(BorderFactory.createEmptyBorder(8, 0, 0, 0));
return result;
buttonPanel.add(myNextButton, gbc);
buttonPanel.setBorder(BorderFactory.createEmptyBorder(8, 0, 0, 0));
myButtonWrapper.add(buttonPanel, BUTTONS);
myButtonWrapper.add(new JLabel(), NOBUTTONS);
myButtonWrapperLayout.show(myButtonWrapper, BUTTONS);
return myButtonWrapper;
}
void setButtonsVisible(boolean visible) {
myButtonWrapperLayout.show(myButtonWrapper, visible ? BUTTONS : NOBUTTONS);
}
@Override
@@ -16,6 +16,7 @@
package com.intellij.ide.customize;
import com.intellij.openapi.application.ApplicationNamesInfo;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.ui.VerticalFlowLayout;
import com.intellij.openapi.util.IconLoader;
import com.intellij.openapi.util.Pair;
@@ -162,6 +163,14 @@ public class CustomizePluginsStepPanel extends AbstractCustomizeWizardStep imple
if (CUSTOMIZE_COMMAND.equals(command)) {
myCustomizePanel.update(group);
myCardLayout.show(this, CUSTOMIZE);
setButtonsVisible(false);
}
}
private void setButtonsVisible(boolean visible) {
DialogWrapper window = DialogWrapper.findInstance(this);
if (window instanceof CustomizeIDEWizardDialog) {
((CustomizeIDEWizardDialog)window).setButtonsVisible(visible);
}
}
@@ -225,15 +234,21 @@ public class CustomizePluginsStepPanel extends AbstractCustomizeWizardStep imple
setLayout(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, GAP, true, false));
add(myTitleLabel);
add(myContentPanel);
JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.LEADING, 25, 5));
buttonPanel.add(mySaveButton);
buttonPanel.add(new LinkLabel<String>("Enable All", null, this, "enable"));
buttonPanel.add(new LinkLabel<String>("Disable All", null, this, "disable"));
JPanel buttonPanel = new JPanel(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.insets.right = 25;
gbc.gridy = 0;
buttonPanel.add(mySaveButton, gbc);
buttonPanel.add(new LinkLabel<String>("Enable All", null, this, "enable"), gbc);
buttonPanel.add(new LinkLabel<String>("Disable All", null, this, "disable"), gbc);
gbc.weightx = 1;
buttonPanel.add(Box.createHorizontalGlue(), gbc);
add(buttonPanel);
mySaveButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
myCardLayout.show(CustomizePluginsStepPanel.this, MAIN);
setButtonsVisible(true);
}
});
}