Start plugins wizard #26 better color for selection (Darcula), hide dialog buttons...
authorVassiliy <vassiliy.kudryashov@jetbrains.com>
Wed, 30 Apr 2014 10:21:13 +0000 (14:21 +0400)
committerVassiliy <vassiliy.kudryashov@jetbrains.com>
Wed, 30 Apr 2014 10:25:31 +0000 (14:25 +0400)
platform/platform-impl/src/com/intellij/ide/customize/AbstractCustomizeWizardStep.java
platform/platform-impl/src/com/intellij/ide/customize/CustomizeIDEWizardDialog.java
platform/platform-impl/src/com/intellij/ide/customize/CustomizePluginsStepPanel.java

index 3df11563b30aedde8b30201b6452d3aef050a525..6844ed5bab25b4afc9bb5e96b3a3ecb236d936aa 100644 (file)
@@ -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) {
index 203e0418f6de9c24b903b851e399f4ad073c7be6..9afc0ab9f163f0f450d908810da5b405c0b06159 100644 (file)
@@ -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
index c591f78b6053cb18bcbaf01cf2d5c7d28dacdc20..5fa3bbcbbd25de765917cfa30e38d38fb6e3a645 100644 (file)
@@ -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);
         }
       });
     }