mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup
This commit is contained in:
@@ -44,11 +44,11 @@ import com.intellij.util.containers.MultiMap;
|
||||
import com.intellij.util.indexing.FileBasedIndex;
|
||||
import com.intellij.util.text.CharArrayUtil;
|
||||
import com.intellij.util.text.StringSearcher;
|
||||
import gnu.trove.THashSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
@@ -239,19 +239,13 @@ public class PsiSearchHelperImpl implements PsiSearchHelper {
|
||||
try {
|
||||
if (myManager.getProject().isDisposed()) throw new ProcessCanceledException();
|
||||
List<PsiFile> psiRoots = file.getViewProvider().getAllFiles();
|
||||
Set<PsiElement> processed = new HashSet<PsiElement>(psiRoots.size() * 2, (float)0.5);
|
||||
Set<PsiElement> processed = new THashSet<PsiElement>(psiRoots.size() * 2, (float)0.5);
|
||||
for (PsiElement psiRoot : psiRoots) {
|
||||
if (progress != null) progress.checkCanceled();
|
||||
assert psiRoot != null : "One of the roots of file " + file + " is null. All roots: " + psiRoots +
|
||||
"; ViewProvider: " + file.getViewProvider() + "; Virtual file: " + file.getViewProvider().getVirtualFile();
|
||||
if (!processed.add(psiRoot)) continue;
|
||||
if (!psiRoot.isValid()) continue;
|
||||
assert psiRoot != null : "One of the roots of file " +
|
||||
file +
|
||||
" is null. All roots: " +
|
||||
Arrays.asList(psiRoots) +
|
||||
"; Viewprovider: " +
|
||||
file.getViewProvider() +
|
||||
"; Virtual file: " +
|
||||
file.getViewProvider().getVirtualFile();
|
||||
if (!psiRootProcessor.process(psiRoot)) {
|
||||
canceled.set(true);
|
||||
return;
|
||||
|
||||
+1
@@ -29,6 +29,7 @@ public class ConfigureFileDefaultEncodingAction extends AnAction {
|
||||
final Project project = e.getData(PlatformDataKeys.PROJECT);
|
||||
final VirtualFile virtualFile = e.getData(PlatformDataKeys.VIRTUAL_FILE);
|
||||
|
||||
assert project != null;
|
||||
final FileEncodingConfigurable configurable = new FileEncodingConfigurable(project);
|
||||
ShowSettingsUtil.getInstance().editConfigurable(project, configurable, new Runnable(){
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
* @author peter
|
||||
*/
|
||||
public class TemplateDataLanguageConfigurable extends LanguagePerFileConfigurable<Language> {
|
||||
public TemplateDataLanguageConfigurable(Project project) {
|
||||
public TemplateDataLanguageConfigurable(@NotNull Project project) {
|
||||
super(project, Language.class, TemplateDataLanguageMappings.getInstance(project),
|
||||
LangBundle.message("dialog.template.data.language.caption", ApplicationNamesInfo.getInstance().getFullProductName()),
|
||||
LangBundle.message("template.data.language.configurable.tree.table.title"),
|
||||
|
||||
+3
-1
@@ -20,6 +20,7 @@ import com.intellij.openapi.components.ProjectComponent;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.Map;
|
||||
@@ -32,8 +33,9 @@ public abstract class EncodingProjectManager extends EncodingManager implements
|
||||
return project.getComponent(EncodingProjectManager.class);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public abstract Map<VirtualFile, Charset> getAllMappings();
|
||||
|
||||
public abstract void setMapping(Map<VirtualFile, Charset> result);
|
||||
public abstract void setMapping(@NotNull Map<VirtualFile, Charset> result);
|
||||
|
||||
}
|
||||
|
||||
@@ -38,28 +38,32 @@ public class PropertiesFileType extends LanguageFileType {
|
||||
super(PropertiesLanguage.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
return "Properties";
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDescription() {
|
||||
return PropertiesBundle.message("properties.files.file.type.description");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDefaultExtension() {
|
||||
return DEFAULT_EXTENSION;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getIcon() {
|
||||
return AllIcons.FileTypes.Properties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCharset(@NotNull VirtualFile file, final byte[] content) {
|
||||
Charset charset = EncodingManager.getInstance().getDefaultCharsetForPropertiesFiles(file);
|
||||
String defaultCharsetName = charset == null ? CharsetToolkit.getDefaultSystemCharset().name() : charset.name();
|
||||
return defaultCharsetName;
|
||||
return charset == null ? CharsetToolkit.getDefaultSystemCharset().name() : charset.name();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user