From 44e92eaa24624ff539073dca61cb73158e48d1a1 Mon Sep 17 00:00:00 2001 From: Alexander Lobas Date: Thu, 1 Dec 2016 11:18:22 +0300 Subject: [PATCH] IDEA-157763 Settings repository for IDE: new UI --- .../src/com/intellij/openapi/ui/Messages.java | 85 ++++++++----------- .../ide/plugins/PluginsTableRenderer.java | 4 +- 2 files changed, 37 insertions(+), 52 deletions(-) diff --git a/platform/platform-api/src/com/intellij/openapi/ui/Messages.java b/platform/platform-api/src/com/intellij/openapi/ui/Messages.java index 48e3a167eb8d..592a13bbd544 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/Messages.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/Messages.java @@ -1494,6 +1494,16 @@ public class Messages { } protected JComponent doCreateCenterPanel() { + JPanel panel = createIconPanel(); + if (myMessage != null) { + JTextPane messageComponent = createMessageComponent(myMessage); + panel.add(wrapToScrollPaneIfNeeded(messageComponent, 100, 10), BorderLayout.CENTER); + } + return panel; + } + + @NotNull + protected JPanel createIconPanel() { JPanel panel = new JPanel(new BorderLayout(15, 0)); if (myIcon != null) { JLabel iconLabel = new JLabel(myIcon); @@ -1502,13 +1512,21 @@ public class Messages { container.add(iconLabel, BorderLayout.NORTH); panel.add(container, BorderLayout.WEST); } - if (myMessage != null) { - JTextPane messageComponent = createMessageComponent(myMessage); - panel.add(wrapToScrollPaneIfNeeded(messageComponent, 100, 10), BorderLayout.CENTER); - } return panel; } + @NotNull + protected JPanel createMessagePanel() { + JPanel messagePanel = new JPanel(new BorderLayout()); + if (myMessage != null) { + JLabel textLabel = new JLabel(myMessage); + textLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0)); + textLabel.setUI(new MultiLineLabelUI()); + messagePanel.add(textLabel, BorderLayout.NORTH); + } + return messagePanel; + } + protected static JTextPane createMessageComponent(final String message) { final JTextPane messageComponent = new JTextPane(); return configureMessagePaneUi(messageComponent, message); @@ -1629,34 +1647,22 @@ public class Messages { @Override protected JComponent createNorthPanel() { - JPanel panel = new JPanel(new BorderLayout(15, 0)); - if (myIcon != null) { - JLabel iconLabel = new JLabel(myIcon); - Container container = new Container(); - container.setLayout(new BorderLayout()); - container.add(iconLabel, BorderLayout.NORTH); - panel.add(container, BorderLayout.WEST); - } + JPanel panel = createIconPanel(); + JPanel messagePanel = createMessagePanel(); - JPanel messagePanel = new JPanel(new BorderLayout()); - if (myMessage != null) { - JLabel textLabel = new JLabel(myMessage); - textLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0)); - textLabel.setUI(new MultiLineLabelUI()); - messagePanel.add(textLabel, BorderLayout.NORTH); - } - - final JPanel checkboxPanel = new JPanel(); - checkboxPanel.setLayout(new BoxLayout(checkboxPanel, BoxLayout.X_AXIS)); - - myCheckBox = new JCheckBox(myCheckboxText); - myCheckBox.setSelected(myChecked); - messagePanel.add(myCheckBox, BorderLayout.SOUTH); + messagePanel.add(createCheckComponent(), BorderLayout.SOUTH); panel.add(messagePanel, BorderLayout.CENTER); return panel; } + @NotNull + protected JComponent createCheckComponent() { + myCheckBox = new JCheckBox(myCheckboxText); + myCheckBox.setSelected(myChecked); + return myCheckBox; + } + @Override public int getExitCode() { final int exitCode = super.getExitCode(); @@ -1786,14 +1792,7 @@ public class Messages { @Override protected JComponent createNorthPanel() { - JPanel panel = new JPanel(new BorderLayout(15, 0)); - if (myIcon != null) { - JLabel iconLabel = new JLabel(myIcon); - Container container = new Container(); - container.setLayout(new BorderLayout()); - container.add(iconLabel, BorderLayout.NORTH); - panel.add(container, BorderLayout.WEST); - } + JPanel panel = createIconPanel(); JPanel messagePanel = createMessagePanel(); panel.add(messagePanel, BorderLayout.CENTER); @@ -2014,22 +2013,8 @@ public class Messages { @Override protected JComponent createNorthPanel() { - JPanel panel = new JPanel(new BorderLayout(15, 0)); - if (myIcon != null) { - JLabel iconLabel = new JLabel(myIcon); - Container container = new Container(); - container.setLayout(new BorderLayout()); - container.add(iconLabel, BorderLayout.NORTH); - panel.add(container, BorderLayout.WEST); - } - - JPanel messagePanel = new JPanel(new BorderLayout()); - if (myMessage != null) { - JLabel textLabel = new JLabel(myMessage); - textLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0)); - textLabel.setUI(new MultiLineLabelUI()); - messagePanel.add(textLabel, BorderLayout.NORTH); - } + JPanel panel = createIconPanel(); + JPanel messagePanel = createMessagePanel(); myComboBox = new ComboBox(220); messagePanel.add(myComboBox, BorderLayout.SOUTH); diff --git a/platform/platform-impl/src/com/intellij/ide/plugins/PluginsTableRenderer.java b/platform/platform-impl/src/com/intellij/ide/plugins/PluginsTableRenderer.java index 777f7ef5efa4..9173d093324e 100644 --- a/platform/platform-impl/src/com/intellij/ide/plugins/PluginsTableRenderer.java +++ b/platform/platform-impl/src/com/intellij/ide/plugins/PluginsTableRenderer.java @@ -48,7 +48,7 @@ import java.util.Set; public class PluginsTableRenderer extends DefaultTableCellRenderer { private static final InstalledPluginsState ourState = InstalledPluginsState.getInstance(); - private SimpleColoredComponent myName; + protected SimpleColoredComponent myName; private JLabel myStatus; private RatesPanel myRating; private JLabel myDownloads; @@ -60,7 +60,7 @@ public class PluginsTableRenderer extends DefaultTableCellRenderer { private JPanel myBottomPanel; private JPanel myInfoPanel; - private final IdeaPluginDescriptor myPluginDescriptor; + protected final IdeaPluginDescriptor myPluginDescriptor; private final boolean myPluginsView; // showFullInfo: true for Plugin Repository view, false for Installed Plugins view