mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup: Condition.TRUE
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -27,6 +27,7 @@ import com.intellij.openapi.fileEditor.TextEditor;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.ui.popup.JBPopupFactory;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.Conditions;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.search.searches.ClassInheritorsSearch;
|
||||
import com.intellij.psi.util.PsiClassUtil;
|
||||
@@ -59,7 +60,7 @@ public class InheritorChooser {
|
||||
final Runnable performRunnable,
|
||||
final PsiMethod psiMethod,
|
||||
final PsiClass containingClass) {
|
||||
return runMethodInAbstractClass(context, performRunnable, psiMethod, containingClass, Condition.TRUE);
|
||||
return runMethodInAbstractClass(context, performRunnable, psiMethod, containingClass, Conditions.<PsiClass>alwaysTrue());
|
||||
}
|
||||
|
||||
public boolean runMethodInAbstractClass(final ConfigurationContext context,
|
||||
|
||||
+2
-2
@@ -19,6 +19,7 @@ import com.intellij.codeInspection.dataFlow.DfaPsiUtil;
|
||||
import com.intellij.codeInspection.dataFlow.Nullness;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.Conditions;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.JavaConstantExpressionEvaluator;
|
||||
@@ -50,8 +51,7 @@ public class DfaExpressionFactory {
|
||||
}
|
||||
catch (Exception e) {
|
||||
LOG.error(e);
|
||||
//noinspection unchecked
|
||||
return Condition.FALSE;
|
||||
return Conditions.alwaysFalse();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -544,7 +544,7 @@ public class JavaCompletionUtil {
|
||||
return JavaClassNameCompletionContributor.createClassLookupItems((PsiClass)completion,
|
||||
JavaClassNameCompletionContributor.AFTER_NEW.accepts(reference),
|
||||
JavaClassNameInsertHandler.JAVA_CLASS_INSERT_HANDLER,
|
||||
Condition.TRUE);
|
||||
Conditions.<PsiClass>alwaysTrue());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+7
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -28,7 +28,7 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.*;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.Conditions;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.patterns.PsiJavaPatterns;
|
||||
import com.intellij.profile.codeInspection.InspectionProjectProfileManager;
|
||||
@@ -43,7 +43,10 @@ import com.intellij.psi.javadoc.*;
|
||||
import com.intellij.psi.util.InheritanceUtil;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.psi.util.TypeConversionUtil;
|
||||
import com.intellij.util.*;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.ProcessingContext;
|
||||
import com.intellij.util.Processor;
|
||||
import com.intellij.util.SystemProperties;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.text.CharArrayUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -81,7 +84,7 @@ public class JavaDocCompletionContributor extends CompletionContributor {
|
||||
if (ref instanceof PsiJavaReference) {
|
||||
result.stopHere();
|
||||
|
||||
final JavaCompletionProcessor processor = new JavaCompletionProcessor(position, TrueFilter.INSTANCE, JavaCompletionProcessor.Options.CHECK_NOTHING, Condition.TRUE);
|
||||
final JavaCompletionProcessor processor = new JavaCompletionProcessor(position, TrueFilter.INSTANCE, JavaCompletionProcessor.Options.CHECK_NOTHING, Conditions.<String>alwaysTrue());
|
||||
((PsiJavaReference) ref).processVariants(processor);
|
||||
|
||||
for (final CompletionElement _item : processor.getResults()) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -20,6 +20,7 @@ import com.intellij.codeInsight.completion.scope.JavaCompletionProcessor;
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.codeInsight.lookup.LookupElementWeigher;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.Conditions;
|
||||
import com.intellij.patterns.ElementPattern;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.filters.getters.MembersGetter;
|
||||
@@ -127,8 +128,7 @@ public class PreferByKindWeigher extends LookupElementWeigher {
|
||||
};
|
||||
}
|
||||
|
||||
//noinspection unchecked
|
||||
return Condition.FALSE;
|
||||
return Conditions.alwaysFalse();
|
||||
}
|
||||
|
||||
enum MyResult {
|
||||
|
||||
+3
-2
@@ -19,6 +19,7 @@ import com.intellij.codeInsight.ExceptionUtil;
|
||||
import com.intellij.featureStatistics.FeatureUsageTracker;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.Conditions;
|
||||
import com.intellij.psi.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -57,7 +58,7 @@ public class HighlightExceptionsHandlerFactory extends HighlightUsagesHandlerFac
|
||||
final PsiCodeBlock tryBlock = tryStatement.getTryBlock();
|
||||
if (tryBlock == null) return null;
|
||||
final Collection<PsiClassType> psiClassTypes = ExceptionUtil.collectUnhandledExceptions(tryBlock, tryBlock);
|
||||
return new HighlightExceptionsHandler(editor, file, target, psiClassTypes.toArray(new PsiClassType[psiClassTypes.size()]), tryBlock, Condition.TRUE);
|
||||
return new HighlightExceptionsHandler(editor, file, target, psiClassTypes.toArray(new PsiClassType[psiClassTypes.size()]), tryBlock, Conditions.<PsiType>alwaysTrue());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -112,6 +113,6 @@ public class HighlightExceptionsHandlerFactory extends HighlightUsagesHandlerFac
|
||||
|
||||
final Collection<PsiClassType> psiClassTypes = ExceptionUtil.collectUnhandledExceptions(method.getBody(), method.getBody());
|
||||
|
||||
return new HighlightExceptionsHandler(editor, file, target, psiClassTypes.toArray(new PsiClassType[psiClassTypes.size()]), method.getBody(), Condition.TRUE);
|
||||
return new HighlightExceptionsHandler(editor, file, target, psiClassTypes.toArray(new PsiClassType[psiClassTypes.size()]), method.getBody(), Conditions.<PsiType>alwaysTrue());
|
||||
}
|
||||
}
|
||||
|
||||
+23
-16
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -24,11 +24,11 @@ import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.fileEditor.FileEditorManager;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleManager;
|
||||
import com.intellij.openapi.module.ModuleUtil;
|
||||
import com.intellij.openapi.roots.impl.ModifiableModelCommitter;
|
||||
import com.intellij.openapi.module.ModuleUtilCore;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.*;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.openapi.roots.impl.ModifiableModelCommitter;
|
||||
import com.intellij.openapi.vfs.VfsUtilCore;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.wm.ToolWindow;
|
||||
import com.intellij.openapi.wm.ToolWindowId;
|
||||
@@ -37,6 +37,7 @@ import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.PackagePrefixElementFinder;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.util.PsiModificationTracker;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jps.model.java.JavaModuleSourceRootTypes;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -46,22 +47,25 @@ import java.util.List;
|
||||
* @author yole
|
||||
*/
|
||||
public class PsiPackageImplementationHelperImpl extends PsiPackageImplementationHelper {
|
||||
@NotNull
|
||||
@Override
|
||||
public GlobalSearchScope adjustAllScope(PsiPackage psiPackage, GlobalSearchScope globalSearchScope) {
|
||||
public GlobalSearchScope adjustAllScope(@NotNull PsiPackage psiPackage, @NotNull GlobalSearchScope globalSearchScope) {
|
||||
return NonClasspathClassFinder.addNonClasspathScope(psiPackage.getProject(), globalSearchScope);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public VirtualFile[] occursInPackagePrefixes(PsiPackage psiPackage) {
|
||||
public VirtualFile[] occursInPackagePrefixes(@NotNull PsiPackage psiPackage) {
|
||||
List<VirtualFile> result = new ArrayList<VirtualFile>();
|
||||
final Module[] modules = ModuleManager.getInstance(psiPackage.getProject()).getModules();
|
||||
|
||||
String qualifiedName = psiPackage.getQualifiedName();
|
||||
for (final Module module : modules) {
|
||||
for (final ContentEntry contentEntry : ModuleRootManager.getInstance(module).getContentEntries()) {
|
||||
final List<SourceFolder> sourceFolders = contentEntry.getSourceFolders(JavaModuleSourceRootTypes.SOURCES);
|
||||
for (final SourceFolder sourceFolder : sourceFolders) {
|
||||
final String packagePrefix = sourceFolder.getPackagePrefix();
|
||||
if (packagePrefix.startsWith(psiPackage.getQualifiedName())) {
|
||||
if (packagePrefix.startsWith(qualifiedName)) {
|
||||
final VirtualFile file = sourceFolder.getFile();
|
||||
if (file != null) {
|
||||
result.add(file);
|
||||
@@ -71,11 +75,11 @@ public class PsiPackageImplementationHelperImpl extends PsiPackageImplementation
|
||||
}
|
||||
}
|
||||
|
||||
return VfsUtil.toVirtualFileArray(result);
|
||||
return VfsUtilCore.toVirtualFileArray(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleQualifiedNameChange(final PsiPackage psiPackage, final String newQualifiedName) {
|
||||
public void handleQualifiedNameChange(@NotNull final PsiPackage psiPackage, @NotNull final String newQualifiedName) {
|
||||
ApplicationManager.getApplication().assertWriteAccessAllowed();
|
||||
final String oldQualifedName = psiPackage.getQualifiedName();
|
||||
final boolean anyChanged = changePackagePrefixes(psiPackage, oldQualifedName, newQualifiedName);
|
||||
@@ -94,7 +98,7 @@ public class PsiPackageImplementationHelperImpl extends PsiPackageImplementation
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean changePackagePrefixes(PsiPackage psiPackage, final String oldQualifiedName, final String newQualifiedName) {
|
||||
private static boolean changePackagePrefixes(@NotNull PsiPackage psiPackage, @NotNull String oldQualifiedName, @NotNull String newQualifiedName) {
|
||||
final Module[] modules = ModuleManager.getInstance(psiPackage.getProject()).getModules();
|
||||
List<ModifiableRootModel> modelsToCommit = new ArrayList<ModifiableRootModel>();
|
||||
for (final Module module : modules) {
|
||||
@@ -128,7 +132,7 @@ public class PsiPackageImplementationHelperImpl extends PsiPackageImplementation
|
||||
}
|
||||
|
||||
@Override
|
||||
public void navigate(final PsiPackage psiPackage, final boolean requestFocus) {
|
||||
public void navigate(@NotNull final PsiPackage psiPackage, final boolean requestFocus) {
|
||||
final Project project = psiPackage.getProject();
|
||||
ToolWindow window = ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.PROJECT_VIEW);
|
||||
window.activate(null);
|
||||
@@ -143,7 +147,8 @@ public class PsiPackageImplementationHelperImpl extends PsiPackageImplementation
|
||||
});
|
||||
}
|
||||
|
||||
private static PsiDirectory[] suggestMostAppropriateDirectories(PsiPackage psiPackage) {
|
||||
@NotNull
|
||||
private static PsiDirectory[] suggestMostAppropriateDirectories(@NotNull PsiPackage psiPackage) {
|
||||
final Project project = psiPackage.getProject();
|
||||
PsiDirectory[] directories = null;
|
||||
final Editor editor = FileEditorManager.getInstance(project).getSelectedTextEditor();
|
||||
@@ -151,10 +156,11 @@ public class PsiPackageImplementationHelperImpl extends PsiPackageImplementation
|
||||
final Document document = editor.getDocument();
|
||||
final PsiFile psiFile = PsiDocumentManager.getInstance(project).getPsiFile(document);
|
||||
if (psiFile != null) {
|
||||
final Module module = ModuleUtil.findModuleForPsiElement(psiFile);
|
||||
final Module module = ModuleUtilCore.findModuleForPsiElement(psiFile);
|
||||
if (module != null) {
|
||||
directories = psiPackage.getDirectories(GlobalSearchScope.moduleWithDependenciesScope(module));
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
directories = psiPackage.getDirectories(GlobalSearchScope.notScope(GlobalSearchScope.projectScope(project)));
|
||||
}
|
||||
}
|
||||
@@ -167,12 +173,13 @@ public class PsiPackageImplementationHelperImpl extends PsiPackageImplementation
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean packagePrefixExists(PsiPackage psiPackage) {
|
||||
public boolean packagePrefixExists(@NotNull PsiPackage psiPackage) {
|
||||
return PackagePrefixElementFinder.getInstance(psiPackage.getProject()).packagePrefixExists(psiPackage.getQualifiedName());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Object[] getDirectoryCachedValueDependencies(PsiPackage psiPackage) {
|
||||
public Object[] getDirectoryCachedValueDependencies(@NotNull PsiPackage psiPackage) {
|
||||
return new Object[] { PsiModificationTracker.OUT_OF_CODE_BLOCK_MODIFICATION_COUNT, ProjectRootManager.getInstance(psiPackage.getProject()) };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,10 +30,7 @@ import com.intellij.openapi.editor.markup.RangeHighlighter;
|
||||
import com.intellij.openapi.editor.markup.TextAttributes;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.ProjectRootManager;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.openapi.util.*;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
@@ -1045,13 +1042,13 @@ public class RefactoringUtil {
|
||||
}
|
||||
|
||||
public static void fixJavadocsForParams(PsiMethod method, Set<PsiParameter> newParameters) throws IncorrectOperationException {
|
||||
fixJavadocsForParams(method, newParameters, Condition.FALSE);
|
||||
fixJavadocsForParams(method, newParameters, Conditions.<Pair<PsiParameter,String>>alwaysFalse());
|
||||
}
|
||||
|
||||
public static void fixJavadocsForParams(PsiMethod method,
|
||||
Set<PsiParameter> newParameters,
|
||||
Condition<Pair<PsiParameter, String>> eqCondition) throws IncorrectOperationException {
|
||||
fixJavadocsForParams(method, newParameters, eqCondition, Condition.TRUE);
|
||||
fixJavadocsForParams(method, newParameters, eqCondition, Conditions.<String>alwaysTrue());
|
||||
}
|
||||
|
||||
public static void fixJavadocsForParams(PsiMethod method,
|
||||
@@ -1245,7 +1242,7 @@ public class RefactoringUtil {
|
||||
@Nullable
|
||||
public static PsiTypeParameterList createTypeParameterListWithUsedTypeParameters(@Nullable final PsiTypeParameterList fromList,
|
||||
@NotNull final PsiElement... elements) {
|
||||
return createTypeParameterListWithUsedTypeParameters(fromList, Condition.TRUE, elements);
|
||||
return createTypeParameterListWithUsedTypeParameters(fromList, Conditions.<PsiTypeParameter>alwaysTrue(), elements);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -1290,7 +1287,7 @@ public class RefactoringUtil {
|
||||
}
|
||||
|
||||
public static void collectTypeParameters(final Set<PsiTypeParameter> used, final PsiElement element) {
|
||||
collectTypeParameters(used, element, Condition.TRUE);
|
||||
collectTypeParameters(used, element, Conditions.<PsiTypeParameter>alwaysTrue());
|
||||
}
|
||||
public static void collectTypeParameters(final Set<PsiTypeParameter> used, final PsiElement element,
|
||||
final Condition<PsiTypeParameter> filter) {
|
||||
|
||||
+2
-5
@@ -21,10 +21,7 @@ import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.progress.ProgressIndicatorProvider;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.util.*;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.search.PsiSearchScopeUtil;
|
||||
@@ -106,7 +103,7 @@ public class ClassInheritorsSearch extends ExtensibleQueryFactory<PsiClass, Clas
|
||||
private final InheritanceChecker myInheritanceChecker;
|
||||
|
||||
public SearchParameters(@NotNull final PsiClass aClass, @NotNull SearchScope scope, final boolean checkDeep, final boolean checkInheritance, boolean includeAnonymous) {
|
||||
this(aClass, scope, checkDeep, checkInheritance, includeAnonymous, Condition.TRUE);
|
||||
this(aClass, scope, checkDeep, checkInheritance, includeAnonymous, Conditions.<String>alwaysTrue());
|
||||
}
|
||||
|
||||
public SearchParameters(@NotNull final PsiClass aClass, @NotNull SearchScope scope, final boolean checkDeep, final boolean checkInheritance,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -111,7 +111,7 @@ public interface PsiPackage extends PsiCheckedRenameElement, NavigationItem, Psi
|
||||
@NonNls
|
||||
String getName();
|
||||
|
||||
boolean containsClassNamed(String name);
|
||||
boolean containsClassNamed(@NotNull String name);
|
||||
|
||||
@NotNull
|
||||
PsiClass[] findClassByShortName(@NotNull String name, @NotNull GlobalSearchScope scope);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -33,6 +33,7 @@ public class ClassUtil {
|
||||
return null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String extractClassName(@NotNull String fqName) {
|
||||
int i = fqName.lastIndexOf('.');
|
||||
return i == -1 ? fqName : fqName.substring(i + 1);
|
||||
@@ -58,7 +59,7 @@ public class ClassUtil {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void formatClassName(@NotNull final PsiClass aClass, final StringBuilder buf) {
|
||||
public static void formatClassName(@NotNull final PsiClass aClass, @NotNull StringBuilder buf) {
|
||||
final String qName = aClass.getQualifiedName();
|
||||
if (qName != null) {
|
||||
buf.append(qName);
|
||||
@@ -78,7 +79,7 @@ public class ClassUtil {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static PsiClass getContainerClass(final PsiClass aClass) {
|
||||
private static PsiClass getContainerClass(@NotNull PsiClass aClass) {
|
||||
PsiElement parent = aClass.getContext();
|
||||
while (parent != null && !(parent instanceof PsiClass)) {
|
||||
parent = parent.getContext();
|
||||
@@ -113,11 +114,11 @@ public class ClassUtil {
|
||||
return result[0];
|
||||
}
|
||||
|
||||
public static PsiClass findNonQualifiedClassByIndex(final String indexName, @NotNull final PsiClass containingClass) {
|
||||
public static PsiClass findNonQualifiedClassByIndex(@NotNull String indexName, @NotNull final PsiClass containingClass) {
|
||||
return findNonQualifiedClassByIndex(indexName, containingClass, false);
|
||||
}
|
||||
|
||||
public static PsiClass findNonQualifiedClassByIndex(final String indexName, @NotNull final PsiClass containingClass,
|
||||
public static PsiClass findNonQualifiedClassByIndex(@NotNull String indexName, @NotNull final PsiClass containingClass,
|
||||
final boolean jvmCompatible) {
|
||||
String prefix = getDigitPrefix(indexName);
|
||||
final int idx = !prefix.isEmpty() ? Integer.parseInt(prefix) : -1;
|
||||
@@ -167,6 +168,7 @@ public class ClassUtil {
|
||||
return result[0];
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static String getDigitPrefix(@NotNull String indexName) {
|
||||
int i;
|
||||
for (i = 0; i < indexName.length(); i++) {
|
||||
@@ -186,24 +188,24 @@ public class ClassUtil {
|
||||
* @return found psiClass
|
||||
*/
|
||||
@Nullable
|
||||
public static PsiClass findPsiClass(final PsiManager psiManager, String externalName){
|
||||
public static PsiClass findPsiClass(@NotNull PsiManager psiManager, @NotNull String externalName){
|
||||
return findPsiClass(psiManager, externalName, null, false);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static PsiClass findPsiClass(final PsiManager psiManager,
|
||||
String externalName,
|
||||
public static PsiClass findPsiClass(@NotNull PsiManager psiManager,
|
||||
@NotNull String externalName,
|
||||
PsiClass psiClass,
|
||||
boolean jvmCompatible) {
|
||||
return findPsiClass(psiManager, externalName, psiClass, jvmCompatible, GlobalSearchScope.allScope(psiManager.getProject()));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static PsiClass findPsiClass(final PsiManager psiManager,
|
||||
String externalName,
|
||||
public static PsiClass findPsiClass(@NotNull PsiManager psiManager,
|
||||
@NotNull String externalName,
|
||||
@Nullable PsiClass psiClass,
|
||||
boolean jvmCompatible,
|
||||
final GlobalSearchScope scope) {
|
||||
@NotNull GlobalSearchScope scope) {
|
||||
for (int pos = 0; pos < externalName.length(); pos++) {
|
||||
if (externalName.charAt(pos) == '$') {
|
||||
PsiClass parentClass = psiClass;
|
||||
@@ -220,8 +222,8 @@ public class ClassUtil {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static PsiClass findSubclass(final PsiManager psiManager,
|
||||
final String externalName,
|
||||
private static PsiClass findSubclass(@NotNull PsiManager psiManager,
|
||||
@NotNull String externalName,
|
||||
final PsiClass psiClass,
|
||||
final boolean jvmCompatible) {
|
||||
for (int pos = 0; pos < externalName.length(); pos++) {
|
||||
@@ -251,7 +253,7 @@ public class ClassUtil {
|
||||
|
||||
|
||||
@Nullable
|
||||
public static PsiClass findPsiClassByJVMName(final PsiManager manager, final String jvmClassName) {
|
||||
public static PsiClass findPsiClassByJVMName(@NotNull PsiManager manager, @NotNull String jvmClassName) {
|
||||
return findPsiClass(manager, jvmClassName.replace('/', '.'), null, true);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -20,6 +20,7 @@ import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiPackage;
|
||||
import com.intellij.psi.impl.file.PsiPackageImplementationHelper;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
@@ -27,31 +28,34 @@ import com.intellij.psi.search.GlobalSearchScope;
|
||||
public class CorePsiPackageImplementationHelper extends PsiPackageImplementationHelper {
|
||||
private static final ModificationTracker[] EMPTY_DEPENDENCY = {ModificationTracker.NEVER_CHANGED};
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public GlobalSearchScope adjustAllScope(PsiPackage psiPackage, GlobalSearchScope globalSearchScope) {
|
||||
public GlobalSearchScope adjustAllScope(@NotNull PsiPackage psiPackage, @NotNull GlobalSearchScope globalSearchScope) {
|
||||
return globalSearchScope;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public VirtualFile[] occursInPackagePrefixes(PsiPackage psiPackage) {
|
||||
public VirtualFile[] occursInPackagePrefixes(@NotNull PsiPackage psiPackage) {
|
||||
return VirtualFile.EMPTY_ARRAY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleQualifiedNameChange(PsiPackage psiPackage, String newQualifiedName) {
|
||||
public void handleQualifiedNameChange(@NotNull PsiPackage psiPackage, @NotNull String newQualifiedName) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void navigate(PsiPackage psiPackage, boolean requestFocus) {
|
||||
public void navigate(@NotNull PsiPackage psiPackage, boolean requestFocus) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean packagePrefixExists(PsiPackage psiPackage) {
|
||||
public boolean packagePrefixExists(@NotNull PsiPackage psiPackage) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Object[] getDirectoryCachedValueDependencies(PsiPackage cachedValueProvider) {
|
||||
public Object[] getDirectoryCachedValueDependencies(@NotNull PsiPackage cachedValueProvider) {
|
||||
return EMPTY_DEPENDENCY;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@ public abstract class NonClasspathClassFinder extends PsiElementFinder {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static GlobalSearchScope addNonClasspathScope(Project project, GlobalSearchScope base) {
|
||||
public static GlobalSearchScope addNonClasspathScope(@NotNull Project project, @NotNull GlobalSearchScope base) {
|
||||
GlobalSearchScope scope = base;
|
||||
for (PsiElementFinder finder : Extensions.getExtensions(EP_NAME, project)) {
|
||||
if (finder instanceof NonClasspathClassFinder) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -23,6 +23,7 @@ import com.intellij.navigation.ItemPresentationProviders;
|
||||
import com.intellij.openapi.project.DumbService;
|
||||
import com.intellij.openapi.ui.Queryable;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.Conditions;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.JavaPsiFacadeImpl;
|
||||
@@ -46,7 +47,6 @@ import org.jetbrains.annotations.Nullable;
|
||||
import java.util.*;
|
||||
|
||||
public class PsiPackageImpl extends PsiPackageBase implements PsiPackage, Queryable {
|
||||
public static boolean DEBUG = false;
|
||||
private volatile CachedValue<PsiModifierList> myAnnotationList;
|
||||
private volatile CachedValue<Collection<PsiDirectory>> myDirectories;
|
||||
private volatile CachedValue<Collection<PsiDirectory>> myDirectoriesWithLibSources;
|
||||
@@ -72,6 +72,7 @@ public class PsiPackageImpl extends PsiPackageBase implements PsiPackage, Querya
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private CachedValue<Collection<PsiDirectory>> createCachedDirectories(final boolean includeLibrarySources) {
|
||||
return CachedValuesManager.getManager(myManager.getProject()).createCachedValue(new CachedValueProvider<Collection<PsiDirectory>>() {
|
||||
@Override
|
||||
@@ -131,6 +132,7 @@ public class PsiPackageImpl extends PsiPackageBase implements PsiPackage, Querya
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PsiPackage:" + getQualifiedName();
|
||||
}
|
||||
@@ -141,6 +143,7 @@ public class PsiPackageImpl extends PsiPackageBase implements PsiPackage, Querya
|
||||
return getClasses(allScope());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected GlobalSearchScope allScope() {
|
||||
return PsiPackageImplementationHelper.getInstance().adjustAllScope(this, GlobalSearchScope.allScope(getProject()));
|
||||
}
|
||||
@@ -177,7 +180,7 @@ public class PsiPackageImpl extends PsiPackageBase implements PsiPackage, Querya
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private PsiClass[] getCachedClassesByName(String name) {
|
||||
private PsiClass[] getCachedClassesByName(@NotNull String name) {
|
||||
if (DumbService.getInstance(getProject()).isDumb()) {
|
||||
return getCachedClassInDumbMode(name);
|
||||
}
|
||||
@@ -215,7 +218,7 @@ public class PsiPackageImpl extends PsiPackageBase implements PsiPackage, Querya
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsClassNamed(String name) {
|
||||
public boolean containsClassNamed(@NotNull String name) {
|
||||
return getCachedClassesByName(name).length > 0;
|
||||
}
|
||||
|
||||
@@ -247,7 +250,7 @@ public class PsiPackageImpl extends PsiPackageBase implements PsiPackage, Querya
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private PsiPackage findSubPackageByName(String name) {
|
||||
private PsiPackage findSubPackageByName(@NotNull String name) {
|
||||
final String qName = getQualifiedName();
|
||||
final String subpackageQName = qName.isEmpty() ? name : qName + "." + name;
|
||||
return getFacade().findPackage(subpackageQName);
|
||||
@@ -270,11 +273,11 @@ public class PsiPackageImpl extends PsiPackageBase implements PsiPackage, Querya
|
||||
if (nameHint != null) {
|
||||
final String shortName = nameHint.getName(state);
|
||||
final PsiClass[] classes = findClassByShortName(shortName, scope);
|
||||
if (!processClasses(processor, state, classes, Condition.TRUE)) return false;
|
||||
if (!processClasses(processor, state, classes, Conditions.<String>alwaysTrue())) return false;
|
||||
}
|
||||
else {
|
||||
PsiClass[] classes = getClasses(scope);
|
||||
if (!processClasses(processor, state, classes, nameCondition != null ? nameCondition : Condition.TRUE)) return false;
|
||||
if (!processClasses(processor, state, classes, nameCondition != null ? nameCondition : Conditions.<String>alwaysTrue())) return false;
|
||||
}
|
||||
}
|
||||
if (classHint == null || classHint.shouldProcess(ElementClassHint.DeclarationKind.PACKAGE)) {
|
||||
@@ -302,7 +305,9 @@ public class PsiPackageImpl extends PsiPackageBase implements PsiPackage, Querya
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean processClasses(PsiScopeProcessor processor, ResolveState state, PsiClass[] classes,
|
||||
private static boolean processClasses(@NotNull PsiScopeProcessor processor,
|
||||
@NotNull ResolveState state,
|
||||
@NotNull PsiClass[] classes,
|
||||
@NotNull Condition<String> nameCondition) {
|
||||
for (PsiClass aClass : classes) {
|
||||
String name = aClass.getName();
|
||||
|
||||
+11
-7
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -19,22 +19,26 @@ import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiPackage;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
*/
|
||||
public abstract class PsiPackageImplementationHelper {
|
||||
public abstract GlobalSearchScope adjustAllScope(PsiPackage psiPackage, GlobalSearchScope globalSearchScope);
|
||||
@NotNull
|
||||
public abstract GlobalSearchScope adjustAllScope(@NotNull PsiPackage psiPackage, @NotNull GlobalSearchScope globalSearchScope);
|
||||
|
||||
public abstract VirtualFile[] occursInPackagePrefixes(PsiPackage psiPackage);
|
||||
@NotNull
|
||||
public abstract VirtualFile[] occursInPackagePrefixes(@NotNull PsiPackage psiPackage);
|
||||
|
||||
public abstract void handleQualifiedNameChange(PsiPackage psiPackage, String newQualifiedName);
|
||||
public abstract void handleQualifiedNameChange(@NotNull PsiPackage psiPackage, @NotNull String newQualifiedName);
|
||||
|
||||
public abstract void navigate(PsiPackage psiPackage, boolean requestFocus);
|
||||
public abstract void navigate(@NotNull PsiPackage psiPackage, boolean requestFocus);
|
||||
|
||||
public abstract boolean packagePrefixExists(PsiPackage psiPackage);
|
||||
public abstract boolean packagePrefixExists(@NotNull PsiPackage psiPackage);
|
||||
|
||||
public abstract Object[] getDirectoryCachedValueDependencies(PsiPackage cachedValueProvider);
|
||||
@NotNull
|
||||
public abstract Object[] getDirectoryCachedValueDependencies(@NotNull PsiPackage cachedValueProvider);
|
||||
|
||||
public static PsiPackageImplementationHelper getInstance() {
|
||||
return ServiceManager.getService(PsiPackageImplementationHelper.class);
|
||||
|
||||
@@ -33,6 +33,7 @@ import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.DumbService;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.Conditions;
|
||||
import com.intellij.openapi.util.ProperTextRange;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.*;
|
||||
@@ -113,7 +114,7 @@ public class InspectionEngine {
|
||||
TextRange range = file.getTextRange();
|
||||
final LocalInspectionToolSession session = new LocalInspectionToolSession(file, range.getStartOffset(), range.getEndOffset());
|
||||
Divider.divideInsideAndOutside(file, range.getStartOffset(), range.getEndOffset(), range, elements, new ArrayList<ProperTextRange>(),
|
||||
Collections.<PsiElement>emptyList(), Collections.<ProperTextRange>emptyList(), true, Condition.TRUE);
|
||||
Collections.<PsiElement>emptyList(), Collections.<ProperTextRange>emptyList(), true, Conditions.<PsiFile>alwaysTrue());
|
||||
|
||||
MultiMap<LocalInspectionToolWrapper, String> toolToLanguages = getToolsForElements(toolWrappers, DumbService.isDumb(file.getProject()), elements, Collections.<PsiElement>emptyList());
|
||||
List<Map.Entry<LocalInspectionToolWrapper, Collection<String>>> entries = new ArrayList<Map.Entry<LocalInspectionToolWrapper, Collection<String>>>(toolToLanguages.entrySet());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -42,9 +42,12 @@ public abstract class CachedValuesManager {
|
||||
* @param trackValue if value tracking required. T should be trackable in this case.
|
||||
* @return new CachedValue instance.
|
||||
*/
|
||||
@NotNull
|
||||
public abstract <T> CachedValue<T> createCachedValue(@NotNull CachedValueProvider<T> provider, boolean trackValue);
|
||||
@NotNull
|
||||
public abstract <T,P> ParameterizedCachedValue<T,P> createParameterizedCachedValue(@NotNull ParameterizedCachedValueProvider<T,P> provider, boolean trackValue);
|
||||
|
||||
@NotNull
|
||||
public <T> CachedValue<T> createCachedValue(@NotNull CachedValueProvider<T> provider) {
|
||||
return createCachedValue(provider, true);
|
||||
}
|
||||
@@ -54,7 +57,6 @@ public abstract class CachedValuesManager {
|
||||
@NotNull ParameterizedCachedValueProvider<T, P> provider,
|
||||
boolean trackValue,
|
||||
P parameter) {
|
||||
|
||||
ParameterizedCachedValue<T,P> value;
|
||||
|
||||
if (dataHolder instanceof UserDataHolderEx) {
|
||||
@@ -100,6 +102,7 @@ public abstract class CachedValuesManager {
|
||||
}
|
||||
|
||||
private final ConcurrentMap<String, Key<CachedValue>> keyForProvider = new ConcurrentHashMap<String, Key<CachedValue>>();
|
||||
@NotNull
|
||||
public <T> Key<CachedValue<T>> getKeyForClass(@NotNull Class<?> providerClass) {
|
||||
String name = providerClass.getName();
|
||||
assert name != null : providerClass + " doesn't have a name; can't be used for cache value provider";
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.intellij.openapi.components.BaseComponent;
|
||||
import com.intellij.openapi.components.ComponentManager;
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.Conditions;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.UserDataHolderBase;
|
||||
import com.intellij.util.containers.ConcurrentHashSet;
|
||||
@@ -137,6 +138,6 @@ public class MockComponentManager extends UserDataHolderBase implements Componen
|
||||
@NotNull
|
||||
@Override
|
||||
public Condition getDisposed() {
|
||||
return Condition.FALSE;
|
||||
return Conditions.alwaysFalse();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -36,11 +36,13 @@ public class CachedValuesManagerImpl extends CachedValuesManager {
|
||||
myFactory = factory == null ? new DefaultCachedValuesFactory(project) : factory;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public <T> CachedValue<T> createCachedValue(@NotNull CachedValueProvider<T> provider, boolean trackValue) {
|
||||
return myFactory.createCachedValue(provider, trackValue);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public <T,P> ParameterizedCachedValue<T,P> createParameterizedCachedValue(@NotNull ParameterizedCachedValueProvider<T,P> provider, boolean trackValue) {
|
||||
return myFactory.createParameterizedCachedValue(provider, trackValue);
|
||||
|
||||
+2
-1
@@ -16,6 +16,7 @@
|
||||
package com.intellij.codeInsight.template.postfix.templates;
|
||||
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.Conditions;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -28,7 +29,7 @@ public abstract class ElseExpressionPostfixTemplateBase extends SurroundPostfixT
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
protected ElseExpressionPostfixTemplateBase(@NotNull PostfixTemplatePsiInfo psiInfo) {
|
||||
super("else", "if (!expr)", psiInfo, Condition.TRUE);
|
||||
super("else", "if (!expr)", psiInfo, Conditions.<PsiElement>alwaysTrue());
|
||||
}
|
||||
|
||||
|
||||
|
||||
+2
-1
@@ -17,6 +17,7 @@ package com.intellij.codeInsight.template.postfix.templates;
|
||||
|
||||
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.Conditions;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -29,6 +30,6 @@ public abstract class IfPostfixTemplateBase extends SurroundPostfixTemplateBase
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
protected IfPostfixTemplateBase(@NotNull PostfixTemplatePsiInfo psiInfo) {
|
||||
super("if", "if (expr)", psiInfo, Condition.TRUE);
|
||||
super("if", "if (expr)", psiInfo, Conditions.<PsiElement>alwaysTrue());
|
||||
}
|
||||
}
|
||||
|
||||
+3
-4
@@ -32,6 +32,7 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.Conditions;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
@@ -266,15 +267,13 @@ public class PostfixLiveTemplate extends CustomLiveTemplateBase {
|
||||
PsiFile copyFile = copyFile(file, fileContentWithoutKey);
|
||||
Document copyDocument = copyFile.getViewProvider().getDocument();
|
||||
if (copyDocument == null) {
|
||||
//noinspection unchecked
|
||||
return Condition.FALSE;
|
||||
return Conditions.alwaysFalse();
|
||||
}
|
||||
|
||||
copyFile = provider.preCheck(copyFile, editor, newOffset);
|
||||
copyDocument = copyFile.getViewProvider().getDocument();
|
||||
if (copyDocument == null) {
|
||||
//noinspection unchecked
|
||||
return Condition.FALSE;
|
||||
return Conditions.alwaysFalse();
|
||||
}
|
||||
|
||||
final PsiElement context = CustomTemplateCallback.getContext(copyFile, positiveOffset(newOffset));
|
||||
|
||||
+2
-1
@@ -17,6 +17,7 @@ package com.intellij.codeInsight.template.postfix.templates;
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.Conditions;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -28,7 +29,7 @@ public abstract class StatementWrapPostfixTemplate extends PostfixTemplateWithEx
|
||||
protected StatementWrapPostfixTemplate(@NotNull String name,
|
||||
@NotNull String descr,
|
||||
@NotNull PostfixTemplatePsiInfo psiInfo) {
|
||||
super(name, descr, psiInfo, Condition.TRUE);
|
||||
super(name, descr, psiInfo, Conditions.<PsiElement>alwaysTrue());
|
||||
}
|
||||
|
||||
protected StatementWrapPostfixTemplate(@NotNull String name,
|
||||
|
||||
+2
-1
@@ -18,6 +18,7 @@ package com.intellij.codeInsight.template.postfix.templates;
|
||||
import com.intellij.lang.surroundWith.Surrounder;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.Conditions;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -35,7 +36,7 @@ public abstract class SurroundPostfixTemplateBase extends StatementWrapPostfixTe
|
||||
protected SurroundPostfixTemplateBase(@NotNull String name,
|
||||
@NotNull String descr,
|
||||
@NotNull PostfixTemplatePsiInfo psiInfo) {
|
||||
super(name, descr, psiInfo, Condition.TRUE);
|
||||
super(name, descr, psiInfo, Conditions.<PsiElement>alwaysTrue());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -28,7 +28,7 @@ import com.intellij.openapi.actionSystem.impl.SimpleDataContext;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.ui.popup.JBPopupFactory;
|
||||
import com.intellij.openapi.ui.popup.ListPopup;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.Conditions;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
@@ -300,7 +300,7 @@ class BeforeRunStepsPanel extends JPanel {
|
||||
final ListPopup popup =
|
||||
popupFactory.createActionGroupPopup(ExecutionBundle.message("add.new.run.configuration.acrtion.name"), actionGroup,
|
||||
SimpleDataContext.getProjectContext(myRunConfiguration.getProject()), false, false, false, null,
|
||||
-1, Condition.TRUE);
|
||||
-1, Conditions.<AnAction>alwaysTrue());
|
||||
popup.show(button.getPreferredPopupPoint());
|
||||
}
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ import com.intellij.openapi.project.ProjectCoreUtil;
|
||||
import com.intellij.openapi.roots.*;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.Conditions;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.util.text.TrigramBuilder;
|
||||
@@ -105,7 +106,7 @@ class FindInProjectTask {
|
||||
final Pattern pattern = FindInProjectUtil.createFileMaskRegExp(filter);
|
||||
|
||||
//noinspection unchecked
|
||||
myFileMask = pattern == null ? Condition.TRUE : new Condition<VirtualFile>() {
|
||||
myFileMask = pattern == null ? Conditions.<VirtualFile>alwaysTrue() : new Condition<VirtualFile>() {
|
||||
@Override
|
||||
public boolean value(VirtualFile file) {
|
||||
return file != null && pattern.matcher(file.getName()).matches();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -103,7 +103,7 @@ public class JDomConvertingUtil extends JDomSerializationUtil {
|
||||
}
|
||||
|
||||
public static void copyChildren(Element from, Element to) {
|
||||
copyChildren(from, to, Condition.TRUE);
|
||||
copyChildren(from, to, Conditions.<Element>alwaysTrue());
|
||||
}
|
||||
|
||||
public static void copyChildren(Element from, Element to, Condition<Element> filter) {
|
||||
|
||||
@@ -1305,7 +1305,7 @@ public class AbstractTreeUi {
|
||||
}
|
||||
|
||||
if (isSelectionInside(node)) {
|
||||
addSelectionPath(getPathFor(node), true, Condition.TRUE, null);
|
||||
addSelectionPath(getPathFor(node), true, Conditions.alwaysTrue(), null);
|
||||
}
|
||||
|
||||
processInnerChange(new Runnable() {
|
||||
@@ -4853,7 +4853,7 @@ public class AbstractTreeUi {
|
||||
}
|
||||
|
||||
if (pathToSelect != null && myTree.isSelectionEmpty()) {
|
||||
addSelectionPath(pathToSelect, true, Condition.FALSE, null);
|
||||
addSelectionPath(pathToSelect, true, Conditions.alwaysFalse(), null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -17,6 +17,7 @@ package com.intellij.ide.util.treeView;
|
||||
|
||||
import com.intellij.openapi.util.ActionCallback;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.Conditions;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
@@ -214,7 +215,7 @@ public class UpdaterTreeState {
|
||||
if (!children.contains(eachToSelect)) {
|
||||
toSelect.remove();
|
||||
if (!myToSelect.containsKey(readyElement) && !myUi.getSelectedElements().contains(eachToSelect)) {
|
||||
addAdjustedSelection(eachToSelect, Condition.FALSE, null);
|
||||
addAdjustedSelection(eachToSelect, Conditions.alwaysFalse(), null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.intellij.ide.util.treeView.*;
|
||||
import com.intellij.openapi.ui.GraphicsConfig;
|
||||
import com.intellij.openapi.ui.Queryable;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.Conditions;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.ui.*;
|
||||
@@ -143,7 +144,7 @@ public class Tree extends JTree implements ComponentWithEmptyText, ComponentWith
|
||||
@SuppressWarnings("unchecked")
|
||||
@NotNull
|
||||
protected Condition<Integer> getWideSelectionBackgroundCondition() {
|
||||
return Condition.TRUE;
|
||||
return Conditions.alwaysTrue();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -75,7 +75,7 @@ public class QueueProcessor<T> {
|
||||
* Constructs a QueueProcessor, which will autostart as soon as the first element is added to it.
|
||||
*/
|
||||
public QueueProcessor(@NotNull Consumer<T> processor) {
|
||||
this(processor, Condition.FALSE);
|
||||
this(processor, Conditions.alwaysFalse());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -193,7 +193,7 @@ public class MasterKeyPasswordSafe extends BasePasswordSafeProvider {
|
||||
}
|
||||
return myKey.get().get();
|
||||
}
|
||||
}, project == null ? Condition.FALSE : project.getDisposed());
|
||||
}, project == null ? Conditions.alwaysFalse() : project.getDisposed());
|
||||
if (key instanceof byte[]) return (byte[])key;
|
||||
if (key instanceof PasswordSafeException) throw (PasswordSafeException)key;
|
||||
|
||||
|
||||
+1
-1
@@ -263,7 +263,7 @@ public class FileTypeManagerImpl extends FileTypeManagerEx implements NamedJDOME
|
||||
});
|
||||
}
|
||||
|
||||
private final TransferToPooledThreadQueue<Collection<VirtualFile>> reDetectQueue = new TransferToPooledThreadQueue<Collection<VirtualFile>>("File type re-detect", Condition.FALSE, -1, new Processor<Collection<VirtualFile>>() {
|
||||
private final TransferToPooledThreadQueue<Collection<VirtualFile>> reDetectQueue = new TransferToPooledThreadQueue<Collection<VirtualFile>>("File type re-detect", Conditions.alwaysFalse(), -1, new Processor<Collection<VirtualFile>>() {
|
||||
@Override
|
||||
public boolean process(Collection<VirtualFile> files) {
|
||||
reDetect(files);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -20,6 +20,7 @@ import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.Conditions;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.wm.impl.commands.FinalizableCommand;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -124,7 +125,7 @@ public final class CommandProcessor implements Runnable {
|
||||
FinalizableCommand command = myList.remove(0);
|
||||
if (isEmpty()) {
|
||||
// memory leak otherwise
|
||||
myExpireCondition = Condition.TRUE;
|
||||
myExpireCondition = Conditions.alwaysTrue();
|
||||
}
|
||||
return command;
|
||||
}
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -87,7 +87,7 @@ abstract class BaseTreeTestCase<StructureElement> extends FlyIdeaTestCase {
|
||||
|
||||
void waitBuilderToCome() {
|
||||
try {
|
||||
waitBuilderToCome(Condition.TRUE);
|
||||
waitBuilderToCome(Conditions.alwaysTrue());
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new AssertionError(e);
|
||||
@@ -375,7 +375,7 @@ abstract class BaseTreeTestCase<StructureElement> extends FlyIdeaTestCase {
|
||||
}
|
||||
|
||||
void doAndWaitForBuilder(final Runnable runnable) throws Exception {
|
||||
doAndWaitForBuilder(runnable, Condition.TRUE);
|
||||
doAndWaitForBuilder(runnable, Conditions.alwaysTrue());
|
||||
}
|
||||
|
||||
|
||||
|
||||
+3
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -20,6 +20,7 @@ import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.application.Application;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.Conditions;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.testIntegration.TestLocationProvider;
|
||||
import com.intellij.util.Processor;
|
||||
@@ -110,7 +111,7 @@ public abstract class GeneralTestEventsProcessor implements Disposable {
|
||||
}
|
||||
|
||||
public Condition getDisposedCondition() {
|
||||
return Condition.FALSE;
|
||||
return Conditions.alwaysFalse();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -28,6 +28,7 @@ public interface Condition<T> {
|
||||
boolean value(T t);
|
||||
|
||||
Condition<Object> NOT_NULL = new Condition<Object>() {
|
||||
@Override
|
||||
public boolean value(final Object object) {
|
||||
return object != null;
|
||||
}
|
||||
@@ -43,6 +44,7 @@ public interface Condition<T> {
|
||||
* @see com.intellij.openapi.util.Conditions#alwaysTrue()
|
||||
*/
|
||||
Condition TRUE = new Condition() {
|
||||
@Override
|
||||
public boolean value(final Object object) {
|
||||
return true;
|
||||
}
|
||||
@@ -57,6 +59,7 @@ public interface Condition<T> {
|
||||
* @see com.intellij.openapi.util.Conditions#alwaysFalse()
|
||||
*/
|
||||
Condition FALSE = new Condition() {
|
||||
@Override
|
||||
public boolean value(final Object object) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.intellij.openapi.util;
|
||||
|
||||
import com.intellij.reference.SoftReference;
|
||||
import com.intellij.util.ArrayUtilRt;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@@ -27,15 +28,18 @@ import java.util.HashMap;
|
||||
public class Conditions {
|
||||
private Conditions() {}
|
||||
|
||||
@NotNull
|
||||
public static <T> Condition<T> alwaysTrue() {
|
||||
return (Condition<T>)TRUE;
|
||||
}
|
||||
@NotNull
|
||||
public static <T> Condition<T> alwaysFalse() {
|
||||
return (Condition<T>)FALSE;
|
||||
}
|
||||
|
||||
public static <T> Condition<T> instanceOf(final Class<?> clazz) {
|
||||
return new Condition<T>() {
|
||||
@Override
|
||||
public boolean value(T t) {
|
||||
return clazz.isInstance(t);
|
||||
}
|
||||
@@ -44,6 +48,7 @@ public class Conditions {
|
||||
|
||||
public static <T> Condition<T> is(final T option) {
|
||||
return new Condition<T>() {
|
||||
@Override
|
||||
public boolean value(T t) {
|
||||
return Comparing.equal(t, option);
|
||||
}
|
||||
@@ -52,6 +57,7 @@ public class Conditions {
|
||||
|
||||
public static <T> Condition<T> oneOf(final T... options) {
|
||||
return new Condition<T>() {
|
||||
@Override
|
||||
public boolean value(T t) {
|
||||
return ArrayUtilRt.find(options, t) >= 0;
|
||||
}
|
||||
@@ -78,6 +84,7 @@ public class Conditions {
|
||||
myCondition = condition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean value(T value) {
|
||||
return !myCondition.value(value);
|
||||
}
|
||||
@@ -91,6 +98,7 @@ public class Conditions {
|
||||
this.t2 = t2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean value(final T object) {
|
||||
return t1.value(object) && t2.value(object);
|
||||
}
|
||||
@@ -104,17 +112,20 @@ public class Conditions {
|
||||
this.t2 = t2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean value(final T object) {
|
||||
return t1.value(object) || t2.value(object);
|
||||
}
|
||||
}
|
||||
|
||||
public static Condition<Object> TRUE = new Condition<Object>() {
|
||||
@Override
|
||||
public boolean value(final Object object) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
public static Condition<Object> FALSE = new Condition<Object>() {
|
||||
@Override
|
||||
public boolean value(final Object object) {
|
||||
return false;
|
||||
}
|
||||
@@ -128,6 +139,7 @@ public class Conditions {
|
||||
myCondition = condition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean value(T object) {
|
||||
final int key = object.hashCode();
|
||||
final Pair<SoftReference<T>, Boolean> entry = myCache.get(key);
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.intellij.util.containers;
|
||||
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.Conditions;
|
||||
import com.intellij.util.Processor;
|
||||
import com.intellij.util.concurrency.Semaphore;
|
||||
import gnu.trove.Equality;
|
||||
@@ -80,7 +81,7 @@ public class TransferToEDTQueue<T> {
|
||||
runnable.run();
|
||||
return true;
|
||||
}
|
||||
}, Condition.FALSE, maxUnitOfWorkThresholdMs);
|
||||
}, Conditions.alwaysFalse(), maxUnitOfWorkThresholdMs);
|
||||
}
|
||||
|
||||
private boolean isEmpty() {
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.intellij.util.ui.tree;
|
||||
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.Conditions;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -53,7 +54,7 @@ public class WideSelectionTreeUI extends BasicTreeUI {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public WideSelectionTreeUI() {
|
||||
this(true, Condition.TRUE);
|
||||
this(true, Conditions.<Integer>alwaysTrue());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -187,7 +187,7 @@ public class ChangesFragmentedDiffPanel implements Disposable {
|
||||
current = range;
|
||||
}
|
||||
if (current == null) return null;
|
||||
final Fragment at = fragments.getFragmentAt(offset, FragmentSide.SIDE1, Condition.TRUE);
|
||||
final Fragment at = fragments.getFragmentAt(offset, FragmentSide.SIDE1, Conditions.<Fragment>alwaysTrue());
|
||||
if (at == null) return null;
|
||||
final TextRange opposite = at.getRange(FragmentSide.SIDE2);
|
||||
|
||||
|
||||
+2
-1
@@ -31,6 +31,7 @@ import com.intellij.openapi.editor.highlighter.HighlighterIterator;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.Conditions;
|
||||
import com.intellij.openapi.util.Iconable;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.*;
|
||||
@@ -311,7 +312,7 @@ public class GroovyCompletionUtil {
|
||||
|
||||
if (element instanceof PsiClass) {
|
||||
return JavaClassNameCompletionContributor
|
||||
.createClassLookupItems((PsiClass)element, afterNew, new GroovyClassNameInsertHandler(), Condition.TRUE);
|
||||
.createClassLookupItems((PsiClass)element, afterNew, new GroovyClassNameInsertHandler(), Conditions.<PsiClass>alwaysTrue());
|
||||
}
|
||||
|
||||
LookupElementBuilder builder = LookupElementBuilder.create(element instanceof PsiPackage ? element : candidate, name);
|
||||
|
||||
+3
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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,6 +16,7 @@
|
||||
package org.jetbrains.idea.maven.dom.references;
|
||||
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.Conditions;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
@@ -44,7 +45,7 @@ public class MavenPathReferenceConverter extends PathReferenceConverter {
|
||||
private final Condition<PsiFileSystemItem> myCondition;
|
||||
|
||||
public MavenPathReferenceConverter() {
|
||||
this(Condition.TRUE);
|
||||
this(Conditions.<PsiFileSystemItem>alwaysTrue());
|
||||
}
|
||||
|
||||
public MavenPathReferenceConverter(@NotNull Condition<PsiFileSystemItem> condition) {
|
||||
|
||||
+4
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -17,9 +17,10 @@ package org.jetbrains.idea.maven.plugins.api.common;
|
||||
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.codeInsight.lookup.LookupElementBuilder;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.Conditions;
|
||||
import com.intellij.openapi.vfs.CharsetToolkit;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFileSystemItem;
|
||||
import com.intellij.psi.PsiReference;
|
||||
import com.intellij.psi.PsiReferenceBase;
|
||||
import com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReferenceSet;
|
||||
@@ -48,7 +49,7 @@ public class MavenCommonParamReferenceProviders {
|
||||
public PsiReference[] getReferencesByElement(@NotNull PsiElement element,
|
||||
@NotNull MavenDomConfiguration domCfg,
|
||||
@NotNull ProcessingContext context) {
|
||||
return MavenPathReferenceConverter.createReferences(domCfg, element, Condition.TRUE);
|
||||
return MavenPathReferenceConverter.createReferences(domCfg, element, Conditions.<PsiFileSystemItem>alwaysTrue());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -646,6 +646,7 @@ public class SearchingForTestsTask extends Task.Backgroundable {
|
||||
return result;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private GlobalSearchScope getSearchScope() {
|
||||
final TestData data = myConfig.getPersistantData();
|
||||
final Module module = myConfig.getConfigurationModule().getModule();
|
||||
|
||||
@@ -22,10 +22,7 @@ import com.intellij.openapi.roots.ContentIterator;
|
||||
import com.intellij.openapi.roots.ModuleRootManager;
|
||||
import com.intellij.openapi.roots.OrderEnumerator;
|
||||
import com.intellij.openapi.roots.ProjectRootManager;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.InvalidDataException;
|
||||
import com.intellij.openapi.util.JDOMExternalizable;
|
||||
import com.intellij.openapi.util.WriteExternalException;
|
||||
import com.intellij.openapi.util.*;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VfsUtilCore;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
@@ -189,12 +186,12 @@ public class SearchScope implements JDOMExternalizable {
|
||||
switch (getScopeType()) {
|
||||
case PROJECT:
|
||||
//noinspection unchecked
|
||||
ProjectRootManager.getInstance(project).getFileIndex().iterateContent(new MyFileIterator(processor, Condition.TRUE));
|
||||
ProjectRootManager.getInstance(project).getFileIndex().iterateContent(new MyFileIterator(processor, Conditions.<VirtualFile>alwaysTrue()));
|
||||
break;
|
||||
case MODULE:
|
||||
final Module module = ModuleManager.getInstance(project).findModuleByName(getModuleName());
|
||||
//noinspection unchecked
|
||||
ModuleRootManager.getInstance(module).getFileIndex().iterateContent(new MyFileIterator(processor, Condition.TRUE));
|
||||
ModuleRootManager.getInstance(module).getFileIndex().iterateContent(new MyFileIterator(processor, Conditions.<VirtualFile>alwaysTrue()));
|
||||
break;
|
||||
case DIRECTORY:
|
||||
final String dirName = getPath();
|
||||
|
||||
Reference in New Issue
Block a user