當前位置: 首頁>>代碼示例>>Java>>正文


Java ContainerUtil.find方法代碼示例

本文整理匯總了Java中com.intellij.util.containers.ContainerUtil.find方法的典型用法代碼示例。如果您正苦於以下問題:Java ContainerUtil.find方法的具體用法?Java ContainerUtil.find怎麽用?Java ContainerUtil.find使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.util.containers.ContainerUtil的用法示例。


在下文中一共展示了ContainerUtil.find方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: substituteByParameterName

import com.intellij.util.containers.ContainerUtil; //導入方法依賴的package包/類
public static PsiSubstitutor substituteByParameterName(final PsiClass psiClass, final PsiSubstitutor parentSubstitutor) {

    final Map<PsiTypeParameter, PsiType> substitutionMap = parentSubstitutor.getSubstitutionMap();
    final List<PsiType> result = new ArrayList<PsiType>(substitutionMap.size());
    for (PsiTypeParameter typeParameter : psiClass.getTypeParameters()) {
      final String name = typeParameter.getName();
      final PsiTypeParameter key = ContainerUtil.find(substitutionMap.keySet(), new Condition<PsiTypeParameter>() {
        @Override
        public boolean value(final PsiTypeParameter psiTypeParameter) {
          return name.equals(psiTypeParameter.getName());
        }
      });
      if (key != null) {
        result.add(substitutionMap.get(key));
      }
    }
    return PsiSubstitutor.EMPTY.putAll(psiClass, result.toArray(PsiType.createArray(result.size())));
  }
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:19,代碼來源:GenericsUtil.java

示例2: setStatusToImportant

