本文整理汇总了Java中com.intellij.util.PairProcessor.process方法的典型用法代码示例。如果您正苦于以下问题:Java PairProcessor.process方法的具体用法?Java PairProcessor.process怎么用?Java PairProcessor.process使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.util.PairProcessor
的用法示例。
在下文中一共展示了PairProcessor.process方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: filterTree
import com.intellij.util.PairProcessor; //导入方法依赖的package包/类
static SliceNode filterTree(SliceNode oldRoot,
NullableFunction<SliceNode, SliceNode> filter,
PairProcessor<SliceNode, List<SliceNode>> postProcessor) {
SliceNode filtered = filter.fun(oldRoot);
if (filtered == null) return null;
List<SliceNode> childrenFiltered = new ArrayList<SliceNode>();
if (oldRoot.myCachedChildren != null) {
for (SliceNode child : oldRoot.myCachedChildren) {
SliceNode childFiltered = filterTree(child, filter,postProcessor);
if (childFiltered != null) {
childrenFiltered.add(childFiltered);
}
}
}
boolean success = postProcessor == null || postProcessor.process(filtered, childrenFiltered);
if (!success) return null;
filtered.myCachedChildren = new ArrayList<SliceNode>(childrenFiltered);
return filtered;
}
示例2: _do
import com.intellij.util.PairProcessor; //导入方法依赖的package包/类
public static void _do(@NotNull final ConfigurationError error, @NotNull final Project project,
@NotNull final PairProcessor<ConfigurationErrors, ConfigurationError> fun) {
if (!project.isInitialized()) {
StartupManager.getInstance(project).runWhenProjectIsInitialized(new Runnable() {
@Override
public void run() {
fun.process(project.getMessageBus().syncPublisher(TOPIC), error);
}
});
return;
}
final MessageBus bus = project.getMessageBus();
if (EventQueue.isDispatchThread()) fun.process(bus.syncPublisher(TOPIC), error);
else {
//noinspection SSBasedInspection
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
fun.process(bus.syncPublisher(TOPIC), error);
}
});
}
}
示例3: processParameters
import com.intellij.util.PairProcessor; //导入方法依赖的package包/类
public boolean processParameters(final PairProcessor<String, Object> processor) {
for (Class aClass = getClass(); aClass != null; aClass = aClass.getSuperclass()) {
for (final Field field : aClass.getDeclaredFields()) {
if (!Modifier.isStatic(field.getModifiers()) &&
(((field.getModifiers() & 0x1000 /*Modifer.SYNTHETIC*/) == 0 && !aClass.equals(PatternCondition.class))
|| field.getName().startsWith(PARAMETER_FIELD_PREFIX))) {
final String name = field.getName();
final String fixedName = name.startsWith(PARAMETER_FIELD_PREFIX) ?
name.substring(PARAMETER_FIELD_PREFIX.length()) : name;
final Object value = getFieldValue(field);
if (!processor.process(fixedName, value)) return false;
}
}
}
return true;
}
示例4: treeWalkUp
import com.intellij.util.PairProcessor; //导入方法依赖的package包/类
public static boolean treeWalkUp(@NotNull final PsiElement entrance,
@Nullable final PsiElement maxScope,
PairProcessor<PsiElement, PsiElement> eachScopeAndLastParent) {
PsiElement prevParent = null;
PsiElement scope = entrance;
while (scope != null) {
if (!eachScopeAndLastParent.process(scope, prevParent)) return false;
if (scope == maxScope) break;
prevParent = scope;
scope = prevParent.getContext();
}
return true;
}
示例5: QuerySearchRequest
import com.intellij.util.PairProcessor; //导入方法依赖的package包/类
public QuerySearchRequest(@NotNull Query<PsiReference> query,
@NotNull final SearchRequestCollector collector,
boolean inReadAction,
@NotNull final PairProcessor<PsiReference, SearchRequestCollector> processor) {
this.query = query;
this.collector = collector;
if (inReadAction) {
this.processor = new ReadActionProcessor<PsiReference>() {
@Override
public boolean processInReadAction(PsiReference psiReference) {
return processor.process(psiReference, collector);
}
};
}
else {
this.processor = new Processor<PsiReference>() {
@Override
public boolean process(PsiReference psiReference) {
return processor.process(psiReference, collector);
}
};
}
}
示例6: getSimiliar
import com.intellij.util.PairProcessor; //导入方法依赖的package包/类
public void getSimiliar(final Key key, final PairProcessor<Key, Val> consumer) {
final int idx = Collections.binarySearch(myKeys, key, myComparator);
if (idx < 0) {
final int insertionIdx = - idx - 1;
// take item before
final int itemBeforeIdx = insertionIdx - 1;
if (itemBeforeIdx >= 0) {
for (ListIterator<Key> iterator = myKeys.listIterator(itemBeforeIdx + 1); iterator.hasPrevious(); ) {
final Key candidate = iterator.previous();
if (! myKeysResemblance.process(candidate, key)) continue;
if (consumer.process(candidate, myMap.get(candidate))) break; // if need only a part of keys
}
}
} else {
consumer.process(key, myMap.get(key));
}
}
示例7: optimizeMap
import com.intellij.util.PairProcessor; //导入方法依赖的package包/类
public void optimizeMap(final PairProcessor<Val, Val> valuesAreas) {
int i = 0;
for (Iterator<Key> iterator = myKeys.iterator(); iterator.hasNext();) {
final Key key = iterator.next();
final Val value = myMap.get(key);
// go for parents
for (int j = i - 1; j >= 0; -- j) {
final Key innerKey = myKeys.get(j);
if (myKeysResemblance.process(innerKey, key)) {
if (valuesAreas.process(myMap.get(innerKey), value)) {
-- i;
iterator.remove();
myMap.remove(key);
}
// otherwise we found a "parent", and do not remove the child
break;
}
}
++ i;
}
}
示例8: chooseBetweenHostAndInjected
import com.intellij.util.PairProcessor; //导入方法依赖的package包/类
@Nullable
public static Pair<PsiFile,Editor> chooseBetweenHostAndInjected(@NotNull PsiFile hostFile, @NotNull Editor hostEditor, @NotNull PairProcessor<PsiFile, Editor> predicate) {
Editor editorToApply = null;
PsiFile fileToApply = null;
int offset = hostEditor.getCaretModel().getOffset();
PsiFile injectedFile = InjectedLanguageUtil.findInjectedPsiNoCommit(hostFile, offset);
if (injectedFile != null) {
Editor injectedEditor = InjectedLanguageUtil.getInjectedEditorForInjectedFile(hostEditor, injectedFile);
if (predicate.process(injectedFile, injectedEditor)) {
editorToApply = injectedEditor;
fileToApply = injectedFile;
}
}
if (editorToApply == null && predicate.process(hostFile, hostEditor)) {
editorToApply = hostEditor;
fileToApply = hostFile;
}
if (editorToApply == null) return null;
return Pair.create(fileToApply, editorToApply);
}
示例9: processTags
import com.intellij.util.PairProcessor; //导入方法依赖的package包/类
private static void processTags(@NotNull Project project,
@Nullable String templateText,
@NotNull PairProcessor<XmlTag, Boolean> processor) {
if (StringUtil.isNotEmpty(templateText)) {
final PsiFileFactory psiFileFactory = PsiFileFactory.getInstance(project);
XmlFile xmlFile = (XmlFile)psiFileFactory.createFileFromText("dummy.xml", StdFileTypes.HTML, templateText);
XmlTag tag = xmlFile.getRootTag();
boolean firstTag = true;
while (tag != null) {
processor.process(tag, firstTag);
firstTag = false;
tag = PsiTreeUtil.getNextSiblingOfType(tag, XmlTag.class);
}
}
}
示例10: filterTree
import com.intellij.util.PairProcessor; //导入方法依赖的package包/类
static SliceNode filterTree(SliceNode oldRoot, NullableFunction<SliceNode, SliceNode> filter, PairProcessor<SliceNode, List<SliceNode>> postProcessor){
SliceNode filtered = filter.fun(oldRoot);
if (filtered == null) return null;
List<SliceNode> childrenFiltered = new ArrayList<SliceNode>();
if (oldRoot.myCachedChildren != null) {
for (SliceNode child : oldRoot.myCachedChildren) {
SliceNode childFiltered = filterTree(child, filter,postProcessor);
if (childFiltered != null) {
childrenFiltered.add(childFiltered);
}
}
}
boolean success = postProcessor == null || postProcessor.process(filtered, childrenFiltered);
if (!success) return null;
filtered.myCachedChildren = new ArrayList<SliceNode>(childrenFiltered);
return filtered;
}
示例11: processParameters
import com.intellij.util.PairProcessor; //导入方法依赖的package包/类
public boolean processParameters(final PairProcessor<String, Object> processor) {
for (Class aClass = getClass(); aClass != null; aClass = ReflectionCache.getSuperClass(aClass)) {
for (final Field field : aClass.getDeclaredFields()) {
if (!Modifier.isStatic(field.getModifiers()) &&
(((field.getModifiers() & 0x1000 /*Modifer.SYNTHETIC*/) == 0 && !aClass.equals(PatternCondition.class))
|| field.getName().startsWith(PARAMETER_FIELD_PREFIX))) {
final String name = field.getName();
final String fixedName = name.startsWith(PARAMETER_FIELD_PREFIX) ?
name.substring(PARAMETER_FIELD_PREFIX.length()) : name;
final Object value = getFieldValue(field);
if (!processor.process(fixedName, value)) return false;
}
}
}
return true;
}
示例12: QuerySearchRequest
import com.intellij.util.PairProcessor; //导入方法依赖的package包/类
public QuerySearchRequest(@NotNull Query<PsiReference> query,
@NotNull final SearchRequestCollector collector,
boolean inReadAction,
@NotNull final PairProcessor<PsiReference, SearchRequestCollector> processor) {
this.query = query;
this.collector = collector;
if (inReadAction) {
this.processor = new ReadActionProcessor<PsiReference>() {
@Override
public boolean processInReadAction(PsiReference psiReference) {
return processor.process(psiReference, collector);
}
};
} else {
this.processor = new Processor<PsiReference>() {
@Override
public boolean process(PsiReference psiReference) {
return processor.process(psiReference, collector);
}
};
}
}
示例13: treeWalkUp
import com.intellij.util.PairProcessor; //导入方法依赖的package包/类
public static boolean treeWalkUp(@Nonnull final PsiElement entrance,
@Nullable final PsiElement maxScope,
PairProcessor<PsiElement, PsiElement> eachScopeAndLastParent) {
PsiElement prevParent = null;
PsiElement scope = entrance;
while (scope != null) {
if (!eachScopeAndLastParent.process(scope, prevParent)) return false;
if (scope == maxScope) break;
prevParent = scope;
scope = prevParent.getContext();
}
return true;
}
示例14: QuerySearchRequest
import com.intellij.util.PairProcessor; //导入方法依赖的package包/类
public QuerySearchRequest(Query<PsiReference> query,
final SearchRequestCollector collector,
boolean inReadAction, final PairProcessor<PsiReference, SearchRequestCollector> processor) {
this.query = query;
this.collector = collector;
if (inReadAction) {
this.processor = new ReadActionProcessor<PsiReference>() {
@RequiredReadAction
@Override
public boolean processInReadAction(PsiReference psiReference) {
return processor.process(psiReference, collector);
}
};
} else {
this.processor = new Processor<PsiReference>() {
@Override
public boolean process(PsiReference psiReference) {
return processor.process(psiReference, collector);
}
};
}
}
示例15: chooseBetweenHostAndInjected
import com.intellij.util.PairProcessor; //导入方法依赖的package包/类
@Nullable
public static Pair<PsiFile, Editor> chooseBetweenHostAndInjected(@Nonnull PsiFile hostFile,
@Nonnull Editor hostEditor,
@Nonnull PairProcessor<PsiFile, Editor> predicate) {
Editor editorToApply = null;
PsiFile fileToApply = null;
int offset = hostEditor.getCaretModel().getOffset();
PsiFile injectedFile = InjectedLanguageUtil.findInjectedPsiNoCommit(hostFile, offset);
if (injectedFile != null) {
Editor injectedEditor = InjectedLanguageUtil.getInjectedEditorForInjectedFile(hostEditor, injectedFile);
if (predicate.process(injectedFile, injectedEditor)) {
editorToApply = injectedEditor;
fileToApply = injectedFile;
}
}
if (editorToApply == null && predicate.process(hostFile, hostEditor)) {
editorToApply = hostEditor;
fileToApply = hostFile;
}
if (editorToApply == null) return null;
return Pair.create(fileToApply, editorToApply);
}