From 026208856803f62bc39c79c82c02a8bd56fd1a17 Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Thu, 17 Jul 2014 19:44:57 +0200 Subject: [PATCH 1/2] cosmetics: add extra offset for project icon and label margins --- .../com/intellij/openapi/options/newEditor/OptionsTree.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/options/newEditor/OptionsTree.java b/platform/platform-impl/src/com/intellij/openapi/options/newEditor/OptionsTree.java index 9e1932bd7648..4b278de0a741 100644 --- a/platform/platform-impl/src/com/intellij/openapi/options/newEditor/OptionsTree.java +++ b/platform/platform-impl/src/com/intellij/openapi/options/newEditor/OptionsTree.java @@ -307,7 +307,7 @@ public class OptionsTree extends JPanel implements Disposable, OptionsEditorColl myHandle.setOpaque(false); content.add(myHandle, BorderLayout.WEST); content.add(myComponent, BorderLayout.CENTER); - myProjectIcon = new JLabel(AllIcons.General.ProjectConfigurable); + myProjectIcon = new JLabel(" ", AllIcons.General.ProjectConfigurable, SwingConstants.LEFT); myProjectIcon.setOpaque(true); content.add(myProjectIcon, BorderLayout.EAST); myRendererComponent.add(content, BorderLayout.CENTER); @@ -399,6 +399,9 @@ public class OptionsTree extends JPanel implements Disposable, OptionsEditorColl myTextLabel.setForeground(selected ? UIUtil.getTreeSelectionForeground() : fg); myTextLabel.setOpaque(selected); + if (Registry.is("ide.file.settings.order.new")) { + myTextLabel.setBorder(new EmptyBorder(1,2,1,0)); + } myProjectIcon.setVisible(Registry.is("ide.file.settings.order.new") && getConfigurableProject(base) != null); if (myProjectIcon.isVisible()) { From be1c5b805904915b8ca7e74ce419ceabeb9b6dad Mon Sep 17 00:00:00 2001 From: Sergey Malenkov Date: Thu, 17 Jul 2014 22:51:10 +0400 Subject: [PATCH 2/2] Refactoring: configurable from provider can be null --- .../options/ex/ConfigurableWrapper.java | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/options/ex/ConfigurableWrapper.java b/platform/platform-impl/src/com/intellij/openapi/options/ex/ConfigurableWrapper.java index 46195835286b..5f8dc0e890df 100644 --- a/platform/platform-impl/src/com/intellij/openapi/options/ex/ConfigurableWrapper.java +++ b/platform/platform-impl/src/com/intellij/openapi/options/ex/ConfigurableWrapper.java @@ -47,16 +47,17 @@ public class ConfigurableWrapper implements SearchableConfigurable { @Nullable public static T wrapConfigurable(ConfigurableEP ep) { - if (ep.displayName != null || ep.key != null) { - if (ep.children != null || ep.childrenEPName != null || ep.dynamic) { - T configurable = ep.createConfigurable(); - return configurable != null - ? (T)new CompositeWrapper(ep, configurable) - : null; - } - else { - return (T)new ConfigurableWrapper(ep, null); + if (ep.displayName != null || ep.key != null || ep.groupId != null) { + T configurable = null; + if (ep.providerClass != null) { + configurable = ep.createConfigurable(); + if (configurable == null) { + return null; // it is allowed to return null from provider + } } + return ep.children != null || ep.childrenEPName != null || ep.dynamic + ? (T)new CompositeWrapper(ep, configurable) + : (T)new ConfigurableWrapper(ep, configurable); } else { return ep.createConfigurable(); @@ -104,6 +105,12 @@ public class ConfigurableWrapper implements SearchableConfigurable { @Nls @Override public String getDisplayName() { + if (myEp.displayName == null && myEp.key == null) { + UnnamedConfigurable configurable = getConfigurable(); + if (configurable instanceof Configurable) { + return ((Configurable)configurable).getDisplayName(); + } + } return myEp.getDisplayName(); }