diff --git a/java/execution/impl/src/com/intellij/execution/remote/RemoteConfigurable.form b/java/execution/impl/src/com/intellij/execution/remote/RemoteConfigurable.form index 94cd8b27de81..4f14c055a8b1 100644 --- a/java/execution/impl/src/com/intellij/execution/remote/RemoteConfigurable.form +++ b/java/execution/impl/src/com/intellij/execution/remote/RemoteConfigurable.form @@ -3,7 +3,7 @@ - + @@ -160,7 +160,7 @@ - + diff --git a/platform/platform-api/src/com/intellij/ui/ListCellRendererWrapper.java b/platform/platform-api/src/com/intellij/ui/ListCellRendererWrapper.java index c4694d745975..cb5d4f2adff3 100644 --- a/platform/platform-api/src/com/intellij/ui/ListCellRendererWrapper.java +++ b/platform/platform-api/src/com/intellij/ui/ListCellRendererWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 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. @@ -16,13 +16,18 @@ package com.intellij.ui; import com.intellij.openapi.diagnostic.Logger; +import com.intellij.openapi.util.Pair; +import com.intellij.util.containers.FList; import com.intellij.util.ui.UIUtil; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; import javax.swing.plaf.basic.BasicComboBoxRenderer; import java.awt.*; +import static com.intellij.openapi.util.Pair.pair; + /** * Please use this wrapper in case you need simple cell renderer with text and icon. * This avoids ugly UI under GTK+ look&feel, because in this case SynthComboBoxUI#SynthComboBoxRenderer @@ -41,6 +46,7 @@ public abstract class ListCellRendererWrapper implements ListCellRenderer { private Color myForeground; private Color myBackground; private Font myFont; + private FList> myProperties = FList.emptyList(); @SuppressWarnings("UndesirableClassUsage") public ListCellRendererWrapper() { @@ -60,6 +66,7 @@ public abstract class ListCellRendererWrapper implements ListCellRenderer { myBackground = null; myFont = null; myToolTipText = null; + myProperties = FList.emptyList(); @SuppressWarnings("unchecked") final T t = (T)value; customize(list, t, index, isSelected, cellHasFocus); @@ -85,13 +92,16 @@ public abstract class ListCellRendererWrapper implements ListCellRenderer { if (myBackground != null && !isSelected) label.setBackground(myBackground); if (myFont != null) label.setFont(myFont); label.setToolTipText(myToolTipText); + for (Pair pair : myProperties) { + label.putClientProperty(pair.first, pair.second); + } } return component; } /** * Implement this method to configure text and icon for given value. - * Use {@link #setIcon(javax.swing.Icon)} and {@link #setText(String)} methods. + * Use {@link #setIcon(Icon)} and {@link #setText(String)} methods. * * @param list The JList we're painting. * @param value The value returned by list.getModel().getElementAt(index). @@ -128,4 +138,8 @@ public abstract class ListCellRendererWrapper implements ListCellRenderer { public final void setFont(@Nullable final Font font) { myFont = font; } + + public final void setClientProperty(@NotNull final Object key, @Nullable final Object value) { + myProperties = myProperties.prepend(pair(key, value)); + } } diff --git a/platform/platform-impl/src/com/intellij/ide/ui/AppearanceConfigurable.java b/platform/platform-impl/src/com/intellij/ide/ui/AppearanceConfigurable.java index c50619ac25b7..ec092b3c7e39 100644 --- a/platform/platform-impl/src/com/intellij/ide/ui/AppearanceConfigurable.java +++ b/platform/platform-impl/src/com/intellij/ide/ui/AppearanceConfigurable.java @@ -28,6 +28,7 @@ import com.intellij.openapi.ui.ComboBox; import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.registry.Registry; import com.intellij.openapi.wm.ex.WindowManagerEx; +import com.intellij.ui.ListCellRendererWrapper; import com.intellij.ui.components.JBCheckBox; import com.intellij.util.ui.UIUtil; import org.jetbrains.annotations.NotNull; @@ -48,16 +49,10 @@ import java.util.Hashtable; * @author Eugene Belyaev */ public class AppearanceConfigurable extends BaseConfigurable implements SearchableConfigurable { - private static final Logger LOG = Logger.getInstance("#com.intellij.ide.ui.AppearanceConfigurable"); private MyComponent myComponent; - @Override - public String getDisplayName() { - return IdeBundle.message("title.appearance"); - } - public AppearanceConfigurable() { myComponent = new MyComponent(); } @@ -66,32 +61,29 @@ public class AppearanceConfigurable extends BaseConfigurable implements Searchab if (myComponent == null) { myComponent = new MyComponent(); } - } - private static final ListCellRenderer ourListCellRenderer = new ListCellRenderer() { - - private final DefaultListCellRenderer ourDefaultListCellRenderer = new DefaultListCellRenderer(); - - @Override - public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { - if (AntialiasingType.SUBPIXEL.equals(value)) { - ourDefaultListCellRenderer.putClientProperty(SwingUtilities2.AA_TEXT_PROPERTY_KEY, new SwingUtilities2.AATextInfo(RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB, 140)); - } else if (AntialiasingType.GREYSCALE.equals(value)) { - ourDefaultListCellRenderer.putClientProperty(SwingUtilities2.AA_TEXT_PROPERTY_KEY,new SwingUtilities2.AATextInfo(RenderingHints.VALUE_TEXT_ANTIALIAS_ON, 140)); - } else if (AntialiasingType.OFF.equals(value)) { - ourDefaultListCellRenderer.putClientProperty(SwingUtilities2.AA_TEXT_PROPERTY_KEY, null); - } - - ourDefaultListCellRenderer.setText(value.toString()); - - return ourDefaultListCellRenderer; - } - }; + @Override + public String getDisplayName() { + return IdeBundle.message("title.appearance"); + } @Override - public JComponent createComponent() { + @NotNull + public String getId() { + //noinspection ConstantConditions + return getHelpTopic(); + } + @Override + @Nullable + public Runnable enableSearch(String option) { + return null; + } + + @SuppressWarnings("unchecked") + @Override + public JComponent createComponent() { UISettings settings = UISettings.getInstance(); initComponent(); @@ -109,13 +101,11 @@ public class AppearanceConfigurable extends BaseConfigurable implements Searchab myComponent.myAntialiasingInEditor.setModel(new DefaultComboBoxModel(AntialiasingType.values())); myComponent.myAntialiasingInIDE.setSelectedItem(settings.IDE_AA_TYPE); - myComponent.myAntialiasingInEditor.setSelectedItem(settings.EDITOR_AA_TYPE); + myComponent.myAntialiasingInIDE.setRenderer(new AAListCellRenderer()); + myComponent.myAntialiasingInEditor.setRenderer(new AAListCellRenderer()); - myComponent.myAntialiasingInIDE.setRenderer(ourListCellRenderer); - myComponent.myAntialiasingInEditor.setRenderer(ourListCellRenderer); - - Dictionary delayDictionary = new Hashtable(); + @SuppressWarnings("UseOfObsoleteCollectionType") Dictionary delayDictionary = new Hashtable(); delayDictionary.put(new Integer(0), new JLabel("0")); delayDictionary.put(new Integer(1200), new JLabel("1200")); //delayDictionary.put(new Integer(2400), new JLabel("2400")); @@ -532,16 +522,23 @@ public class AppearanceConfigurable extends BaseConfigurable implements Searchab } } - @Override - @NotNull - public String getId() { - //noinspection ConstantConditions - return getHelpTopic(); - } + private static class AAListCellRenderer extends ListCellRendererWrapper { + private static final SwingUtilities2.AATextInfo SUBPIXEL_HINT = new SwingUtilities2.AATextInfo(RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB, 140); + private static final SwingUtilities2.AATextInfo GREYSCALE_HINT = new SwingUtilities2.AATextInfo(RenderingHints.VALUE_TEXT_ANTIALIAS_ON, 140); - @Override - @Nullable - public Runnable enableSearch(String option) { - return null; + @Override + public void customize(JList list, AntialiasingType value, int index, boolean selected, boolean hasFocus) { + if (value == AntialiasingType.SUBPIXEL) { + setClientProperty(SwingUtilities2.AA_TEXT_PROPERTY_KEY, SUBPIXEL_HINT); + } + else if (value == AntialiasingType.GREYSCALE) { + setClientProperty(SwingUtilities2.AA_TEXT_PROPERTY_KEY, GREYSCALE_HINT); + } + else if (value == AntialiasingType.OFF) { + setClientProperty(SwingUtilities2.AA_TEXT_PROPERTY_KEY, null); + } + + setText(value.toString()); + } } } diff --git a/plugins/properties/src/com/intellij/lang/properties/refactoring/PropertyKeysSafeDeleteProcessor.java b/plugins/properties/src/com/intellij/lang/properties/refactoring/PropertyKeysSafeDeleteProcessor.java index 75d0d721bc0d..f68b893154dc 100644 --- a/plugins/properties/src/com/intellij/lang/properties/refactoring/PropertyKeysSafeDeleteProcessor.java +++ b/plugins/properties/src/com/intellij/lang/properties/refactoring/PropertyKeysSafeDeleteProcessor.java @@ -77,7 +77,10 @@ public class PropertyKeysSafeDeleteProcessor extends SafeDeleteProcessorDelegate final List result = new ArrayList(); for (PropertiesFile propertiesFile : file.getResourceBundle().getPropertiesFiles()) { for (IProperty p : propertiesFile.findPropertiesByKey(key)) { - result.add(p.getPsiElement()); + final PsiElement propertyElement = p.getPsiElement(); + if (!allElementsToDelete.contains(propertyElement)) { + result.add(propertyElement); + } } } return result;