diff options
Diffstat (limited to 'platform/platform-impl/src/com/intellij/ide/customize')
6 files changed, 146 insertions, 27 deletions
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 6844ed5bab25..798247e16186 100644 --- a/platform/platform-impl/src/com/intellij/ide/customize/AbstractCustomizeWizardStep.java +++ b/platform/platform-impl/src/com/intellij/ide/customize/AbstractCustomizeWizardStep.java @@ -21,12 +21,14 @@ import com.intellij.util.ui.UIUtil; import org.jetbrains.annotations.NotNull; import javax.swing.*; +import javax.swing.border.Border; 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 SMALL_GAP = 10; protected static final int GAP = 20; protected abstract String getTitle(); @@ -40,6 +42,14 @@ public abstract class AbstractCustomizeWizardStep extends JPanel { return ColorUtil.mix(UIUtil.getListSelectionBackground(), UIUtil.getLabelBackground(), UIUtil.isUnderDarcula() ? .5 : .75); } + public static Border createSmallEmptyBorder() { + return BorderFactory.createEmptyBorder(SMALL_GAP, SMALL_GAP, SMALL_GAP, SMALL_GAP); + } + + public static BorderLayout createSmallBorderLayout() { + return new BorderLayout(SMALL_GAP, SMALL_GAP); + } + protected static JPanel createBigButtonPanel(LayoutManager layout, final JToggleButton anchorButton, final Runnable action) { final JPanel panel = new JPanel(layout) { @Override diff --git a/platform/platform-impl/src/com/intellij/ide/customize/CustomizeDesktopEntryStep.java b/platform/platform-impl/src/com/intellij/ide/customize/CustomizeDesktopEntryStep.java new file mode 100644 index 000000000000..57b68232b797 --- /dev/null +++ b/platform/platform-impl/src/com/intellij/ide/customize/CustomizeDesktopEntryStep.java @@ -0,0 +1,108 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.ide.customize; + +import com.intellij.ide.actions.CreateDesktopEntryAction; +import com.intellij.idea.ActionsBundle; +import com.intellij.openapi.application.PathManager; +import com.intellij.openapi.progress.EmptyProgressIndicator; +import com.intellij.openapi.util.EmptyRunnable; +import com.intellij.openapi.util.IconLoader; +import com.intellij.util.ui.GridBag; +import com.intellij.util.ui.UIUtil; + +import javax.swing.*; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.*; + +/** + * @author Alexander Lobas + */ +public class CustomizeDesktopEntryStep extends AbstractCustomizeWizardStep { + private final JCheckBox myCreateEntryCheckBox = new JCheckBox(ActionsBundle.message("action.CreateDesktopEntry.description")); + private final JCheckBox myGlobalEntryCheckBox = new JCheckBox("For all users"); + + public CustomizeDesktopEntryStep(String iconPath) { + setLayout(new BorderLayout()); + + JPanel panel = createBigButtonPanel(createSmallBorderLayout(), myCreateEntryCheckBox, EmptyRunnable.INSTANCE); + panel.setBorder(createSmallEmptyBorder()); + + JPanel buttonPanel = new JPanel(new GridBagLayout()); + buttonPanel.setOpaque(false); + + GridBag gbc = + new GridBag().setDefaultAnchor(GridBagConstraints.WEST).setDefaultFill(GridBagConstraints.HORIZONTAL).setDefaultWeightX(1); + + myCreateEntryCheckBox.setOpaque(false); + buttonPanel.add(myCreateEntryCheckBox, gbc.nextLine()); + + myGlobalEntryCheckBox.setOpaque(false); + gbc.nextLine().insets.left = UIUtil.PANEL_REGULAR_INSETS.left; + buttonPanel.add(myGlobalEntryCheckBox, gbc); + + panel.add(buttonPanel, BorderLayout.NORTH); + + JLabel label = new JLabel(IconLoader.getIcon(iconPath)); + label.setVerticalAlignment(JLabel.TOP); + panel.add(label, BorderLayout.CENTER); + + add(panel, BorderLayout.CENTER); + + myCreateEntryCheckBox.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + myGlobalEntryCheckBox.setEnabled(myCreateEntryCheckBox.isSelected()); + myGlobalEntryCheckBox.setSelected(myCreateEntryCheckBox.isSelected() && !PathManager.getHomePath().startsWith("/home")); + } + }); + + myCreateEntryCheckBox.setSelected(true); + } + + public static boolean isAvailable() { + return CreateDesktopEntryAction.isAvailable(); + } + + @Override + public boolean beforeOkAction() { + if (myCreateEntryCheckBox.isSelected()) { + try { + CreateDesktopEntryAction.createDesktopEntry(null, new EmptyProgressIndicator(), myGlobalEntryCheckBox.isSelected()); + } + catch (Throwable e) { + // ignored + } + } + return true; + } + + @Override + protected String getTitle() { + return "Desktop Entry"; + } + + @Override + protected String getHTMLHeader() { + return "<html><body><h2>Create Desktop Entry</h2> </body></html>"; + } + + @Override + protected String getHTMLFooter() { + return "Desktop entry can be created later in Tools | Create Desktop Entry..."; + } +}
\ No newline at end of file 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 786a5825e783..498391b8e971 100644 --- a/platform/platform-impl/src/com/intellij/ide/customize/CustomizeFeaturedPluginsStepPanel.java +++ b/platform/platform-impl/src/com/intellij/ide/customize/CustomizeFeaturedPluginsStepPanel.java @@ -18,7 +18,9 @@ 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.PluginManagerCore; import com.intellij.ide.plugins.PluginNode; +import com.intellij.openapi.options.OptionsBundle; import com.intellij.openapi.progress.util.ProgressIndicatorBase; import com.intellij.openapi.ui.VerticalFlowLayout; import com.intellij.openapi.updateSettings.impl.PluginDownloader; @@ -78,7 +80,7 @@ public class CustomizeFeaturedPluginsStepPanel extends AbstractCustomizeWizardSt final String pluginId = s.substring(j + 1); IdeaPluginDescriptor foundDescriptor = null; for (IdeaPluginDescriptor descriptor : pluginsFromRepository) { - if (descriptor.getPluginId().getIdString().equals(pluginId)) { + if (descriptor.getPluginId().getIdString().equals(pluginId) && !PluginManagerCore.isBrokenPlugin(descriptor)) { foundDescriptor = descriptor; isEmptyOrOffline = false; break; @@ -107,11 +109,11 @@ public class CustomizeFeaturedPluginsStepPanel extends AbstractCustomizeWizardSt JPanel progressPanel = new JPanel(new VerticalFlowLayout(true, false)); progressPanel.add(progressBar); final LinkLabel cancelLink = new LinkLabel("Cancel", AllIcons.Actions.Cancel); - JPanel linkWrapper = new JPanel(new FlowLayout(FlowLayout.CENTER)); + JPanel linkWrapper = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0)); linkWrapper.add(cancelLink); progressPanel.add(linkWrapper); - JPanel buttonPanel = new JPanel(new VerticalFlowLayout()); + JPanel buttonPanel = new JPanel(new VerticalFlowLayout(0, 0)); buttonPanel.add(installButton); buttonWrapper.add(buttonPanel, "button"); @@ -218,7 +220,7 @@ public class CustomizeFeaturedPluginsStepPanel extends AbstractCustomizeWizardSt }, null); gbc.insets.bottom = -5; groupPanel.add(titleLabel, gbc); - gbc.insets.bottom = 10; + gbc.insets.bottom = SMALL_GAP; groupPanel.add(topicLabel, gbc); groupPanel.add(descriptionLabel, gbc); gbc.weighty = 1; @@ -238,7 +240,7 @@ public class CustomizeFeaturedPluginsStepPanel extends AbstractCustomizeWizardSt protected Color getColor() { return ColorUtil.withAlpha(JBColor.foreground(), .2); } - }, BorderFactory.createEmptyBorder(GAP, GAP, 0, GAP))); + }, BorderFactory.createEmptyBorder(0, SMALL_GAP, 0, SMALL_GAP))); cursor++; } @@ -260,7 +262,10 @@ public class CustomizeFeaturedPluginsStepPanel extends AbstractCustomizeWizardSt @Override public String getHTMLFooter() { - return "New plugins can also be downloaded in " + CommonBundle.settingsTitle() + " | Plugins"; + return "New plugins can also be downloaded in " + + CommonBundle.settingsTitle() + + " | " + OptionsBundle.message("configurable.group.appearance.settings.display.name") + + " | " + "Plugins"; } public static class OfflineException extends Exception {}; diff --git a/platform/platform-impl/src/com/intellij/ide/customize/CustomizeIDEWizardDialog.java b/platform/platform-impl/src/com/intellij/ide/customize/CustomizeIDEWizardDialog.java index be37f9d9d7f6..af3c193ca9d9 100644 --- a/platform/platform-impl/src/com/intellij/ide/customize/CustomizeIDEWizardDialog.java +++ b/platform/platform-impl/src/com/intellij/ide/customize/CustomizeIDEWizardDialog.java @@ -21,7 +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 org.jetbrains.annotations.NotNull; +import com.intellij.util.PlatformUtils; import org.jetbrains.annotations.Nullable; import javax.swing.*; @@ -51,6 +51,7 @@ public class CustomizeIDEWizardDialog extends DialogWrapper implements ActionLis public CustomizeIDEWizardDialog() { super(null, true, true); setTitle("Customize " + ApplicationNamesInfo.getInstance().getProductName()); + getPeer().setAppIcons(); initSteps(); mySkipButton.addActionListener(this); myBackButton.addActionListener(this); @@ -119,7 +120,7 @@ public class CustomizeIDEWizardDialog extends DialogWrapper implements ActionLis result.add(myContentPanel, BorderLayout.CENTER); result.add(myFooterLabel, BorderLayout.SOUTH); result.setPreferredSize(new Dimension(700, 600)); - result.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); + result.setBorder(AbstractCustomizeWizardStep.createSmallEmptyBorder()); return result; } @@ -131,8 +132,10 @@ public class CustomizeIDEWizardDialog extends DialogWrapper implements ActionLis gbc.fill = GridBagConstraints.BOTH; gbc.gridx = 0; gbc.gridy = 0; - buttonPanel.add(mySkipButton, gbc); - gbc.gridx++; + if (!PlatformUtils.isCLion()) { + buttonPanel.add(mySkipButton, gbc); + gbc.gridx++; + } buttonPanel.add(myBackButton, gbc); gbc.gridx++; gbc.weightx = 1; @@ -219,15 +222,4 @@ public class CustomizeIDEWizardDialog extends DialogWrapper implements ActionLis } myNavigationLabel.setText(navHTML.toString()); } - - - private static <T extends Component> void getChildren(@NotNull Component c, Class<? extends T> cls, List<T> accumulator) { - if (cls.isAssignableFrom(c.getClass())) accumulator.add((T)c); - if (c instanceof Container) { - Component[] components = ((Container)c).getComponents(); - for (Component component : components) { - getChildren(component, cls, accumulator); - } - } - } } diff --git a/platform/platform-impl/src/com/intellij/ide/customize/CustomizePluginsStepPanel.java b/platform/platform-impl/src/com/intellij/ide/customize/CustomizePluginsStepPanel.java index 8924c09780dd..de12269b5887 100644 --- a/platform/platform-impl/src/com/intellij/ide/customize/CustomizePluginsStepPanel.java +++ b/platform/platform-impl/src/com/intellij/ide/customize/CustomizePluginsStepPanel.java @@ -115,7 +115,7 @@ public class CustomizePluginsStepPanel extends AbstractCustomizeWizardStep imple gbc.weighty = 1; groupPanel.add(Box.createVerticalGlue(), gbc); gbc.weighty = 0; - JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 10, 5)); + JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, SMALL_GAP, SMALL_GAP / 2)); buttonsPanel.setOpaque(false); if (pluginGroups.getSets(group).size() == 1) { buttonsPanel.add(createLink(SWITCH_COMMAND + ":" + group, getGroupSwitchTextProvider(group))); @@ -139,7 +139,7 @@ public class CustomizePluginsStepPanel extends AbstractCustomizeWizardStep imple protected Color getColor() { return ColorUtil.withAlpha(JBColor.foreground(), .2); } - }, BorderFactory.createEmptyBorder(GAP / 2, GAP, GAP / 2, GAP))); + }, BorderFactory.createEmptyBorder(SMALL_GAP, GAP, SMALL_GAP, GAP))); cursor++; } } 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 b369e49f8bca..c7b29ef53827 100644 --- a/platform/platform-impl/src/com/intellij/ide/customize/CustomizeUIThemeStepPanel.java +++ b/platform/platform-impl/src/com/intellij/ide/customize/CustomizeUIThemeStepPanel.java @@ -22,6 +22,7 @@ import com.intellij.ide.ui.laf.darcula.DarculaLaf; import com.intellij.ide.ui.laf.darcula.DarculaLookAndFeelInfo; import com.intellij.idea.StartupUtil; import com.intellij.openapi.application.ApplicationManager; +import com.intellij.openapi.options.OptionsBundle; import com.intellij.openapi.util.IconLoader; import com.intellij.openapi.util.SystemInfo; import com.intellij.util.IconUtil; @@ -46,7 +47,7 @@ public class CustomizeUIThemeStepPanel extends AbstractCustomizeWizardStep { private Map<String, Icon> myLafNames = new LinkedHashMap<String, Icon>(); public CustomizeUIThemeStepPanel() { - setLayout(new BorderLayout(10, 10)); + setLayout(createSmallBorderLayout()); IconLoader.activate(); initLafs(); @@ -65,13 +66,13 @@ public class CustomizeUIThemeStepPanel extends AbstractCustomizeWizardStep { radioButton.setSelected(true); myDefaultLafName = lafName; } - final JPanel panel = createBigButtonPanel(new BorderLayout(10, 10), radioButton, new Runnable() { + final JPanel panel = createBigButtonPanel(createSmallBorderLayout(), radioButton, new Runnable() { @Override public void run() { applyLaf(lafName, CustomizeUIThemeStepPanel.this); } }); - panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); + panel.setBorder(createSmallEmptyBorder()); panel.add(radioButton, myColumnMode ? BorderLayout.WEST : BorderLayout.NORTH); final JLabel label = new JLabel(myColumnMode ? IconUtil.scale(IconUtil.cropIcon(icon, icon.getIconWidth() * 2 / 3, icon.getIconHeight() * 2 / 3), .5) : icon); label.setVerticalAlignment(SwingConstants.TOP); @@ -139,7 +140,10 @@ public class CustomizeUIThemeStepPanel extends AbstractCustomizeWizardStep { @Override public String getHTMLFooter() { - return "UI theme can be changed later in " + CommonBundle.settingsTitle() + " | Appearance"; + return "UI theme can be changed later in " + + CommonBundle.settingsTitle() + + " | " + OptionsBundle.message("configurable.group.appearance.settings.display.name") + + " | " + "Appearance"; } private void applyLaf(String lafName, Component component) { |