本文整理汇总了Java中com.intellij.openapi.util.Condition.value方法的典型用法代码示例。如果您正苦于以下问题:Java Condition.value方法的具体用法?Java Condition.value怎么用?Java Condition.value使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.util.Condition
的用法示例。
在下文中一共展示了Condition.value方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: patchMethodGetClassReturnType
import com.intellij.openapi.util.Condition; //导入方法依赖的package包/类
public static PsiType patchMethodGetClassReturnType(@NotNull PsiExpression call,
@NotNull PsiReferenceExpression methodExpression,
@NotNull PsiMethod method,
@Nullable Condition<IElementType> condition,
@NotNull LanguageLevel languageLevel) {
//JLS3 15.8.2
if (languageLevel.isAtLeast(LanguageLevel.JDK_1_5) && isGetClass(method)) {
PsiExpression qualifier = methodExpression.getQualifierExpression();
PsiType qualifierType = null;
final Project project = call.getProject();
if (qualifier != null) {
qualifierType = TypeConversionUtil.erasure(qualifier.getType());
}
else if (condition != null) {
ASTNode parent = call.getNode().getTreeParent();
while (parent != null && condition.value(parent.getElementType())) {
parent = parent.getTreeParent();
}
if (parent != null) {
qualifierType = JavaPsiFacade.getInstance(project).getElementFactory().createType((PsiClass)parent.getPsi());
}
}
return createJavaLangClassType(methodExpression, qualifierType, true);
}
return null;
}
示例2: createGroup
import com.intellij.openapi.util.Condition; //导入方法依赖的package包/类
public KeymapGroup createGroup(final Condition<AnAction> filtered, final Project project) {
ActionManager actionManager = ActionManager.getInstance();
DefaultActionGroup debuggerGroup = (DefaultActionGroup)actionManager.getActionOrStub(IdeActions.GROUP_DEBUGGER);
AnAction[] debuggerActions = debuggerGroup.getChildActionsOrStubs();
ArrayList<String> ids = new ArrayList<String>();
for (AnAction debuggerAction : debuggerActions) {
String actionId = debuggerAction instanceof ActionStub ? ((ActionStub)debuggerAction).getId() : actionManager.getId(debuggerAction);
if (filtered == null || filtered.value(debuggerAction)) {
ids.add(actionId);
}
}
Collections.sort(ids);
Group group = new Group(KeyMapBundle.message("debugger.actions.group.title"), IdeActions.GROUP_DEBUGGER, null);
for (String id : ids) {
group.addActionId(id);
}
return group;
}
示例3: createClassLookupItems
import com.intellij.openapi.util.Condition; //导入方法依赖的package包/类
public static List<JavaPsiClassReferenceElement> createClassLookupItems(final PsiClass psiClass,
boolean withInners,
InsertHandler<JavaPsiClassReferenceElement> insertHandler,
Condition<PsiClass> condition) {
List<JavaPsiClassReferenceElement> result = new SmartList<JavaPsiClassReferenceElement>();
if (condition.value(psiClass)) {
result.add(AllClassesGetter.createLookupItem(psiClass, insertHandler));
}
String name = psiClass.getName();
if (withInners && name != null) {
for (PsiClass inner : psiClass.getInnerClasses()) {
if (inner.hasModifierProperty(PsiModifier.STATIC)) {
for (JavaPsiClassReferenceElement lookupInner : createClassLookupItems(inner, true, insertHandler, condition)) {
String forced = lookupInner.getForcedPresentableName();
String qualifiedName = name + "." + (forced != null ? forced : inner.getName());
lookupInner.setForcedPresentableName(qualifiedName);
lookupInner.setLookupString(qualifiedName);
result.add(lookupInner);
}
}
}
}
return result;
}
示例4: populateOrderEntries
import com.intellij.openapi.util.Condition; //导入方法依赖的package包/类
private static void populateOrderEntries(@NotNull Module module, Condition<Library> condition, ArrayList<Library> libraries, boolean exportedOnly, Set<Module> visited) {
if (!visited.add(module)) {
return;
}
for (OrderEntry entry : ModuleRootManager.getInstance(module).getOrderEntries()) {
if (entry instanceof LibraryOrderEntry) {
LibraryOrderEntry libEntry = (LibraryOrderEntry)entry;
if (exportedOnly && !libEntry.isExported()) {
continue;
}
Library library = libEntry.getLibrary();
if (condition.value(library)) {
libraries.add(library);
}
}
else if (entry instanceof ModuleOrderEntry) {
final Module dep = ((ModuleOrderEntry)entry).getModule();
if (dep != null) {
populateOrderEntries(dep, condition, libraries, true, visited);
}
}
}
}
示例5: isBackpointerReference
import com.intellij.openapi.util.Condition; //导入方法依赖的package包/类
public static boolean isBackpointerReference(PsiExpression expression, Condition<PsiField> value) {
if (expression instanceof PsiParenthesizedExpression) {
final PsiExpression contents = ((PsiParenthesizedExpression)expression).getExpression();
return isBackpointerReference(contents, value);
}
if (!(expression instanceof PsiReferenceExpression)) {
return false;
}
final PsiReferenceExpression reference = (PsiReferenceExpression)expression;
final PsiElement qualifier = reference.getQualifier();
if (qualifier != null && !(qualifier instanceof PsiThisExpression)) {
return false;
}
final PsiElement referent = reference.resolve();
return referent instanceof PsiField && value.value((PsiField)referent);
}
示例6: createQuickListsGroup
import com.intellij.openapi.util.Condition; //导入方法依赖的package包/类
private static Group createQuickListsGroup(final Condition<AnAction> filtered, final String filter, final boolean forceFiltering, final QuickList[] quickLists) {
Arrays.sort(quickLists, new Comparator<QuickList>() {
public int compare(QuickList l1, QuickList l2) {
return l1.getActionId().compareTo(l2.getActionId());
}
});
Group group = new Group(KeyMapBundle.message("quick.lists.group.title"), null, null);
for (QuickList quickList : quickLists) {
if (filtered != null && filtered.value(ActionManagerEx.getInstanceEx().getAction(quickList.getActionId()))) {
group.addQuickList(quickList);
} else if (SearchUtil.isComponentHighlighted(quickList.getName(), filter, forceFiltering, null)) {
group.addQuickList(quickList);
} else if (filtered == null && StringUtil.isEmpty(filter)) {
group.addQuickList(quickList);
}
}
return group;
}
示例7: addChildAfter
import com.intellij.openapi.util.Condition; //导入方法依赖的package包/类
public static void addChildAfter(final Element parent, final Element child, final Condition<Element> filter, boolean addFirstIfNotFound) {
List list = parent.getContent();
for (int i = 0; i < list.size(); i++) {
Object o = list.get(i);
if (o instanceof Element && filter.value((Element)o)) {
if (i < list.size() - 1) {
parent.addContent(i + 1, child);
}
else {
parent.addContent(child);
}
return;
}
}
if (addFirstIfNotFound) {
parent.addContent(0, child);
}
}
示例8: createAddActions
import com.intellij.openapi.util.Condition; //导入方法依赖的package包/类
public void createAddActions(DefaultActionGroup group,
final JComponent parent,
final Consumer<Sdk> updateTree,
@Nullable Condition<SdkTypeId> filter) {
final SdkType[] types = SdkType.getAllTypes();
for (final SdkType type : types) {
if (filter != null && !filter.value(type)) continue;
final AnAction addAction = new DumbAwareAction(type.getPresentableName(), null, type.getIconForAddAction()) {
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
doAdd(parent, type, updateTree);
}
};
group.add(addAction);
}
}
示例9: divideInsideAndOutside
import com.intellij.openapi.util.Condition; //导入方法依赖的package包/类
public static void divideInsideAndOutside(@NotNull PsiFile file,
int startOffset,
int endOffset,
@NotNull TextRange range,
@NotNull List<PsiElement> inside,
@NotNull List<ProperTextRange> insideRanges,
@NotNull List<PsiElement> outside,
@NotNull List<ProperTextRange> outsideRanges,
boolean includeParents,
@NotNull Condition<PsiFile> filter) {
final FileViewProvider viewProvider = file.getViewProvider();
for (Language language : viewProvider.getLanguages()) {
final PsiFile psiRoot = viewProvider.getPsi(language);
if (filter.value(psiRoot)) {
divideInsideAndOutside(psiRoot, startOffset, endOffset, range, inside, insideRanges, outside, outsideRanges, includeParents);
}
}
}
示例10: findTransition
import com.intellij.openapi.util.Condition; //导入方法依赖的package包/类
@Nullable
public Transition findTransition(@NonNull Condition<Transition> condition) {
for (Transition transition : getTransitions()) {
if (condition.value(transition)) {
return transition;
}
}
return null;
}
示例11: getDefaultOptionIndexFromSelectCondition
import com.intellij.openapi.util.Condition; //导入方法依赖的package包/类
private static int getDefaultOptionIndexFromSelectCondition(@Nullable Condition<AnAction> preselectActionCondition,
@NotNull List<ActionItem> items) {
int defaultOptionIndex = 0;
if (preselectActionCondition != null) {
for (int i = 0; i < items.size(); i++) {
final AnAction action = items.get(i).getAction();
if (preselectActionCondition.value(action)) {
defaultOptionIndex = i;
break;
}
}
}
return defaultOptionIndex;
}
示例12: updateRemoveButton
import com.intellij.openapi.util.Condition; //导入方法依赖的package包/类
public void updateRemoveButton(JButton button, Condition<T> removable) {
final JTable table = getComponent();
final ListSelectionModel selectionModel = table.getSelectionModel();
boolean enable = false;
if (!selectionModel.isSelectionEmpty()) {
enable = true;
for (int i : table.getSelectedRows()) {
if (!removable.value(myModel.getItems().get(i))) {
enable = false;
break;
}
}
}
button.setEnabled(enable);
}
示例13: showDiffForChange
import com.intellij.openapi.util.Condition; //导入方法依赖的package包/类
public static void showDiffForChange(@Nullable Project project,
@NotNull Iterable<Change> changes,
@NotNull Condition<Change> condition,
@NotNull ShowDiffContext context) {
int index = 0;
List<ChangeDiffRequestProducer> presentables = new ArrayList<ChangeDiffRequestProducer>();
for (Change change : changes) {
if (condition.value(change)) index = presentables.size();
ChangeDiffRequestProducer presentable = ChangeDiffRequestProducer.create(project, change, context.getChangeContext(change));
if (presentable != null) presentables.add(presentable);
}
showDiffForChange(project, presentables, index, context);
}
示例14: getAlignment
import com.intellij.openapi.util.Condition; //导入方法依赖的package包/类
private Alignment getAlignment(ASTNode node) {
IElementType elementType = node.getElementType();
Condition<ASTNode> noneAlignmentCondition = myNoneAlignmentCondition.get(elementType);
if (noneAlignmentCondition != null && noneAlignmentCondition.value(node)) {
return null;
}
Alignment alignment = myAlignments.get(elementType);
if (alignment == null) {
return myDefaultAlignment;
}
return alignment == NO_ALIGNMENT ? null : alignment;
}
示例15: findMostRecentSdk
import com.intellij.openapi.util.Condition; //导入方法依赖的package包/类
@Nullable
public Sdk findMostRecentSdk(Condition<Sdk> condition) {
Sdk found = null;
for (Sdk each : getAllJdks()) {
if (!condition.value(each)) continue;
if (found == null) {
found = each;
continue;
}
if (Comparing.compare(each.getVersionString(), found.getVersionString()) > 0) found = each;
}
return found;
}