Merge remote-tracking branch 'origin/master'

This commit is contained in:
Vladimir.Orlov
2015-09-30 12:56:16 +03:00
4 changed files with 61 additions and 47 deletions
@@ -3,7 +3,7 @@
<grid id="715ea" binding="myPanel" layout-manager="GridLayoutManager" row-count="5" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="64" y="1" width="330" height="324"/>
<xy x="64" y="1" width="425" height="369"/>
</constraints>
<properties/>
<border type="none"/>
@@ -160,7 +160,7 @@
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<componentClass value="javax.swing.JComboBox"/>
<componentClass value="com.intellij.application.options.ModulesComboBox"/>
<labelLocation value="West"/>
<text value="Search sources using m&amp;odule's classpath:" noi18n="true"/>
<visible value="true"/>
@@ -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<T> implements ListCellRenderer {
private Color myForeground;
private Color myBackground;
private Font myFont;
private FList<Pair<Object, Object>> myProperties = FList.emptyList();
@SuppressWarnings("UndesirableClassUsage")
public ListCellRendererWrapper() {
@@ -60,6 +66,7 @@ public abstract class ListCellRendererWrapper<T> 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<T> implements ListCellRenderer {
if (myBackground != null && !isSelected) label.setBackground(myBackground);
if (myFont != null) label.setFont(myFont);
label.setToolTipText(myToolTipText);
for (Pair<Object, Object> 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<T> 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));
}
}
@@ -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<Integer, JComponent> delayDictionary = new Hashtable<Integer, JComponent>();
@SuppressWarnings("UseOfObsoleteCollectionType") Dictionary<Integer, JComponent> delayDictionary = new Hashtable<Integer, JComponent>();
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<AntialiasingType> {
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());
}
}
}
@@ -77,7 +77,10 @@ public class PropertyKeysSafeDeleteProcessor extends SafeDeleteProcessorDelegate
final List<PsiElement> result = new ArrayList<PsiElement>();
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;