本文整理汇总了Java中com.intellij.util.ArrayUtil.contains方法的典型用法代码示例。如果您正苦于以下问题:Java ArrayUtil.contains方法的具体用法?Java ArrayUtil.contains怎么用?Java ArrayUtil.contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.util.ArrayUtil
的用法示例。
在下文中一共展示了ArrayUtil.contains方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: invokeAutoPopup
import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
@Override
public boolean invokeAutoPopup(@NotNull PsiElement position, char typeChar) {
MethodReference reference = PsiTreeUtil.getParentOfType(position, MethodReference.class);
if (reference != null && ArrayUtil.contains(reference.getName(), ViewsUtil.renderMethods)) {
if (typeChar == '\'' || typeChar == '"') {
if (position instanceof LeafPsiElement && position.getText().equals("$view")) {
return true;
}
if (position.getNextSibling() instanceof ParameterList) {
return true;
}
}
}
return false;
}
示例2: exposedInInterface
import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
private boolean exposedInInterface(PsiMethod method) {
PsiMethod[] superMethods = method.findSuperMethods();
PsiMethod siblingInherited = FindSuperElementsHelper.getSiblingInheritedViaSubClass(method);
if (siblingInherited != null && !ArrayUtil.contains(siblingInherited, superMethods)) {
superMethods = ArrayUtil.append(superMethods, siblingInherited);
}
for (final PsiMethod superMethod : superMethods) {
final PsiClass superClass = superMethod.getContainingClass();
if (superClass == null) {
continue;
}
if (superClass.isInterface()) {
return true;
}
final String superclassName = superClass.getQualifiedName();
if (CommonClassNames.JAVA_LANG_OBJECT.equals(superclassName)) {
return true;
}
if (exposedInInterface(superMethod)) {
return true;
}
}
return false;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:PublicMethodNotExposedInInterfaceInspectionBase.java
示例3: prepareProjectStructure
import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
private static void prepareProjectStructure(@NotNull ModifiableRootModel model, @NotNull VirtualFile root) {
VirtualFile src = root.findChild("src");
if (src == null || !src.isDirectory()) return;
if (ArrayUtil.contains(src, model.getSourceRoots())) {
try {
VirtualFile java = VfsUtil.createDirectories(src.getPath() + "/main/java");
if (java != null && java.isDirectory()) {
for (VirtualFile child : src.getChildren()) {
if (!child.getName().equals("main")) {
child.move(null, java);
}
}
}
}
catch (IOException e) {
MavenLog.LOG.info(e);
}
}
}
示例4: checkInjectorsAreDisposed
import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
@TestOnly
public static void checkInjectorsAreDisposed(@NotNull Project project) {
InjectedLanguageManagerImpl cachedManager = (InjectedLanguageManagerImpl)project.getUserData(INSTANCE_CACHE);
if (cachedManager == null) {
return;
}
try {
ClassMapCachingNulls<MultiHostInjector> cached = cachedManager.cachedInjectors;
if (cached == null) return;
for (Map.Entry<Class, MultiHostInjector[]> entry : cached.getBackingMap().entrySet()) {
Class key = entry.getKey();
if (cachedManager.myInjectorsClone.isEmpty()) return;
MultiHostInjector[] oldInjectors = cachedManager.myInjectorsClone.get(key);
for (MultiHostInjector injector : entry.getValue()) {
if (!ArrayUtil.contains(injector, oldInjectors)) {
throw new AssertionError("Injector was not disposed: " + key + " -> " + injector);
}
}
}
}
finally {
cachedManager.myInjectorsClone.clear();
}
}
示例5: getHeaderText
import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
private static String getHeaderText(final @Nullable XmlTag header) {
if (header == null) return null;
final StringBuilder buf = new StringBuilder();
if (HGROUP_ELEMENT.equalsIgnoreCase(header.getLocalName())) {
for (XmlTag subTag : header.getSubTags()) {
if (ArrayUtil.contains(subTag.getLocalName().toLowerCase(), HEADER_ELEMENTS)) {
if (buf.length() > 0) {
buf.append(" ");
}
appendTextRecursively(subTag, buf, HtmlTagTreeElement.MAX_TEXT_LENGTH * 2);
}
}
}
else {
appendTextRecursively(header, buf, HtmlTagTreeElement.MAX_TEXT_LENGTH * 2);
}
return buf.toString();
}
示例6: methodWithName
import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
public static Capture<MethodReference> methodWithName(String... methodNames) {
return new Capture<>(new InitialPatternCondition<MethodReference>(MethodReference.class) {
@Override
public boolean accepts(@Nullable Object o, ProcessingContext context) {
if (o instanceof MethodReference) {
String methodReferenceName = ((MethodReference) o).getName();
return methodReferenceName != null && ArrayUtil.contains(methodReferenceName, methodNames);
}
return super.accepts(o, context);
}
});
}
示例7: updateOpenedTestFiles
import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
private static void updateOpenedTestFiles(@NotNull Project project,
@NotNull VirtualFile taskDir,
int fromTaskNumber,
int toSubtaskNumber) {
String fromSubtaskTestName = getTestFileName(project, fromTaskNumber);
String toSubtaskTestName = getTestFileName(project, toSubtaskNumber);
if (fromSubtaskTestName == null || toSubtaskTestName == null) {
return;
}
VirtualFile fromTest = taskDir.findChild(fromSubtaskTestName);
VirtualFile toTest = taskDir.findChild(toSubtaskTestName);
if (fromTest == null || toTest == null) {
return;
}
FileEditorManager editorManager = FileEditorManager.getInstance(project);
if (editorManager.isFileOpen(fromTest)) {
VirtualFile[] selectedFiles = editorManager.getSelectedFiles();
boolean isSelected = ArrayUtil.contains(fromTest, selectedFiles);
editorManager.closeFile(fromTest);
editorManager.openFile(toTest, isSelected);
if (!isSelected) {
for (VirtualFile file : selectedFiles) {
editorManager.openFile(file, true);
}
}
}
}
示例8: getContainingCall
import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
@Nullable
static GrCall getContainingCall(@NotNull GrClosableBlock closableBlock) {
final PsiElement parent = closableBlock.getParent();
if (parent instanceof GrCall && ArrayUtil.contains(closableBlock, ((GrCall)parent).getClosureArguments())) {
return (GrCall)parent;
}
else if (parent instanceof GrArgumentList) {
final PsiElement parent1 = parent.getParent();
if (parent1 instanceof GrCall) {
return (GrCall)parent1;
}
}
return null;
}
示例9: deleteChildInternal
import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
@Override
public void deleteChildInternal(@NotNull ASTNode child) {
if (ArrayUtil.contains(child.getPsi(), getImportElements())) {
PyPsiUtils.deleteAdjacentCommaWithWhitespaces(this, child.getPsi());
}
super.deleteChildInternal(child);
}
示例10: hasChangesOf
import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
public boolean hasChangesOf(DocumentReference ref, boolean onlyDirectChanges) {
for (UndoableAction action : myCurrentActions) {
DocumentReference[] refs = action.getAffectedDocuments();
if (refs == null) {
if (!onlyDirectChanges) return true;
}
else if (ArrayUtil.contains(ref, refs)) return true;
}
return hasActions() && myAdditionalAffectedDocuments.contains(ref);
}
示例11: getNonOptionalDependencies
import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
private List<String> getNonOptionalDependencies(final String id) {
List<String> result = new ArrayList<String>();
IdeaPluginDescriptor descriptor = findPlugin(id);
if (descriptor != null) {
for (PluginId pluginId : descriptor.getDependentPluginIds()) {
if (pluginId.getIdString().equals("com.intellij")) continue;
if (!ArrayUtil.contains(pluginId, descriptor.getOptionalDependentPluginIds())) {
result.add(pluginId.getIdString());
}
}
}
return result;
}
示例12: getNonOptionalDependencies
import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
static List<PluginId> getNonOptionalDependencies(final IdeaPluginDescriptor descriptor) {
List<PluginId> result = new ArrayList<PluginId>();
for (PluginId pluginId : descriptor.getDependentPluginIds()) {
if (pluginId.getIdString().equals("com.intellij")) continue;
if (!ArrayUtil.contains(pluginId, descriptor.getOptionalDependentPluginIds())) {
result.add(pluginId);
}
}
return result;
}
示例13: restoreReference
import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
private static void restoreReference(@NotNull PyReferenceExpression node, @NotNull PsiElement[] otherMovedElements) {
try {
PsiNamedElement target = node.getCopyableUserData(ENCODED_IMPORT);
final String asName = node.getCopyableUserData(ENCODED_IMPORT_AS);
final Boolean useFromImport = node.getCopyableUserData(ENCODED_USE_FROM_IMPORT);
if (target instanceof PsiDirectory) {
target = (PsiNamedElement)PyUtil.getPackageElement((PsiDirectory)target, node);
}
if (target instanceof PyFunction) {
final PyFunction f = (PyFunction)target;
final PyClass c = f.getContainingClass();
if (c != null && c.findInitOrNew(false, null) == f) {
target = c;
}
}
if (target == null) return;
if (PsiTreeUtil.isAncestor(node.getContainingFile(), target, false)) return;
if (ArrayUtil.contains(target, otherMovedElements)) return;
if (target instanceof PyFile || target instanceof PsiDirectory) {
insertImport(node, target, asName, useFromImport != null ? useFromImport : true);
}
else {
insertImport(node, target, asName, true);
}
}
finally {
node.putCopyableUserData(ENCODED_IMPORT, null);
node.putCopyableUserData(ENCODED_IMPORT_AS, null);
node.putCopyableUserData(ENCODED_USE_FROM_IMPORT, null);
}
}
示例14: getRepositoryForRoot
import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
@Nullable
private Repository getRepositoryForRoot(@Nullable VirtualFile root, boolean updateIfNeeded) {
if (root == null) return null;
Repository result;
try {
REPO_LOCK.readLock().lock();
if (myDisposed) {
throw new ProcessCanceledException();
}
Repository repo = myRepositories.get(root);
result = repo != null ? repo : myExternalRepositories.get(root);
}
finally {
REPO_LOCK.readLock().unlock();
}
// if we didn't find appropriate repository, request update mappings if needed and try again
// may be this should not be called from several places (for example: branch widget updating from edt).
if (updateIfNeeded && result == null && ArrayUtil.contains(root, myVcsManager.getAllVersionedRoots())) {
checkAndUpdateRepositoriesCollection(root);
try {
REPO_LOCK.readLock().lock();
return myRepositories.get(root);
}
finally {
REPO_LOCK.readLock().unlock();
}
}
else {
return result;
}
}
示例15: deleteChildInternal
import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
@Override
public void deleteChildInternal(@NotNull ASTNode node) {
if (ArrayUtil.contains(node.getPsi(), getArguments())) {
PyPsiUtils.deleteAdjacentCommaWithWhitespaces(this, node.getPsi());
}
super.deleteChildInternal(node);
}