本文整理汇总了Java中com.intellij.openapi.util.Couple.getSecond方法的典型用法代码示例。如果您正苦于以下问题:Java Couple.getSecond方法的具体用法?Java Couple.getSecond怎么用?Java Couple.getSecond使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.util.Couple
的用法示例。
在下文中一共展示了Couple.getSecond方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: process
import com.intellij.openapi.util.Couple; //导入方法依赖的package包/类
@Override
public boolean process(final PsiClass psiClass) {
final String inheritorName = psiClass.getName();
if (inheritorName == null) {
myAnonymousInheritorsCount++;
}
else {
final Couple<Integer> res = collectInheritorsInfo(psiClass,
myCollector,
myDisabledNames,
myProcessedElements,
myAllNotAnonymousInheritors);
myAnonymousInheritorsCount += res.getSecond();
if (!psiClass.isInterface()) {
myAllNotAnonymousInheritors.add(inheritorName);
}
}
return true;
}
示例2: editMacro
import com.intellij.openapi.util.Couple; //导入方法依赖的package包/类
public void editMacro() {
if (getSelectedRowCount() != 1) {
return;
}
final int selectedRow = getSelectedRow();
final Couple<String> pair = myMacros.get(selectedRow);
final String title = ApplicationBundle.message("title.edit.variable");
final String macroName = pair.getFirst();
final PathMacroEditor macroEditor = new PathMacroEditor(title, macroName, pair.getSecond(), new EditValidator());
if (macroEditor.showAndGet()) {
myMacros.remove(selectedRow);
myMacros.add(Couple.of(macroEditor.getName(), macroEditor.getValue()));
Collections.sort(myMacros, MACRO_COMPARATOR);
myTableModel.fireTableDataChanged();
}
}
示例3: unparseKeyCodes
import com.intellij.openapi.util.Couple; //导入方法依赖的package包/类
public static String unparseKeyCodes(Couple<List<Integer>> pairs) {
StringBuilder result = new StringBuilder();
List<Integer> codes = pairs.getFirst();
List<Integer> modifiers = pairs.getSecond();
for (int i = 0; i < codes.size(); i++) {
Integer each = codes.get(i);
result.append(each.toString());
result.append(MODIFIER_DELIMITER);
result.append(modifiers.get(i));
if (i < codes.size() - 1) {
result.append(CODE_DELIMITER);
}
}
return result.toString();
}
示例4: replaceRelativeImportSourceWithQualifiedExpression
import com.intellij.openapi.util.Couple; //导入方法依赖的package包/类
/**
* Replace import source with leading dots (if any) with reference expression created from given qualified name.
* Basically it does the same thing as {@link #replaceWithQualifiedExpression}, but also removes leading dots.
*
* @param importStatement import statement to update
* @param qualifiedName qualified name of new import source
* @return updated import statement
* @see #replaceWithQualifiedExpression(com.intellij.psi.PsiElement, com.intellij.psi.util.QualifiedName)
*/
@NotNull
private static PsiElement replaceRelativeImportSourceWithQualifiedExpression(@NotNull PyFromImportStatement importStatement,
@Nullable QualifiedName qualifiedName) {
final Couple<PsiElement> range = getRelativeImportSourceRange(importStatement);
if (range != null && qualifiedName != null) {
if (range.getFirst() == range.getSecond()) {
replaceWithQualifiedExpression(range.getFirst(), qualifiedName);
}
else {
importStatement.deleteChildRange(range.getFirst().getNextSibling(), range.getSecond());
replaceWithQualifiedExpression(range.getFirst(), qualifiedName);
}
}
return importStatement;
}
示例5: processDeclarations
import com.intellij.openapi.util.Couple; //导入方法依赖的package包/类
@Override
public boolean processDeclarations(@NotNull PsiScopeProcessor processor, @NotNull ResolveState state, PsiElement lastParent, @NotNull PsiElement place) {
processor.handleEvent(PsiScopeProcessor.Event.SET_DECLARATION_HOLDER, this);
if (lastParent == null) {
// Parent element should not see our vars
return true;
}
Couple<Set<String>> pair = buildMaps();
boolean conflict = pair == null;
final Set<String> classesSet = conflict ? null : pair.getFirst();
final Set<String> variablesSet = conflict ? null : pair.getSecond();
final NameHint hint = processor.getHint(NameHint.KEY);
if (hint != null && !conflict) {
final ElementClassHint elementClassHint = processor.getHint(ElementClassHint.KEY);
final String name = hint.getName(state);
if ((elementClassHint == null || elementClassHint.shouldProcess(ElementClassHint.DeclarationKind.CLASS)) && classesSet.contains(name)) {
return PsiScopesUtil.walkChildrenScopes(this, processor, state, lastParent, place);
}
if ((elementClassHint == null || elementClassHint.shouldProcess(ElementClassHint.DeclarationKind.VARIABLE)) && variablesSet.contains(name)) {
return PsiScopesUtil.walkChildrenScopes(this, processor, state, lastParent, place);
}
}
else {
return PsiScopesUtil.walkChildrenScopes(this, processor, state, lastParent, place);
}
return true;
}
示例6: commit
import com.intellij.openapi.util.Couple; //导入方法依赖的package包/类
public void commit() {
myPathMacros.removeAllMacros();
for (Couple<String> pair : myMacros) {
final String value = pair.getSecond();
if (value != null && value.trim().length() > 0) {
String path = value.replace(File.separatorChar, '/');
if (path.endsWith("/")) path = path.substring(0, path.length() - 1);
myPathMacros.setMacro(pair.getFirst(), path);
}
}
}
示例7: getValueAt
import com.intellij.openapi.util.Couple; //导入方法依赖的package包/类
public Object getValueAt(int rowIndex, int columnIndex) {
final Couple<String> pair = myMacros.get(rowIndex);
switch (columnIndex) {
case NAME_COLUMN: return pair.getFirst();
case VALUE_COLUMN: return pair.getSecond();
}
LOG.error("Wrong indices");
return null;
}
示例8: makeKey
import com.intellij.openapi.util.Couple; //导入方法依赖的package包/类
/**
* Makes the password database key for the URL: inserts the login after the scheme: http://[email protected]
*/
@NotNull
private static String makeKey(@NotNull String url, @Nullable String login) {
if (login == null) {
return url;
}
Couple<String> pair = UriUtil.splitScheme(url);
String scheme = pair.getFirst();
if (!StringUtil.isEmpty(scheme)) {
return scheme + URLUtil.SCHEME_SEPARATOR + login + "@" + pair.getSecond();
}
return login + "@" + url;
}
示例9: doDeleteRemote
import com.intellij.openapi.util.Couple; //导入方法依赖的package包/类
private boolean doDeleteRemote(@NotNull String branchName, @NotNull Collection<GitRepository> repositories) {
Couple<String> pair = splitNameOfRemoteBranch(branchName);
String remoteName = pair.getFirst();
String branch = pair.getSecond();
GitCompoundResult result = new GitCompoundResult(myProject);
for (GitRepository repository : repositories) {
GitCommandResult res;
GitRemote remote = getRemoteByName(repository, remoteName);
if (remote == null) {
String error = "Couldn't find remote by name: " + remoteName;
LOG.error(error);
res = GitCommandResult.error(error);
}
else {
res = pushDeletion(repository, remote, branch);
if (!res.success() && isAlreadyDeletedError(res.getErrorOutputAsJoinedString())) {
res = myGit.remotePrune(repository, remote);
}
}
result.append(repository, res);
repository.update();
}
if (!result.totalSuccess()) {
VcsNotifier.getInstance(myProject).notifyError("Failed to delete remote branch " + branchName,
result.getErrorOutputWithReposIndication());
}
return result.totalSuccess();
}
示例10: HgRevisionNumber
import com.intellij.openapi.util.Couple; //导入方法依赖的package包/类
public HgRevisionNumber(@NotNull String revision,
@NotNull String changeset,
@NotNull String authorInfo,
@NotNull String commitMessage,
@NotNull List<HgRevisionNumber> parents) {
this.commitMessage = commitMessage;
Couple<String> authorArgs = HgUtil.parseUserNameAndEmail(authorInfo);
this.author = authorArgs.getFirst();
this.email = authorArgs.getSecond();
this.parents = parents;
this.revision = revision.trim();
this.changeset = changeset.trim();
isWorkingVersion = changeset.endsWith("+");
mySubject = HgBaseLogParser.extractSubject(commitMessage);
}
示例11: search
import com.intellij.openapi.util.Couple; //导入方法依赖的package包/类
/**
* search for most used inheritors of superClass in scope
*
* @param aClass - class that excluded from inheritors of superClass
* @param minPercentRatio - head volume
* @return - search results in relevant ordering (frequency descent)
*/
public static List<InheritorsStatisticsSearchResult> search(final @NotNull PsiClass superClass,
final @NotNull PsiClass aClass,
final @NotNull GlobalSearchScope scope,
final int minPercentRatio) {
final String superClassName = superClass.getName();
final String aClassName = aClass.getName();
final Set<String> disabledNames = new HashSet<String>();
disabledNames.add(aClassName);
disabledNames.add(superClassName);
final Set<InheritorsCountData> collector = new TreeSet<InheritorsCountData>();
final Couple<Integer> collectingResult = collectInheritorsInfo(superClass, collector, disabledNames);
final int allAnonymousInheritors = collectingResult.getSecond();
final int allInheritors = collectingResult.getFirst() + allAnonymousInheritors - 1;
final List<InheritorsStatisticsSearchResult> result = new ArrayList<InheritorsStatisticsSearchResult>();
Integer firstPercent = null;
for (final InheritorsCountData data : collector) {
final int inheritorsCount = data.getInheritorsCount();
if (inheritorsCount < allAnonymousInheritors) {
break;
}
final int percent = (inheritorsCount * 100) / allInheritors;
if (percent < 1) {
break;
}
if (firstPercent == null) {
firstPercent = percent;
}
else if (percent * minPercentRatio < firstPercent) {
break;
}
final PsiClass psiClass = data.getPsiClass();
final VirtualFile file = psiClass.getContainingFile().getVirtualFile();
if (file != null && scope.contains(file)) {
result.add(new InheritorsStatisticsSearchResult(psiClass, percent));
}
}
return result;
}