import com.intellij.util.containers.ContainerUtil; //導入方法依賴的package包/類
private void setStatusToImportant() {
  ArrayList<Notification> notifications = getNotifications();
  Collections.reverse(notifications);
  Notification message = ContainerUtil.find(notifications, new Condition<Notification>() {
    @Override
    public boolean value(Notification notification) {
      return notification.isImportant();
    }
  });
  if (message == null) {
    setStatusMessage(null, 0);
  }
  else {
    setStatusMessage(message, message.getTimestamp());
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:17,代碼來源:LogModel.java

示例3: switchStatementMayReturnNormally

import com.intellij.util.containers.ContainerUtil; //導入方法依賴的package包/類
private static boolean switchStatementMayReturnNormally(@NotNull GrSwitchStatement switchStatement) {
  if (statementIsBreakTarget(switchStatement)) {
    return true;
  }

  final GrCaseSection[] caseClauses = switchStatement.getCaseSections();

  if (ContainerUtil.find(caseClauses, new Condition<GrCaseSection>() {
    @Override
    public boolean value(GrCaseSection section) {
      return section.isDefault();
    }
  }) == null) {
    return true;
  }

  final GrCaseSection lastClause = caseClauses[caseClauses.length - 1];
  final GrStatement[] statements = lastClause.getStatements();
  if (statements.length == 0) {
    return true;
  }
  return statementMayCompleteNormally(statements[statements.length - 1]);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:24,代碼來源:ControlFlowUtils.java

示例4: getFirstNodeToEdit

import com.intellij.util.containers.ContainerUtil; //導入方法依賴的package包/類
@Nullable
private DefaultMutableTreeNode getFirstNodeToEdit() {
  // start edit last selected component if editable
  if (myTree.getLastSelectedPathComponent() instanceof RepositoryNode) {
    RepositoryNode selectedNode = ((RepositoryNode)myTree.getLastSelectedPathComponent());
    if (selectedNode.isEditableNow()) return selectedNode;
  }
  List<RepositoryNode> repositoryNodes = getChildNodesByType((DefaultMutableTreeNode)myTree.getModel().getRoot(),
                                                             RepositoryNode.class, false);
  RepositoryNode editableNode = ContainerUtil.find(repositoryNodes, new Condition<RepositoryNode>() {
    @Override
    public boolean value(RepositoryNode repositoryNode) {
      return repositoryNode.isEditableNow();
    }
  });
  if (editableNode != null) {
    TreeUtil.selectNode(myTree, editableNode);
  }
  return editableNode;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:21,代碼來源:PushLog.java

示例5: refresh

import com.intellij.util.containers.ContainerUtil; //導入方法依賴的package包/類
@CalledInAwt
public void refresh() {
  List<Change> selectedChanges = getSelectedChanges();

  if (selectedChanges.isEmpty()) {
    myCurrentChange = null;
    updateRequest();
    return;
  }

  Change selectedChange = myCurrentChange != null ? ContainerUtil.find(selectedChanges, myCurrentChange) : null;
  if (selectedChange == null) {
    myCurrentChange = selectedChanges.get(0);
    updateRequest();
    return;
  }

  if (!ChangeDiffRequestProducer.isEquals(myCurrentChange, selectedChange)) {
    myCurrentChange = selectedChange;
    updateRequest();
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:23,代碼來源:CacheChangeProcessor.java

示例6: getAbortLine

import com.intellij.util.containers.ContainerUtil; //導入方法依賴的package包/類
@Nullable
private static String getAbortLine(@NotNull HgCommandResult result) {
  final List<String> errorLines = result.getErrorLines();
  return ContainerUtil.find(errorLines, new Condition<String>() {
    @Override
    public boolean value(String s) {
      return isAbortLine(s);
    }
  });
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:11,代碼來源:HgErrorUtil.java

示例7: nullabilityAnnotationsNotAvailable

import com.intellij.util.containers.ContainerUtil; //導入方法依賴的package包/類
private static boolean nullabilityAnnotationsNotAvailable(final PsiFile file) {
  final Project project = file.getProject();
  final GlobalSearchScope scope = GlobalSearchScope.allScope(project);
  final JavaPsiFacade facade = JavaPsiFacade.getInstance(project);
  return ContainerUtil.find(NullableNotNullManager.getInstance(project).getNullables(), new Condition<String>() {
    @Override
    public boolean value(String s) {
      return facade.findClass(s, scope) != null;
    }
  }) == null;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:12,代碼來源:NullableStuffInspectionBase.java

示例8: getFirstFieldForKeywordArgument

import com.intellij.util.containers.ContainerUtil; //導入方法依賴的package包/類
@Nullable
private SectionField getFirstFieldForKeywordArgument(@NotNull final String name) {
  return ContainerUtil.find(getKeywordArgumentFields(), new Condition<SectionField>() {
    @Override
    public boolean value(SectionField field) {
      return field.getNames().contains(name);
    }
  });
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:10,代碼來源:SectionBasedDocString.java

示例9: findProjectByBaseDirLocation

import com.intellij.util.containers.ContainerUtil; //導入方法依賴的package包/類
@Nullable
static Project findProjectByBaseDirLocation(@NotNull final File directory) {
  return ContainerUtil.find(ProjectManager.getInstance().getOpenProjects(), new Condition<Project>() {
    @Override
    public boolean value(Project project) {
      VirtualFile baseDir = project.getBaseDir();
      return baseDir != null && FileUtil.filesEqual(VfsUtilCore.virtualToIoFile(baseDir), directory);
    }
  });
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:11,代碼來源:CompositeCheckoutListener.java

示例10: findByName

import com.intellij.util.containers.ContainerUtil; //導入方法依賴的package包/類
@Nullable
private static <T extends GitBranch> T findByName(Collection<T> branches, @NotNull final String name) {
  return ContainerUtil.find(branches, new Condition<T>() {
    @Override
    public boolean value(T branch) {
      return name.equals(branch.getName());
    }
  });
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:10,代碼來源:GitBranchesCollection.java

示例11: findProjectLibraryElement

import com.intellij.util.containers.ContainerUtil; //導入方法依賴的package包/類
@Nullable
private Element findProjectLibraryElement(String name) throws CannotConvertException {
  final Collection<? extends Element> libraries = getProjectLibrariesSettings().getProjectLibraries();
  final Condition<Element> filter = JDomConvertingUtil.createElementWithAttributeFilter(LibraryImpl.ELEMENT,
                                                                                        LibraryImpl.LIBRARY_NAME_ATTR, name);
  return ContainerUtil.find(libraries, filter);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:8,代碼來源:ConversionContextImpl.java

示例12: createCallback

import com.intellij.util.containers.ContainerUtil; //導入方法依賴的package包/類
@Nullable
private AuthCallbackCase createCallback(@NotNull final String errText, @Nullable final SVNURL url, boolean isUnderTerminal) {
  List<AuthCallbackCase> authCases = ContainerUtil.newArrayList();

  if (isUnderTerminal) {
    // Subversion client does not prompt for proxy credentials (just fails with error) even in terminal mode. So we handle this case the
    // same way as in non-terminal mode - repeat command with new credentials.
    // NOTE: We could also try getting proxy credentials from user in advance (by issuing separate request and asking for credentials if
    // NOTE: required) - not to execute same command several times like it is currently for all other cases in terminal mode. But such
    // NOTE: behaviour is not mandatory for now - so we just use "repeat command" logic.
    authCases.add(new ProxyCallback(myAuthenticationService, url));
    // Same situation (described above) as with proxy settings is here.
    authCases.add(new TwoWaySslCallback(myAuthenticationService, url));
  }
  else {
    authCases.add(new CertificateCallbackCase(myAuthenticationService, url));
    authCases.add(new ProxyCallback(myAuthenticationService, url));
    authCases.add(new TwoWaySslCallback(myAuthenticationService, url));
    authCases.add(new UsernamePasswordCallback(myAuthenticationService, url));
  }

  return ContainerUtil.find(authCases, new Condition<AuthCallbackCase>() {
    @Override
    public boolean value(AuthCallbackCase authCase) {
      return authCase.canHandle(errText);
    }
  });
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:29,代碼來源:CommandRuntime.java

示例13: matches

import com.intellij.util.containers.ContainerUtil; //導入方法依賴的package包/類
private boolean matches(@NotNull final String path) {
  return ContainerUtil.find(myFiles, new Condition<VirtualFile>() {
    @Override
    public boolean value(VirtualFile file) {
      return FileUtil.isAncestor(file.getPath(), path, false);
    }
  }) != null;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:9,代碼來源:VcsLogStructureFilterImpl.java

示例14: getHelper

import com.intellij.util.containers.ContainerUtil; //導入方法依賴的package包/類
/**
 * @deprecated this method is broken, please avoid using it, use getHelpers() instead
 */
@Deprecated
public static <T extends PsiFileSystemItem> FileReferenceHelper getHelper(@NotNull final T psiFileSystemItem) {
  final VirtualFile file = psiFileSystemItem.getVirtualFile();
  if (file == null) return null;
  final Project project = psiFileSystemItem.getProject();
  return ContainerUtil.find(getHelpers(), new Condition<FileReferenceHelper>() {
    @Override
    public boolean value(final FileReferenceHelper fileReferenceHelper) {
      return fileReferenceHelper.isMine(project, file);
    }
  });
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:16,代碼來源:FileReferenceHelperRegistrar.java

示例15: findByName

import com.intellij.util.containers.ContainerUtil; //導入方法依賴的package包/類
@Nullable
public static <T> T findByName(Collection<T> collection, final String name) {
  return ContainerUtil.find(collection, new Condition<T>() {
    @Override
    public boolean value(final T object) {
      return Comparing.equal(name, getElementName(object), true);
    }
  });
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:10,代碼來源:ElementPresentationManager.java


注:本文中的com.intellij.util.containers.ContainerUtil.find方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。