diff --git a/platform/platform-impl/src/com/intellij/ide/customize/AbstractCustomizeWizardStep.java b/platform/platform-impl/src/com/intellij/ide/customize/AbstractCustomizeWizardStep.java index 363e210e33f2..15a690a57233 100644 --- a/platform/platform-impl/src/com/intellij/ide/customize/AbstractCustomizeWizardStep.java +++ b/platform/platform-impl/src/com/intellij/ide/customize/AbstractCustomizeWizardStep.java @@ -15,8 +15,16 @@ */ package com.intellij.ide.customize; +import com.intellij.ui.ClickListener; +import com.intellij.ui.ColorUtil; +import com.intellij.util.ui.UIUtil; +import org.jetbrains.annotations.NotNull; + import javax.swing.*; import java.awt.*; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.awt.event.MouseEvent; public abstract class AbstractCustomizeWizardStep extends JPanel { protected static final int GAP = 20; @@ -27,6 +35,35 @@ public abstract class AbstractCustomizeWizardStep extends JPanel { abstract String getHTMLFooter(); + private static Color getSelectionBackground() { + return ColorUtil.mix(UIUtil.getListSelectionBackground(), UIUtil.getLabelBackground(), .75); + } + + protected static JPanel createBigButtonPanel(LayoutManager layout, final JToggleButton anchorButton, final Runnable action) { + final JPanel panel = new JPanel(layout) { + @Override + public Color getBackground() { + return anchorButton.isSelected() ? getSelectionBackground() : super.getBackground(); + } + }; + panel.setOpaque(true); + new ClickListener() { + @Override + public boolean onClick(@NotNull MouseEvent event, int clickCount) { + anchorButton.setSelected(true); + action.run(); + return true; + } + }.installOn(panel); + anchorButton.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + panel.repaint(); + } + }); + return panel; + } + Component getDefaultFocusedComponent() { return null; } diff --git a/platform/platform-impl/src/com/intellij/ide/customize/CustomizeFeaturedPluginsStepPanel.java b/platform/platform-impl/src/com/intellij/ide/customize/CustomizeFeaturedPluginsStepPanel.java index 5757ccd9e0d5..186c7bdecb20 100644 --- a/platform/platform-impl/src/com/intellij/ide/customize/CustomizeFeaturedPluginsStepPanel.java +++ b/platform/platform-impl/src/com/intellij/ide/customize/CustomizeFeaturedPluginsStepPanel.java @@ -16,7 +16,6 @@ package com.intellij.ide.customize; import com.intellij.CommonBundle; -import com.intellij.icons.AllIcons; import com.intellij.ide.plugins.IdeaPluginDescriptor; import com.intellij.ide.plugins.PluginNode; import com.intellij.openapi.progress.util.ProgressIndicatorBase; @@ -86,7 +85,7 @@ public class CustomizeFeaturedPluginsStepPanel extends AbstractCustomizeWizardSt }; final CardLayout wrapperLayout = new CardLayout(); final JPanel buttonWrapper = new JPanel(wrapperLayout); - final JButton installButton = new JButton("Install", AllIcons.General.DownloadPlugin); + final JButton installButton = new JButton("Install"); final JProgressBar progressBar = new JProgressBar(0, 100); progressBar.setStringPainted(true); buttonWrapper.add(installButton, "button"); @@ -203,7 +202,7 @@ public class CustomizeFeaturedPluginsStepPanel extends AbstractCustomizeWizardSt @Override public String getHTMLHeader() { return "

Download featured plugins

" + - "We have a few plugins in our repository that most users like to download." + + "We have a few plugins in our repository that most users like to download. " + "Perhaps, you need them too?"; } diff --git a/platform/platform-impl/src/com/intellij/ide/customize/CustomizeKeyboardSchemeStepPanel.java b/platform/platform-impl/src/com/intellij/ide/customize/CustomizeKeyboardSchemeStepPanel.java index 9fed09e30580..c5bca8a65005 100644 --- a/platform/platform-impl/src/com/intellij/ide/customize/CustomizeKeyboardSchemeStepPanel.java +++ b/platform/platform-impl/src/com/intellij/ide/customize/CustomizeKeyboardSchemeStepPanel.java @@ -23,74 +23,63 @@ import com.intellij.openapi.ui.VerticalFlowLayout; import javax.swing.*; import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; public class CustomizeKeyboardSchemeStepPanel extends AbstractCustomizeWizardStep { - private final JToggleButton myMacButton; - private final JToggleButton myDefaultButton; + private final JPanel myMacPanel; + private final JPanel myDefaultPanel; public CustomizeKeyboardSchemeStepPanel() {//⌥ alt setLayout(new GridLayout(1, 2, GAP, GAP)); - myMacButton = new JToggleButton(); - myMacButton.setLayout(new VerticalFlowLayout()); final JRadioButton macRadioButton = new JRadioButton("I've never used " + ApplicationNamesInfo.getInstance().getProductName() + " or am a Mac user"); - myMacButton.add(macRadioButton); - myMacButton.add(new JLabel("

" + KeymapManager.MAC_OS_X_10_5_PLUS_KEYMAP + " keymap

" + - "Adapted for Mac

" + - "" + - "" + - "" + - "
EXAMPLES
⌘NGenerate
⌘OGo to class
⌘⌫Delete line
" - )); - - add(myMacButton); - myDefaultButton = new JToggleButton(); - myDefaultButton.setLayout(new VerticalFlowLayout()); - final JRadioButton defaultRadioButton = - new JRadioButton("I used " + ApplicationNamesInfo.getInstance().getProductName() + " before or am a Windows user"); - myDefaultButton.add(defaultRadioButton); - myDefaultButton.add(new JLabel("

" + KeymapManager.MAC_OS_X_KEYMAP + " keymap

" + - "Default for all platforms

" + - "" + - "" + - "" + - "
EXAMPLES
^NGenerate
⌘NGo to class
⌘YDelete line
" - )); - defaultRadioButton.setOpaque(false); macRadioButton.setOpaque(false); - - add(myMacButton); - add(myDefaultButton); - ButtonGroup group = new ButtonGroup(); - ButtonGroup subGroup = new ButtonGroup(); - group.add(myMacButton); - group.add(myDefaultButton); - myMacButton.addActionListener(new ActionListener() { + myMacPanel = createBigButtonPanel(new VerticalFlowLayout(), macRadioButton, new Runnable() { @Override - public void actionPerformed(ActionEvent e) { - macRadioButton.setSelected(myMacButton.isSelected()); + public void run() { StartupUtil.setMyWizardMacKeymap(KeymapManager.MAC_OS_X_10_5_PLUS_KEYMAP); } }); - myDefaultButton.addActionListener(new ActionListener() { + String style = ""; + + myMacPanel.add(macRadioButton); + myMacPanel.add( + new JLabel(""+style+"

" + KeymapManager.MAC_OS_X_10_5_PLUS_KEYMAP + " keymap

" + + "Adapted for Mac

" + + "" + + "" + + "" + + "
EXAMPLES
⌘NGenerate
⌘OGo to class
⌘⌫Delete line
" + )); + + add(myMacPanel); + final JRadioButton defaultRadioButton = + new JRadioButton("I used " + ApplicationNamesInfo.getInstance().getProductName() + " before or am a Windows user"); + defaultRadioButton.setOpaque(false); + myDefaultPanel = createBigButtonPanel(new VerticalFlowLayout(),defaultRadioButton, new Runnable() { @Override - public void actionPerformed(ActionEvent e) { - defaultRadioButton.setSelected(myDefaultButton.isSelected()); + public void run() { StartupUtil.setMyWizardMacKeymap(KeymapManager.MAC_OS_X_KEYMAP); } - }); - subGroup.add(macRadioButton); - subGroup.add(defaultRadioButton); - myDefaultButton.setSelected(true); - defaultRadioButton.setSelected(true); - } + } ); + myDefaultPanel.add(defaultRadioButton); + myDefaultPanel.add(new JLabel("" + style + "

" + KeymapManager.MAC_OS_X_KEYMAP + " keymap

" + + "Default for all platforms

" + + "" + + "" + + "" + + "
EXAMPLES
^NGenerate
⌘NGo to class
⌘YDelete line
" + )); - @Override - Component getDefaultFocusedComponent() { - return myMacButton.isSelected() ? myMacButton : myDefaultButton; + add(myMacPanel); + add(myDefaultPanel); + ButtonGroup group = new ButtonGroup(); + group.add(macRadioButton); + group.add(defaultRadioButton); + defaultRadioButton.setSelected(true); } @Override diff --git a/platform/platform-impl/src/com/intellij/ide/customize/CustomizeUIThemeStepPanel.java b/platform/platform-impl/src/com/intellij/ide/customize/CustomizeUIThemeStepPanel.java index 69aaf32c67a1..6ac22dcfd271 100644 --- a/platform/platform-impl/src/com/intellij/ide/customize/CustomizeUIThemeStepPanel.java +++ b/platform/platform-impl/src/com/intellij/ide/customize/CustomizeUIThemeStepPanel.java @@ -24,16 +24,14 @@ import com.intellij.idea.StartupUtil; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.util.IconLoader; import com.intellij.openapi.util.SystemInfo; -import com.intellij.ui.ClickListener; import com.intellij.util.IconUtil; import com.intellij.util.PlatformUtils; -import com.intellij.util.ui.UIUtil; -import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; import java.awt.*; -import java.awt.event.*; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; import java.util.LinkedHashMap; import java.util.Map; @@ -44,7 +42,6 @@ public class CustomizeUIThemeStepPanel extends AbstractCustomizeWizardStep { private static final String INTELLIJ = "IntelliJ"; private static final String ALLOY = "Alloy. IDEA Theme"; private static final String GTK = "GTK+"; - private Component myDefaultFocusedComponent; private boolean myInitial = true; private boolean myColumnMode; private JLabel myPreviewLabel; @@ -84,17 +81,15 @@ public class CustomizeUIThemeStepPanel extends AbstractCustomizeWizardStep { radioButton.setOpaque(false); if (myDefaultLafName == null) { radioButton.setSelected(true); - myDefaultFocusedComponent = radioButton; myDefaultLafName = lafName; } - final JPanel panel = new JPanel(new BorderLayout(10, 10)) { + final JPanel panel = createBigButtonPanel(new BorderLayout(10, 10), radioButton, new Runnable() { @Override - public Color getBackground() { - return radioButton.isSelected() ? UIUtil.getListSelectionBackground() : super.getBackground(); + public void run() { + applyLaf(lafName, CustomizeUIThemeStepPanel.this); } - }; + }); panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); - panel.setOpaque(true); panel.add(radioButton, BorderLayout.NORTH); final JLabel label = new JLabel(myColumnMode ? IconUtil.scale(icon, .2) : icon) { @Override @@ -104,16 +99,8 @@ public class CustomizeUIThemeStepPanel extends AbstractCustomizeWizardStep { return size; } }; - + label.setVerticalAlignment(SwingConstants.TOP); panel.add(label, BorderLayout.CENTER); - new ClickListener(){ - @Override - public boolean onClick(@NotNull MouseEvent event, int clickCount) { - radioButton.setSelected(true); - applyLaf(lafName, CustomizeUIThemeStepPanel.this); - return true; - } - }.installOn(label); radioButton.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { @@ -137,11 +124,6 @@ public class CustomizeUIThemeStepPanel extends AbstractCustomizeWizardStep { myInitial = false; } - @Override - Component getDefaultFocusedComponent() { - return myDefaultFocusedComponent; - } - @Override public Dimension getPreferredSize() { Dimension size = super.getPreferredSize();