Merge remote-tracking branch 'origin/master'

This commit is contained in:
Roman Shevchenko
2014-07-16 18:24:56 +02:00
4 changed files with 38 additions and 21 deletions
@@ -28,8 +28,10 @@ import com.intellij.openapi.application.ApplicationBundle;
import com.intellij.openapi.keymap.KeymapUtil;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.util.text.StringUtilRt;
import com.intellij.ui.components.JBCheckBox;
import org.intellij.lang.annotations.MagicConstant;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.awt.event.ActionEvent;
@@ -56,7 +58,7 @@ public class CodeCompletionPanel {
private static final String CASE_SENSITIVE_FIRST_LETTER = ApplicationBundle.message("combobox.autocomplete.case.sensitive.first.letter");
private static final String[] CASE_VARIANTS = {CASE_SENSITIVE_ALL, CASE_SENSITIVE_NONE, CASE_SENSITIVE_FIRST_LETTER};
public CodeCompletionPanel(){
public CodeCompletionPanel() {
//noinspection unchecked
myCaseSensitiveCombo.setModel(new DefaultComboBoxModel(CASE_VARIANTS));
@@ -73,7 +75,7 @@ public class CodeCompletionPanel {
myCbAutocompletion.addActionListener(
new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) {
public void actionPerformed(@NotNull ActionEvent event) {
boolean selected = myCbAutocompletion.isSelected();
myCbSelectByChars.setEnabled(selected);
}
@@ -83,7 +85,7 @@ public class CodeCompletionPanel {
myCbAutopopupJavaDoc.addActionListener(
new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) {
public void actionPerformed(@NotNull ActionEvent event) {
myAutopopupJavaDocField.setEnabled(myCbAutopopupJavaDoc.isSelected());
}
}
@@ -92,7 +94,7 @@ public class CodeCompletionPanel {
myCbParameterInfoPopup.addActionListener(
new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) {
public void actionPerformed(@NotNull ActionEvent event) {
myParameterInfoDelayField.setEnabled(myCbParameterInfoPopup.isSelected());
}
}
@@ -205,16 +207,8 @@ public class CodeCompletionPanel {
}
private static int getIntegerValue(String s, int defaultValue) {
int value = defaultValue;
try {
value = Integer.parseInt(s);
if(value < 0) {
return defaultValue;
}
}
catch (NumberFormatException ignored) {
}
return value;
int value = StringUtilRt.parseInt(s, defaultValue);
return value < 0 ? defaultValue : value;
}
@MagicConstant(intValues = {CodeInsightSettings.ALL, CodeInsightSettings.NONE, CodeInsightSettings.FIRST_LETTER})
@@ -66,6 +66,8 @@ import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.wm.IdeFocusManager;
import com.intellij.openapi.wm.IdeGlassPane;
import com.intellij.openapi.wm.ToolWindowAnchor;
import com.intellij.openapi.wm.ex.ToolWindowManagerEx;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiFile;
import com.intellij.ui.*;
@@ -6735,7 +6737,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
}
}
private static class TablessBorder extends SideBorder {
private class TablessBorder extends SideBorder {
private TablessBorder() {
super(UIUtil.getBorderColor(), SideBorder.ALL);
}
@@ -6760,7 +6762,9 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
@Override
public Insets getBorderInsets(Component c) {
Container splitters = SwingUtilities.getAncestorOfClass(EditorsSplitters.class, c);
return splitters == null ? super.getBorderInsets(c) : new Insets(1, 0, 0, 0);
boolean thereIsSomethingAbove = UISettings.getInstance().SHOW_MAIN_TOOLBAR || UISettings.getInstance().SHOW_NAVIGATION_BAR ||
!ToolWindowManagerEx.getInstanceEx(EditorImpl.this.myProject).getIdsOn(ToolWindowAnchor.TOP).isEmpty();
return splitters == null ? super.getBorderInsets(c) : new Insets(thereIsSomethingAbove ? 1 : 0, 0, 0, 0);
}
@Override
@@ -48,7 +48,15 @@ public class ConfigurableWrapper implements SearchableConfigurable {
@Nullable
public static <T extends UnnamedConfigurable> T wrapConfigurable(ConfigurableEP<T> ep) {
if (ep.displayName != null || ep.key != null) {
return (T)(ep.children != null || ep.childrenEPName != null || ep.dynamic ? new CompositeWrapper(ep) : new ConfigurableWrapper(ep));
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);
}
}
else {
return ep.createConfigurable();
@@ -76,8 +84,9 @@ public class ConfigurableWrapper implements SearchableConfigurable {
private final ConfigurableEP myEp;
private ConfigurableWrapper(@NotNull ConfigurableEP ep) {
private ConfigurableWrapper(@NotNull ConfigurableEP ep, @Nullable UnnamedConfigurable configurable) {
myEp = ep;
myConfigurable = configurable;
}
private UnnamedConfigurable myConfigurable;
@@ -172,8 +181,8 @@ public class ConfigurableWrapper implements SearchableConfigurable {
private Configurable[] myKids;
private CompositeWrapper(ConfigurableEP ep, Configurable... kids) {
super(ep);
private CompositeWrapper(@NotNull ConfigurableEP ep, @NotNull UnnamedConfigurable configurable, Configurable... kids) {
super(ep, configurable);
if (ep.dynamic) {
kids = ((Composite)getConfigurable()).getConfigurables();
}
@@ -15,6 +15,7 @@
*/
package com.intellij.lang.properties;
import com.intellij.lang.properties.psi.PropertiesFile;
import com.intellij.lang.properties.refactoring.rename.ResourceBundleRenamerFactory;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.psi.PsiFile;
@@ -25,7 +26,16 @@ import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCa
/**
* @author Dmitry Batkovich
*/
public class ResourceBundleRenameTest extends LightPlatformCodeInsightFixtureTestCase {
public class ResourceBundleTest extends LightPlatformCodeInsightFixtureTestCase {
public void testDefaultPropertyFile() {
final PsiFile rawDefault = myFixture.addFileToProject("p.properties", "");
myFixture.addFileToProject("p_en.properties", "");
final PropertiesFile defaultFile = PropertiesImplUtil.getPropertiesFile(rawDefault);
assertNotNull(defaultFile);
final PropertiesFile file = defaultFile.getResourceBundle().getDefaultPropertiesFile();
assertTrue(file.getContainingFile().isEquivalentTo(defaultFile.getContainingFile()));
}
public void testRenameResourceBundleEntryFile() {
final PsiFile toRenameFile = myFixture.addFileToProject("old_p.properties", "");