mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup
This commit is contained in:
+3
-4
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
+23
-22
@@ -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<Character> 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<Character> BASE_NAME_BORDER_CHAR = ContainerUtil.newHashSet('-', '_', '.');
|
||||
public static final Locale DEFAULT_LOCALE = new Locale("", "", "");
|
||||
|
||||
private static final SoftLazyValue<Set<String>> LOCALES_LANGUAGE_CODES = new SoftLazyValue<Set<String>>() {
|
||||
@NotNull
|
||||
@Override
|
||||
protected Set<String> compute() {
|
||||
final HashSet<String> locales =
|
||||
new HashSet<String>(ContainerUtil.flatten(ContainerUtil.map(Locale.getAvailableLocales(),
|
||||
(Function<Locale, List<String>>)locale -> {
|
||||
final ArrayList<String> 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, List<String>>)locale -> {
|
||||
final ArrayList<String> 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<PropertiesFile> candidates) {
|
||||
public static PropertiesFile getParent(@NotNull PropertiesFile file, @NotNull Collection<PropertiesFile> 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<IProperty> findAllProperties(Project project, @NotNull ResourceBundle resourceBundle, String key) {
|
||||
List<IProperty> result = new SmartList<IProperty>();
|
||||
List<IProperty> result = new SmartList<>();
|
||||
List<PropertiesFile> propertiesFiles = resourceBundle.getPropertiesFiles();
|
||||
for (PropertiesFile propertiesFile : propertiesFiles) {
|
||||
result.addAll(propertiesFile.findPropertiesByKey(key));
|
||||
@@ -184,7 +185,7 @@ public class PropertiesUtil {
|
||||
}
|
||||
|
||||
public static List<IProperty> findAllProperties(@NotNull ResourceBundle resourceBundle, String key) {
|
||||
List<IProperty> result = new SmartList<IProperty>();
|
||||
List<IProperty> result = new SmartList<>();
|
||||
List<PropertiesFile> 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<String> names = new ArrayList<String>();
|
||||
List<String> 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) {
|
||||
|
||||
Reference in New Issue
Block a user