From 1c3bcfc3f58cb29d97612a3d300bc292e2ef79f1 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Thu, 21 Jul 2016 12:07:23 +0300 Subject: [PATCH] cleanup --- .../actions/ShowImplementationsAction.java | 7 ++- .../lang/properties/PropertiesUtil.java | 45 ++++++++++--------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/hint/actions/ShowImplementationsAction.java b/platform/lang-impl/src/com/intellij/codeInsight/hint/actions/ShowImplementationsAction.java index 038a85eb921f..37f655cec865 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/hint/actions/ShowImplementationsAction.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/hint/actions/ShowImplementationsAction.java @@ -155,8 +155,6 @@ public class ShowImplementationsAction extends AnAction implements PopupAction { String text = ""; PsiElement[] impls = PsiElement.EMPTY_ARRAY; if (element != null) { - //if (element instanceof PsiPackage) return; - impls = getSelfAndImplementations(editor, element, createImplementationsSearcher()); text = SymbolPresentationUtil.getSymbolPresentableText(element); } @@ -176,7 +174,7 @@ public class ShowImplementationsAction extends AnAction implements PopupAction { } if (!implsList.isEmpty()) { - implsList.toArray( impls = new PsiElement[implsList.size()] ); + impls = implsList.toArray(new PsiElement[implsList.size()]); } } @@ -455,7 +453,8 @@ public class ShowImplementationsAction extends AnAction implements PopupAction { }; if (!myIncludeSelf) { myElements = getSelfAndImplementations(myEditor, myElement, implementationSearcher, false); - } else { + } + else { myElements = getSelfAndImplementations(myEditor, myElement, implementationSearcher); } } diff --git a/plugins/properties/properties-psi-api/src/com/intellij/lang/properties/PropertiesUtil.java b/plugins/properties/properties-psi-api/src/com/intellij/lang/properties/PropertiesUtil.java index 315273769180..dd4e9eca0546 100644 --- a/plugins/properties/properties-psi-api/src/com/intellij/lang/properties/PropertiesUtil.java +++ b/plugins/properties/properties-psi-api/src/com/intellij/lang/properties/PropertiesUtil.java @@ -40,26 +40,27 @@ import java.util.regex.Pattern; * @author cdr */ public class PropertiesUtil { - public final static Pattern LOCALE_PATTERN = Pattern.compile("(_[a-zA-Z]{2,8}(_[a-zA-Z]{2}|[0-9]{3})?(_[\\w\\-]+)?)\\.[^_]+$"); - public final static Set BASE_NAME_BORDER_CHAR = ContainerUtil.newHashSet('-', '_', '.'); - public final static Locale DEFAULT_LOCALE = new Locale("", "", ""); + private static final Pattern LOCALE_PATTERN = Pattern.compile("(_[a-zA-Z]{2,8}(_[a-zA-Z]{2}|[0-9]{3})?(_[\\w\\-]+)?)\\.[^_]+$"); + public static final Set BASE_NAME_BORDER_CHAR = ContainerUtil.newHashSet('-', '_', '.'); + public static final Locale DEFAULT_LOCALE = new Locale("", "", ""); private static final SoftLazyValue> LOCALES_LANGUAGE_CODES = new SoftLazyValue>() { @NotNull @Override protected Set compute() { final HashSet locales = - new HashSet(ContainerUtil.flatten(ContainerUtil.map(Locale.getAvailableLocales(), - (Function>)locale -> { - final ArrayList languages = ContainerUtil.newArrayList(locale.getLanguage()); - try { - languages.add(locale.getISO3Language()); - } - catch (MissingResourceException ignored) { - // if ISO3 language is not found for existed locale then exception is thrown anyway - } - return languages; - }))); + new HashSet<>(ContainerUtil.flatten(ContainerUtil.map(Locale.getAvailableLocales(), + (Function>)locale -> { + final ArrayList languages = + ContainerUtil.newArrayList(locale.getLanguage()); + try { + languages.add(locale.getISO3Language()); + } + catch (MissingResourceException ignored) { + // if ISO3 language is not found for existed locale then exception is thrown anyway + } + return languages; + }))); locales.addAll(ContainerUtil.newArrayList(Locale.getISOLanguages())); return locales; } @@ -97,7 +98,7 @@ public class PropertiesUtil { } @NotNull - public static String getDefaultBaseName(@NotNull final VirtualFile file) { + static String getDefaultBaseName(@NotNull final VirtualFile file) { final String name = file.getName(); if (!StringUtil.containsChar(name, '_')) { @@ -126,7 +127,7 @@ public class PropertiesUtil { } @NotNull - public static Locale getLocale(final @NotNull PropertiesFile propertiesFile) { + public static Locale getLocale(@NotNull final PropertiesFile propertiesFile) { String name = propertiesFile.getName(); if (!StringUtil.containsChar(name, '_')) return DEFAULT_LOCALE; final String containingResourceBundleBaseName = propertiesFile.getResourceBundle().getBaseName(); @@ -153,7 +154,7 @@ public class PropertiesUtil { * messages_en.properties is a parent of the messages_en_US.properties */ @Nullable - public static PropertiesFile getParent(PropertiesFile file, Collection candidates) { + public static PropertiesFile getParent(@NotNull PropertiesFile file, @NotNull Collection candidates) { VirtualFile virtualFile = file.getVirtualFile(); if (virtualFile == null) return null; String name = virtualFile.getNameWithoutExtension(); @@ -175,7 +176,7 @@ public class PropertiesUtil { @NotNull @Deprecated public static List findAllProperties(Project project, @NotNull ResourceBundle resourceBundle, String key) { - List result = new SmartList(); + List result = new SmartList<>(); List propertiesFiles = resourceBundle.getPropertiesFiles(); for (PropertiesFile propertiesFile : propertiesFiles) { result.addAll(propertiesFile.findPropertiesByKey(key)); @@ -184,7 +185,7 @@ public class PropertiesUtil { } public static List findAllProperties(@NotNull ResourceBundle resourceBundle, String key) { - List result = new SmartList(); + List result = new SmartList<>(); List propertiesFiles = resourceBundle.getPropertiesFiles(); for (PropertiesFile propertiesFile : propertiesFiles) { result.addAll(propertiesFile.findPropertiesByKey(key)); @@ -206,13 +207,13 @@ public class PropertiesUtil { } @Nullable - public static String getPackageQualifiedName(@NotNull PsiDirectory directory) { + static String getPackageQualifiedName(@NotNull PsiDirectory directory) { return ProjectRootManager.getInstance(directory.getProject()).getFileIndex().getPackageNameByDirectory(directory.getVirtualFile()); } @NotNull public static String getPresentableLocale(@NotNull Locale locale) { - List names = new ArrayList(); + List names = new ArrayList<>(); if (!Comparing.strEqual(locale.getDisplayLanguage(), null)) { names.add(locale.getDisplayLanguage()); } @@ -222,7 +223,7 @@ public class PropertiesUtil { if (!Comparing.strEqual(locale.getDisplayVariant(), null)) { names.add(locale.getDisplayVariant()); } - return names.isEmpty() ? "" : (" (" + StringUtil.join(names, "/") + ")"); + return names.isEmpty() ? "" : " (" + StringUtil.join(names, "/") + ")"; } public static boolean hasDefaultLanguage(Locale locale) {