當前位置: 首頁>>代碼示例>>Java>>正文


Java Condition.value方法代碼示例

本文整理匯總了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;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:27,代碼來源:PsiTypesUtil.java

示例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;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:22,代碼來源:DebuggerKeymapExtension.java

示例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;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:25,代碼來源:JavaClassNameCompletionContributor.java

示例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);
      }
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:26,代碼來源:LibrariesUtil.java

示例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);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:17,代碼來源:BackpointerUtil.java

示例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;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:20,代碼來源:ActionsTreeUtil.java

示例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);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:19,代碼來源:JDomConvertingUtil.java

示例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);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:17,代碼來源:ProjectSdksModel.java

示例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);
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:19,代碼來源:Divider.java

示例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;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:10,代碼來源:NavigationModel.java

示例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;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:15,代碼來源:PopupFactoryImpl.java

示例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);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:16,代碼來源:UIPropertyBinding.java

示例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);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:15,代碼來源:ShowDiffAction.java

示例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;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:15,代碼來源:ChildrenBlocksBuilder.java

示例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;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:14,代碼來源:ProjectJdkTable.java


注:本文中的com.intellij.openapi.util.Condition.value方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。