本文整理汇总了Java中com.intellij.util.PairConsumer类的典型用法代码示例。如果您正苦于以下问题:Java PairConsumer类的具体用法?Java PairConsumer怎么用?Java PairConsumer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PairConsumer类属于com.intellij.util包,在下文中一共展示了PairConsumer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: MembersGetter
import com.intellij.util.PairConsumer; //导入依赖的package包/类
protected MembersGetter(StaticMemberProcessor processor, @NotNull final PsiElement place) {
myPlace = place;
processor.processMembersOfRegisteredClasses(PrefixMatcher.ALWAYS_TRUE, new PairConsumer<PsiMember, PsiClass>() {
@Override
public void consume(PsiMember member, PsiClass psiClass) {
myImportedStatically.add(member);
}
});
PsiClass current = PsiTreeUtil.getContextOfType(place, PsiClass.class);
while (current != null) {
current = CompletionUtil.getOriginalOrSelf(current);
myPlaceClasses.add(current);
current = PsiTreeUtil.getContextOfType(current, PsiClass.class);
}
PsiMethod eachMethod = PsiTreeUtil.getContextOfType(place, PsiMethod.class);
while (eachMethod != null) {
eachMethod = CompletionUtil.getOriginalOrSelf(eachMethod);
myPlaceMethods.add(eachMethod);
eachMethod = PsiTreeUtil.getContextOfType(eachMethod, PsiMethod.class);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:MembersGetter.java
示例3: BackgroundTaskQueue
import com.intellij.util.PairConsumer; //导入依赖的package包/类
public BackgroundTaskQueue(@Nullable final Project project, @NotNull String title, final Boolean forcedHeadlessMode) {
myMonitor = Boolean.TRUE.equals(Boolean.getBoolean(ourMonitorFlag)) ? new BackgroundTasksMonitor(title) : new PlusMinus.Empty<String>();
final boolean headless = forcedHeadlessMode != null ? forcedHeadlessMode : ApplicationManager.getApplication().isHeadlessEnvironment();
final QueueProcessor.ThreadToUse threadToUse = headless ? QueueProcessor.ThreadToUse.POOLED : QueueProcessor.ThreadToUse.AWT;
final PairConsumer<Pair<Task.Backgroundable, Getter<ProgressIndicator>>, Runnable> consumer
= headless ? new BackgroundableHeadlessRunner() : new BackgroundableUnderProgressRunner(title, project, myMonitor);
myProcessor = new QueueProcessor<Pair<Task.Backgroundable, Getter<ProgressIndicator>>>(consumer, true,
threadToUse, new Condition<Object>() {
@Override public boolean value(Object o) {
if (project == null) return ApplicationManager.getApplication().isDisposed();
if (project.isDefault()) {
return project.isDisposed();
} else {
return !ApplicationManager.getApplication().isUnitTestMode() && !project.isOpen() || project.isDisposed();
}
}
});
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:BackgroundTaskQueue.java
示例4: AbstractRefreshablePanel
import com.intellij.util.PairConsumer; //导入依赖的package包/类
protected AbstractRefreshablePanel(final Project project, final String loadingTitle, final BackgroundTaskQueue queue) {
myQueue = queue;
myTicket = new Ticket();
myDetailsPanel = new DetailsPanel();
myDetailsPanel.loading();
myDetailsPanel.layout();
myDetailsLoader = new GenericDetailsLoader<Ticket, T>(new Consumer<Ticket>() {
@Override
public void consume(Ticket ticket) {
final Loader loader = new Loader(project, loadingTitle, myTicket.copy());
loader.runSteadily(new Consumer<Task.Backgroundable>() {
@Override
public void consume(Task.Backgroundable backgroundable) {
myQueue.run(backgroundable);
}
});
}
}, new PairConsumer<Ticket, T>() {
@Override
public void consume(Ticket ticket, T t) {
acceptData(t);
}
});
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:AbstractRefreshablePanel.java
示例5: completeReference
import com.intellij.util.PairConsumer; //导入依赖的package包/类
public static boolean completeReference(final CompletionParameters parameters, final CompletionResultSet result) {
final CompletionData completionData = getCompletionData(parameters);
if (completionData == null) {
return false;
}
final Ref<Boolean> hasVariants = Ref.create(false);
processReferences(parameters, result, new PairConsumer<PsiReference, CompletionResultSet>() {
@Override
public void consume(final PsiReference reference, final CompletionResultSet resultSet) {
final Set<LookupElement> lookupSet = new LinkedHashSet<LookupElement>();
completionData.completeReference(reference, lookupSet, parameters.getPosition(), parameters.getOriginalFile());
for (final LookupElement item : lookupSet) {
if (resultSet.getPrefixMatcher().prefixMatches(item)) {
if (!item.isValid()) {
LOG.error(completionData + " has returned an invalid lookup element " + item + " of " + item.getClass() +
" in " + parameters.getOriginalFile() + " of " + parameters.getOriginalFile().getClass());
}
hasVariants.set(true);
resultSet.addElement(item);
}
}
}
});
return hasVariants.get().booleanValue();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:LegacyCompletionContributor.java
示例6: 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
示例7: ScratchFileServiceImpl
import com.intellij.util.PairConsumer; //导入依赖的package包/类
protected ScratchFileServiceImpl(MessageBus messageBus) {
myIndex = new LightDirectoryIndex<RootType>(messageBus.connect(), NULL_TYPE) {
@Override
protected void collectRoots(@NotNull PairConsumer<VirtualFile, RootType> consumer) {
LocalFileSystem fileSystem = LocalFileSystem.getInstance();
for (RootType r : RootType.getAllRootIds()) {
String root = getRootPath(r);
VirtualFile rootFile = fileSystem.findFileByPath(root);
if (rootFile != null) {
consumer.consume(rootFile, r);
}
}
}
};
initFileOpenedListener(messageBus);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:ScratchFileServiceImpl.java
示例8: addCompletions
import com.intellij.util.PairConsumer; //导入依赖的package包/类
@Override
protected void addCompletions(@NotNull CompletionParameters parameters,
ProcessingContext context,
@NotNull final CompletionResultSet result) {
LegacyCompletionContributor.processReferences(parameters, result, new PairConsumer<PsiReference, CompletionResultSet>() {
@Override
public void consume(PsiReference reference, CompletionResultSet set) {
if (reference instanceof TagNameReference) {
collectCompletionVariants((TagNameReference)reference, set);
}
else if (reference instanceof SchemaPrefixReference) {
TagNameReference tagNameReference = ((SchemaPrefixReference)reference).getTagNameReference();
if (tagNameReference != null && !tagNameReference.isStartTagFlag()) {
set.consume(createClosingTagLookupElement((XmlTag)tagNameReference.getElement(), true, tagNameReference.getNameElement()));
}
}
}
});
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:TagNameReferenceCompletionProvider.java
示例9: beforeCheckin
import com.intellij.util.PairConsumer; //导入依赖的package包/类
@Override
public ReturnResult beforeCheckin(@Nullable CommitExecutor executor, PairConsumer<Object, Object> additionalDataConsumer) {
if (emptyCommitMessage()) {
return ReturnResult.CANCEL;
}
if (commitOrCommitAndPush(executor)) {
ReturnResult result = checkUserName();
if (result != ReturnResult.COMMIT) {
return result;
}
result = warnAboutCrlfIfNeeded();
if (result != ReturnResult.COMMIT) {
return result;
}
return warnAboutDetachedHeadIfNeeded();
}
return ReturnResult.COMMIT;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:GitCheckinHandlerFactory.java
示例10: showRecentListsForSelection
import com.intellij.util.PairConsumer; //导入依赖的package包/类
@Override
public List<CommittedChangeList> showRecentListsForSelection(@NotNull List<CommittedChangeList> list,
@NotNull String mergeTitle,
@NotNull MergeChecker mergeChecker,
@NotNull PairConsumer<Long, MergeDialogI> loader,
boolean everyThingLoaded) {
final ToBeMergedDialog dialog = new ToBeMergedDialog(myProject, list, mergeTitle, mergeChecker, loader);
if (everyThingLoaded) {
dialog.setEverythingLoaded(true);
}
dialog.show();
if (DialogWrapper.OK_EXIT_CODE == dialog.getExitCode()) {
return dialog.getSelected();
}
return null;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:QuickMergeInteractionImpl.java
示例11: createMoreChangeListsLoader
import com.intellij.util.PairConsumer; //导入依赖的package包/类
@NotNull
private PairConsumer<Long, MergeDialogI> createMoreChangeListsLoader() {
return new PairConsumer<Long, MergeDialogI>() {
@Override
public void consume(@NotNull Long bunchSize, @NotNull MergeDialogI dialog) {
LoadRecentBranchRevisions loader = new LoadRecentBranchRevisions(myMergeContext, dialog.getLastNumber(), bunchSize.intValue());
TaskDescriptor updater = createUpdateDialogTask(dialog, loader);
Continuation fragmented = Continuation.createFragmented(myMergeContext.getProject(), true);
fragmented.addExceptionHandler(VcsException.class, new Consumer<VcsException>() {
@Override
public void consume(VcsException e) {
PopupUtil.showBalloonForActiveComponent(e.getMessage() == null ? e.getClass().getName() : e.getMessage(), MessageType.ERROR);
}
});
fragmented.run(loader, updater);
}
};
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ShowRecentInDialogTask.java
示例12: getChangeListsBefore
import com.intellij.util.PairConsumer; //导入依赖的package包/类
@NotNull
private List<Pair<SvnChangeList, LogHierarchyNode>> getChangeListsBefore(long revision) throws VcsException {
ChangeBrowserSettings settings = new ChangeBrowserSettings();
if (revision > 0) {
settings.CHANGE_BEFORE = String.valueOf(revision);
settings.USE_CHANGE_BEFORE_FILTER = true;
}
final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
ProgressManager.progress2(
SvnBundle.message("progress.text2.collecting.history", myMergeContext.getSourceUrl() + (revision > 0 ? ("@" + revision) : "")));
final List<Pair<SvnChangeList, LogHierarchyNode>> result = ContainerUtil.newArrayList();
((SvnCommittedChangesProvider)myMergeContext.getVcs().getCommittedChangesProvider())
.getCommittedChangesWithMergedRevisons(settings, new SvnRepositoryLocation(myMergeContext.getSourceUrl()),
myBunchSize + (revision > 0 ? 2 : 1),
new PairConsumer<SvnChangeList, LogHierarchyNode>() {
public void consume(SvnChangeList svnList, LogHierarchyNode tree) {
indicator.setText2(
SvnBundle.message("progress.text2.processing.revision", svnList.getNumber()));
result.add(Pair.create(svnList, tree));
}
});
return result;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:LoadRecentBranchRevisions.java
示例13: getKeyVariants
import com.intellij.util.PairConsumer; //导入依赖的package包/类
@Override
protected Collection<String> getKeyVariants(@NotNull GrExpression qualifier, @Nullable PsiElement resolve) {
Pair<ConfigSlurperSupport.PropertiesProvider, List<String>> info = getInfo(qualifier, resolve);
if (info == null) return Collections.emptyList();
final Set<String> res = new HashSet<String>();
info.first.collectVariants(info.second, new PairConsumer<String, Boolean>() {
@Override
public void consume(String variant, Boolean isFinal) {
res.add(variant);
}
});
return res;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ConfigSlurperMapContentProvider.java
示例14: getValueType
import com.intellij.util.PairConsumer; //导入依赖的package包/类
@Override
public PsiType getValueType(@NotNull GrExpression qualifier, @Nullable PsiElement resolve, @NotNull final String key) {
Pair<ConfigSlurperSupport.PropertiesProvider, List<String>> info = getInfo(qualifier, resolve);
if (info == null) return null;
final Ref<Boolean> res = new Ref<Boolean>();
info.first.collectVariants(info.second, new PairConsumer<String, Boolean>() {
@Override
public void consume(String variant, Boolean isFinal) {
if (variant.equals(key)) {
res.set(isFinal);
}
else if (variant.startsWith(key) && variant.length() > key.length() && variant.charAt(key.length()) == '.') {
res.set(false);
}
}
});
if (res.get() != null && !res.get()) {
return JavaPsiFacade.getElementFactory(qualifier.getProject()).createTypeByFQClassName(GroovyCommonClassNames.GROOVY_UTIL_CONFIG_OBJECT, qualifier.getResolveScope());
}
return null;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:ConfigSlurperMapContentProvider.java
示例15: completeReference
import com.intellij.util.PairConsumer; //导入依赖的package包/类
public static boolean completeReference(final CompletionParameters parameters, final CompletionResultSet result) {
final CompletionData completionData = getCompletionData(parameters);
if (completionData == null) {
return false;
}
final Ref<Boolean> hasVariants = Ref.create(false);
processReferences(parameters, result, new PairConsumer<PsiReference, CompletionResultSet>() {
@Override
public void consume(final PsiReference reference, final CompletionResultSet resultSet) {
final Set<LookupElement> lookupSet = new LinkedHashSet<LookupElement>();
completionData
.completeReference(reference, lookupSet, parameters.getPosition(), parameters.getOriginalFile(), parameters.getOffset());
for (final LookupElement item : lookupSet) {
if (resultSet.getPrefixMatcher().prefixMatches(item)) {
hasVariants.set(true);
resultSet.addElement(item);
}
}
}
});
return hasVariants.get().booleanValue();
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:LegacyCompletionContributor.java
示例16: createStatusHighlighter
import com.intellij.util.PairConsumer; //导入依赖的package包/类
private void createStatusHighlighter() {
int line1 = myPatchDeletionRange.start;
int line2 = myPatchInsertionRange.end;
Color color = getStatusColor();
if (isResolved()) {
color = ColorUtil.mix(color, myViewer.getPatchEditor().getGutterComponentEx().getBackground(), 0.6f);
}
String tooltip = getStatusText();
EditorEx patchEditor = myViewer.getPatchEditor();
Document document = patchEditor.getDocument();
MarkupModelEx markupModel = patchEditor.getMarkupModel();
TextRange textRange = DiffUtil.getLinesRange(document, line1, line2);
RangeHighlighter highlighter = markupModel.addRangeHighlighter(textRange.getStartOffset(), textRange.getEndOffset(),
HighlighterLayer.LAST, null, HighlighterTargetArea.LINES_IN_RANGE);
PairConsumer<Editor, MouseEvent> clickHandler = getResultRange() != null ?
(e, event) -> myViewer.scrollToChange(this, Side.RIGHT, false) :
null;
highlighter.setLineMarkerRenderer(LineStatusMarkerRenderer.createRenderer(line1, line2, color, tooltip, clickHandler));
myHighlighters.add(highlighter);
}
开发者ID:consulo,项目名称:consulo,代码行数:27,代码来源:ApplyPatchChange.java
示例17: functionalInterfaceSelected
import com.intellij.util.PairConsumer; //导入依赖的package包/类
private void functionalInterfaceSelected(final PsiType selectedType,
final List<PsiMethod> enclosingMethods,
final Project project,
final Editor editor,
final MyExtractMethodProcessor processor,
final PsiElement[] elements) {
final PairConsumer<PsiMethod, PsiMethod> consumer = new PairConsumer<PsiMethod, PsiMethod>() {
@Override
public void consume(PsiMethod methodToIntroduceParameter, PsiMethod methodToSearchFor) {
introduceWrappedCodeBlockParameter(methodToIntroduceParameter, methodToSearchFor, editor, project, selectedType, processor, elements);
}
};
chooseMethodToIntroduceParameter(editor, enclosingMethods, consumer);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:IntroduceParameterHandler.java
示例18: 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
示例19: wrappingProcessor
import com.intellij.util.PairConsumer; //导入依赖的package包/类
@NotNull
private static <T> PairConsumer<T, Runnable> wrappingProcessor(@NotNull final Consumer<T> processor) {
return new PairConsumer<T, Runnable>() {
@Override
public void consume(final T item, Runnable runnable) {
runSafely(new Runnable() {
@Override
public void run() {
processor.consume(item);
}
});
runnable.run();
}
};
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:QueueProcessor.java
示例20: QueueProcessor
import com.intellij.util.PairConsumer; //导入依赖的package包/类
/**
* Constructs a QueueProcessor with the given processor and autostart setting.
* By default QueueProcessor starts processing when it receives the first element. Pass <code>false</code> to alternate its behavior.
*
* @param processor processor of queue elements.
* @param autostart if <code>true</code> (which is by default), the queue will be processed immediately when it receives the first element.
* If <code>false</code>, then it will wait for the {@link #start()} command.
* After QueueProcessor has started once, autostart setting doesn't matter anymore: all other elements will be processed immediately.
*/
public QueueProcessor(@NotNull PairConsumer<T, Runnable> processor,
boolean autostart,
@NotNull ThreadToUse threadToUse,
@NotNull Condition<?> deathCondition) {
myProcessor = processor;
myStarted = autostart;
myThreadToUse = threadToUse;
myDeathCondition = deathCondition;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:QueueProcessor.java
注:本文中的com.intellij.util.PairConsumer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论