当前位置: 首页>>代码示例>>Java>>正文


Java PairConsumer.consume方法代码示例

本文整理汇总了Java中com.intellij.util.PairConsumer.consume方法的典型用法代码示例。如果您正苦于以下问题:Java PairConsumer.consume方法的具体用法?Java PairConsumer.consume怎么用?Java PairConsumer.consume使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.util.PairConsumer的用法示例。


在下文中一共展示了PairConsumer.consume方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: processMembersOfRegisteredClasses

import com.intellij.util.PairConsumer; //导入方法依赖的package包/类
public List<PsiMember> processMembersOfRegisteredClasses(final PrefixMatcher matcher, PairConsumer<PsiMember, PsiClass> consumer) {
  final ArrayList<PsiMember> result = ContainerUtil.newArrayList();
  for (final PsiClass psiClass : myStaticImportedClasses) {
    for (final PsiMethod method : psiClass.getAllMethods()) {
      if (matcher.prefixMatches(method.getName())) {
        if (isStaticallyImportable(method)) {
          consumer.consume(method, psiClass);
        }
      }
    }
    for (final PsiField field : psiClass.getAllFields()) {
      if (matcher.prefixMatches(field. getName())) {
        if (isStaticallyImportable(field)) {
          consumer.consume(field, psiClass);
        }
      }
    }
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:StaticMemberProcessor.java

示例2: processReference

import com.intellij.util.PairConsumer; //导入方法依赖的package包/类
private static void processReference(final CompletionResultSet result,
                                     final int startOffset,
                                     final PairConsumer<PsiReference, CompletionResultSet> consumer,
                                     final PsiReference reference) {
  PsiElement element = reference.getElement();
  final int offsetInElement = startOffset - element.getTextRange().getStartOffset();
  if (!ReferenceRange.containsOffsetInElement(reference, offsetInElement)) {
    return;
  }

  TextRange range = reference.getRangeInElement();
  try {
    final String prefix = element.getText().substring(range.getStartOffset(), offsetInElement);
    consumer.consume(reference, result.withPrefixMatcher(prefix));
  }
  catch (StringIndexOutOfBoundsException e) {
    LOG.error("Reference=" + reference +
              "; element=" + element + " of " + element.getClass() +
              "; range=" + range +
              "; offset=" + offsetInElement,
              e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:LegacyCompletionContributor.java

示例3: doTranslate

import com.intellij.util.PairConsumer; //导入方法依赖的package包/类
public void doTranslate(PairConsumer<Integer, Integer> consumer) {
  final JBTabsPosition pos = myTabs.getTabsPosition();

  int dX = 0;
  int dXs = 0;
  int dY = 0;
  int dYs = 0;
  int selected = getSelectedOffset();
  int plain = getNonSelectedOffset();

  switch (pos) {
    case bottom:
      dY = -plain;
      dYs = -selected;
      break;
    case left:
      dX = plain;
      dXs = selected;
      break;
    case right:
      dX = -plain;
      dXs = -selected;
      break;
    case top:
      dY = plain;
      dYs = selected;
      break;
  }

  if (!myTabs.isDropTarget(myInfo)) {
    if (myTabs.getSelectedInfo() != myInfo) {
      consumer.consume(dX, dY);
    }
    else {
      consumer.consume(dXs, dYs);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:39,代码来源:TabLabel.java

示例4: addRangeDuplicates

import com.intellij.util.PairConsumer; //导入方法依赖的package包/类
private static void addRangeDuplicates(final PsiElement scope,
                                       final PsiElement first,
                                       final PsiElement last,
                                       final PairConsumer<PsiElement, PsiElement> result) {
  final PsiElement[] children = getFilteredChildren(scope, null, true);
  NextChild:
  for (int i = 0; i < children.length;) {
    PsiElement child = children[i];
    if (child != first) {
      int j = i;
      PsiElement next = first;
      do {
        if (!areElementsEquivalent(children[j], next)) break;
        j++;
        if (next == last) {
          result.consume(child, children[j - 1]);
          i = j + 1;
          continue NextChild;
        }
        next = PsiTreeUtil.skipSiblingsForward(next, PsiWhiteSpace.class);
      }
      while (true);

      if (i == j) {
        addRangeDuplicates(child, first, last, result);
      }
    }

    i++;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:PsiEquivalenceUtil.java

示例5: process

import com.intellij.util.PairConsumer; //导入方法依赖的package包/类
public void process(final Iterable<Data> data, final PairConsumer<Data, Area> consumer) {
  myDataIterator = data.iterator();

  if (! myDataIterator.hasNext() || noMoreAreas()) return;
  dataStep();
  initArea();
  while (! noMoreAreas()) {
    final boolean intersects = myAreaRange.intersects(myDataRange);
    if (intersects) {
      consumer.consume(myCurData, myCurArea);
    }
    // take next
    if (! myDataIterator.hasNext() && noMoreAreas()) break;
    if (! myDataIterator.hasNext()) {
      areaStep();
      continue;
    }
    if (noMoreAreas()) {
      dataStep();
      continue;
    }
    if (myDataRange.getEndOffset() < myAreaRange.getEndOffset()) {
      dataStep();
    } else {
      areaStep();
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:StepIntersection.java

示例6: collectSourceOrTestFolders

import com.intellij.util.PairConsumer; //导入方法依赖的package包/类
private void collectSourceOrTestFolders(MavenProject mavenProject, String goal, String defaultDir, JavaSourceRootType type,
                                        PairConsumer<String, JpsModuleSourceRootType<?>> result) {
  Element sourcesElement = getGoalConfig(mavenProject, goal);
  List<String> dirs = MavenJDOMUtil.findChildrenValuesByPath(sourcesElement, "sources", "fileset.directory");
  if (dirs.isEmpty()) {
    result.consume(mavenProject.getDirectory() + "/" + defaultDir, type);
    return;
  }
  for (String dir : dirs) {
    result.consume(dir, type);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:GroovyImporter.java

示例7: getCommittedChangesWithMergedRevisons

import com.intellij.util.PairConsumer; //导入方法依赖的package包/类
public void getCommittedChangesWithMergedRevisons(@NotNull ChangeBrowserSettings settings,
                                                  @NotNull RepositoryLocation location,
                                                  int maxCount,
                                                  @NotNull final PairConsumer<SvnChangeList, LogHierarchyNode> finalConsumer)
  throws VcsException {
  final SvnRepositoryLocation svnLocation = (SvnRepositoryLocation) location;
  final String repositoryRoot = getRepositoryRoot(svnLocation);

  final MergeSourceHierarchyBuilder builder = new MergeSourceHierarchyBuilder(new Consumer<LogHierarchyNode>() {
    public void consume(LogHierarchyNode node) {
      finalConsumer.consume(new SvnChangeList(myVcs, svnLocation, node.getMe(), repositoryRoot), node);
    }
  });
  final SvnMergeSourceTracker mergeSourceTracker = new SvnMergeSourceTracker(new ThrowableConsumer<Pair<LogEntry, Integer>, SVNException>() {
    public void consume(Pair<LogEntry, Integer> svnLogEntryIntegerPair) throws SVNException {
      builder.consume(svnLogEntryIntegerPair);
    }
  });

  getCommittedChangesImpl(settings, SvnTarget.fromURL(svnLocation.toSvnUrl()), maxCount, new Consumer<LogEntry>() {
    public void consume(final LogEntry svnLogEntry) {
      try {
        mergeSourceTracker.consume(svnLogEntry);
      }
      catch (SVNException e) {
        throw new RuntimeException(e);
        // will not occur actually but anyway never eat them
      }
    }
  }, true, false);

  builder.finish();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:SvnCommittedChangesProvider.java

示例8: processComponent

import com.intellij.util.PairConsumer; //导入方法依赖的package包/类
public void processComponent(@NotNull final String componentName, @NotNull final PairConsumer<IFile, Element> consumer) {
  final Map<IFile, Element> map = myStates.get(componentName);
  if (map != null) {
    for (IFile file : map.keySet()) {
      consumer.consume(file, map.get(file));
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:9,代码来源:DirectoryStorageData.java

示例9: doTranslate

import com.intellij.util.PairConsumer; //导入方法依赖的package包/类
public void doTranslate(PairConsumer<Integer, Integer> consumer) {
  final JBTabsPosition pos = myTabs.getTabsPosition();

  int dX = 0;
  int dXs = 0;
  int dY = 0;
  int dYs = 0;
  int selected = getSelectedOffset();
  int plain = getNonSelectedOffset();

  switch (pos) {
    case bottom:
      dY = -plain;
      dYs = -selected;
      break;
    case left:
      dX = plain;
      dXs = selected;
      break;
    case right:
      dX = -plain;
      dXs = -selected;
      break;
    case top:
      dY = plain;
      dYs = selected;
      break;
  }
  
  if (!myTabs.isDropTarget(myInfo)) {
    if (myTabs.getSelectedInfo() != myInfo) {
      consumer.consume(dX,  dY);
    } else {
      consumer.consume(dXs,  dYs);
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:38,代码来源:TabLabel.java

示例10: accept

import com.intellij.util.PairConsumer; //导入方法依赖的package包/类
public void accept(final InfoStorage<T> infoStorage, @Nullable final PairConsumer<T, T> callbackOnUpdate) {
  if (infoStorage.myInfoReliability.shouldOverride(myInfoReliability)) {
    if (callbackOnUpdate != null) {
      callbackOnUpdate.consume(myT, infoStorage.myT);
    }
    myT = infoStorage.myT;
    myInfoReliability = infoStorage.myInfoReliability;
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:10,代码来源:InfoStorage.java

示例11: updateForRoot

import com.intellij.util.PairConsumer; //导入方法依赖的package包/类
public void updateForRoot(@NotNull final VirtualFile root, @NotNull final InfoStorage<SvnBranchConfigurationNew> config,
                          @Nullable final PairConsumer<SvnBranchConfigurationNew, SvnBranchConfigurationNew> callbackOnUpdate) {
  synchronized (myLock) {
    final InfoStorage<SvnBranchConfigurationNew> existing = myMap.get(root);
    if (existing == null) {
      myMap.put(root, config);
      if (callbackOnUpdate != null) {
        callbackOnUpdate.consume(null, config.getValue());
      }
    } else {
      existing.accept(config, callbackOnUpdate);
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:15,代码来源:NewRootBunch.java

示例12: doTranslate

import com.intellij.util.PairConsumer; //导入方法依赖的package包/类
public void doTranslate(PairConsumer<Integer, Integer> consumer) {
    final JBTabsPosition pos = myTabs.getTabsPosition();

    int dX = 0;
    int dXs = 0;
    int dY = 0;
    int dYs = 0;
    int selected = getSelectedOffset();
    int plain = getNonSelectedOffset();

    switch (pos) {
        case bottom:
            dY = -plain;
            dYs = -selected;
            break;
        case left:
            dX = plain;
            dXs = selected;
            break;
        case right:
            dX = -plain;
            dXs = -selected;
            break;
        case top:
            dY = plain;
            dYs = selected;
            break;
    }

    if (!myTabs.isDropTarget(myInfo)) {
        if (myTabs.getSelectedInfo() != myInfo) {
            consumer.consume(dX, dY);
        } else {
            consumer.consume(dXs, dYs);
        }
    }
}
 
开发者ID:JetBrains,项目名称:jediterm,代码行数:38,代码来源:TabLabel.java

示例13: getAssociatedTargets

import com.intellij.util.PairConsumer; //导入方法依赖的package包/类
public List<PomTarget> getAssociatedTargets(@NotNull Jam element) {
  final ArrayList<PomTarget> list = ContainerUtil.newArrayList();
  final Consumer<PomTarget> targetConsumer = target -> list.add(target);
  for (final PairConsumer<Jam, Consumer<PomTarget>> function : myPomTargetProducers) {
    function.consume(element, targetConsumer);
  }
  if (myParent != null) {
    list.addAll(myParent.getAssociatedTargets(element));
  }
  return list;
}
 
开发者ID:consulo,项目名称:consulo-javaee,代码行数:12,代码来源:JamMemberArchetype.java

示例14: getAssociatedTargets

import com.intellij.util.PairConsumer; //导入方法依赖的package包/类
public List<PomTarget> getAssociatedTargets(@NotNull T element) {
  final ArrayList<PomTarget> list = ContainerUtil.newArrayList();
  final Consumer<PomTarget> targetConsumer = target -> list.add(target);
  for (final PairConsumer<T, Consumer<PomTarget>> function : myPomTargetProducers) {
    function.consume(element, targetConsumer);
  }
  return list;
}
 
开发者ID:consulo,项目名称:consulo-javaee,代码行数:9,代码来源:JamAnnotationAttributeMeta.java

示例15: ensureDetailsCreated

import com.intellij.util.PairConsumer; //导入方法依赖的package包/类
private void ensureDetailsCreated() {
    if (myDetailsConsumer != null) return;

    myDetailsPanel = new DetailsPanel();
    final PairConsumer<Change, RefreshablePanel> cacheConsumer = new PairConsumer<Change, RefreshablePanel>() {
      @Override
      public void consume(Change change, RefreshablePanel pair) {
        final FilePath filePath = ChangesUtil.getFilePath(change);
        final RefreshablePanel old = myDetailsCache.get(filePath);
        if (old == null) {
          myDetailsCache.put(filePath, pair);
        } else if (old != pair) {
          if (pair != null) {
            myDetailsCache.put(filePath, pair);
            Disposer.dispose(old);
          }
        }
      }
    };
    myDetailsConsumer = new PairConsumer<Change, RefreshablePanel>() {
      @Override
      public void consume(Change change, RefreshablePanel pair) {
        cacheConsumer.consume(change, pair);
        pair.refresh();
        myCurrentPanel = pair;
        myDetailsPanel.data(myCurrentPanel.getPanel());
        myDetailsPanel.layout();
      }
    };
    myDetailsLoader = new GenericDetailsLoader<Change, RefreshablePanel>(new Consumer<Change>() {
      @Override
      public void consume(Change change) {
        if (myCurrentPanel != null) {
          myCurrentPanel.away();
        }

        final FilePath filePath = ChangesUtil.getFilePath(change);
        RefreshablePanel details = myDetailsCache.get(filePath);
        if (details != null && ! details.isStillValid(change)) {
          Disposer.dispose(details);
          details = null;
          myDetailsLoader.resetValueConsumer();
        }
        if (details != null) {
          myDetailsConsumer.consume(change, details);
        } else {
          final RefreshablePanel detailsPanel = myVcsChangeDetailsManager.getPanel(change, myParent);
          if (detailsPanel != null) {
            try {
              myDetailsLoader.take(change, detailsPanel);
            }
            catch (Details.AlreadyDisposedException e) {
              Disposer.dispose(detailsPanel);
            }
//            myDetailsPanel.layout();
          }
        }
      }
    }, myDetailsConsumer);
    myDetailsLoader.setCacheConsumer(cacheConsumer);
  }
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:62,代码来源:ShortDiffDetails.java


注:本文中的com.intellij.util.PairConsumer.consume方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。