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


Java Conditions类代码示例

本文整理汇总了Java中com.intellij.openapi.util.Conditions的典型用法代码示例。如果您正苦于以下问题:Java Conditions类的具体用法?Java Conditions怎么用?Java Conditions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: checkQualifier

import com.intellij.openapi.util.Conditions; //导入依赖的package包/类
private static boolean checkQualifier(PsiElement qualifier) {
  if (qualifier == null) {
    return true;
  }
  final Condition<PsiElement> callExpressionCondition = Conditions.instanceOf(PsiCallExpression.class);
  final Condition<PsiElement> nonFinalFieldRefCondition = new Condition<PsiElement>() {
    @Override
    public boolean value(PsiElement expression) {
      if (expression instanceof PsiReferenceExpression) {
        PsiElement element = ((PsiReferenceExpression)expression).resolve();
        if (element instanceof PsiField && !((PsiField)element).hasModifierProperty(PsiModifier.FINAL)) {
          return true;
        }
      }
      return false;
    }
  };
  return SyntaxTraverser
    .psiTraverser()
    .withRoot(qualifier)
    .filter(Conditions.or(callExpressionCondition, nonFinalFieldRefCondition)).toList().isEmpty();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:LambdaCanBeMethodReferenceInspection.java

示例2: parseFalseGetters

import com.intellij.openapi.util.Conditions; //导入依赖的package包/类
private static Condition<String> parseFalseGetters() {
  try {
    String regex = Registry.stringValue("ide.dfa.getters.with.side.effects").trim();
    if (!StringUtil.isEmpty(regex)) {
      final Pattern pattern = Pattern.compile(regex);
      return new Condition<String>() {
        @Override
        public boolean value(String s) {
          return pattern.matcher(s).matches();
        }
      };
    }
  }
  catch (Exception e) {
    LOG.error(e);
  }
  return Conditions.alwaysFalse();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:DfaExpressionFactory.java

示例3: createActions

import com.intellij.openapi.util.Conditions; //导入依赖的package包/类
@Override
@Nullable
protected ArrayList<AnAction> createActions(final boolean fromPopup) {
  if (myProjectJdksModel == null) {
    return null;
  }
  final ArrayList<AnAction> actions = new ArrayList<AnAction>();
  DefaultActionGroup group = new DefaultActionGroup(ProjectBundle.message("add.new.jdk.text"), true);
  group.getTemplatePresentation().setIcon(IconUtil.getAddIcon());
  myProjectJdksModel.createAddActions(group, myTree, new Consumer<Sdk>() {
    @Override
    public void consume(final Sdk projectJdk) {
      addNode(new MyNode(new JdkConfigurable(((ProjectJdkImpl)projectJdk), myProjectJdksModel, TREE_UPDATER, myHistory, myProject), false), myRoot);
      selectNodeInTree(findNodeByObject(myRoot, projectJdk));
    }
  });
  actions.add(new MyActionGroupWrapper(group));
  actions.add(new MyDeleteAction(Conditions.<Object[]>alwaysTrue()));
  return actions;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ProjectJdksConfigurable.java

示例4: invalidateToSelectWithRefsToParent

import com.intellij.openapi.util.Conditions; //导入依赖的package包/类
private void invalidateToSelectWithRefsToParent(DefaultMutableTreeNode actionNode) {
  if (actionNode != null) {
    Object readyElement = myUi.getElementFor(actionNode);
    if (readyElement != null) {
      Iterator<Object> toSelect = myToSelect.keySet().iterator();
      while (toSelect.hasNext()) {
        Object eachToSelect = toSelect.next();
        if (readyElement.equals(myUi.getTreeStructure().getParentElement(eachToSelect))) {
          List<Object> children = myUi.getLoadedChildrenFor(readyElement);
          if (!children.contains(eachToSelect)) {
            toSelect.remove();
            if (!myToSelect.containsKey(readyElement) && !myUi.getSelectedElements().contains(eachToSelect)) {
              addAdjustedSelection(eachToSelect, Conditions.alwaysFalse(), null);
            }
          }
        }
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:UpdaterTreeState.java

示例5: getContainedInBranchCondition

import com.intellij.openapi.util.Conditions; //导入依赖的package包/类
@NotNull
public Condition<Hash> getContainedInBranchCondition(@NotNull final String branchName, @NotNull final VirtualFile root) {
  LOG.assertTrue(EventQueue.isDispatchThread());
  if (myRefs == null || myGraph == null) return Conditions.alwaysFalse();
  VcsRef branchRef = ContainerUtil.find(myRefs.getBranches(), new Condition<VcsRef>() {
    @Override
    public boolean value(VcsRef vcsRef) {
      return vcsRef.getRoot().equals(root) && vcsRef.getName().equals(branchName);
    }
  });
  if (branchRef == null) return Conditions.alwaysFalse();
  ContainedInBranchCondition condition = myConditions.get(root);
  if (condition == null || !condition.getBranch().equals(branchName)) {
    condition =
      new ContainedInBranchCondition(myGraph.getContainedInBranchCondition(Collections.singleton(myDataHolder.getCommitIndex(branchRef.getCommitHash()))),
                        branchName);
    myConditions.put(root, condition);
  }
  return condition;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ContainingBranchesGetter.java

示例6: inspectEx

import com.intellij.openapi.util.Conditions; //导入依赖的package包/类
@NotNull
public static Map<String, List<ProblemDescriptor>> inspectEx(@NotNull final List<LocalInspectionToolWrapper> toolWrappers,
                                                             @NotNull final PsiFile file,
                                                             @NotNull final InspectionManager iManager,
                                                             final boolean isOnTheFly,
                                                             boolean failFastOnAcquireReadAction,
                                                             @NotNull final ProgressIndicator indicator) {
  if (toolWrappers.isEmpty()) return Collections.emptyMap();
  final List<PsiElement> elements = new ArrayList<PsiElement>();

  TextRange range = file.getTextRange();
  Divider.divideInsideAndOutside(file, range.getStartOffset(), range.getEndOffset(), range, elements, new ArrayList<ProperTextRange>(),
                                 Collections.<PsiElement>emptyList(), Collections.<ProperTextRange>emptyList(), true, Conditions.<PsiFile>alwaysTrue());

  return inspectElements(toolWrappers, file, iManager, isOnTheFly, failFastOnAcquireReadAction, indicator, elements,
                         calcElementDialectIds(elements));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:InspectionEngine.java

示例7: initComponents

import com.intellij.openapi.util.Conditions; //导入依赖的package包/类
@Override
protected void initComponents()
{
	myModuleBox = new ComboBox();
	myModuleBox.setRenderer(new ModuleListCellRenderer());

	myVmParametersComponent = LabeledComponent.create(new RawCommandLineEditor(), "VM arguments");
	myVmParametersComponent.setLabelLocation(BorderLayout.WEST);
	copyDialogCaption(myVmParametersComponent);

	myUseAlternativeBundleCheckBox = new JCheckBox("Use alternative bundle: ");
	ProjectSdksModel projectSdksModel = new ProjectSdksModel();
	projectSdksModel.reset();

	myAlternativeBundleComboBox = new SdkComboBox(projectSdksModel, Conditions.<SdkTypeId>is(NodeJSBundleType.getInstance()), true);
	myAlternativeBundleComboBox.setEnabled(false);
	myUseAlternativeBundleCheckBox.addItemListener(new ItemListener()
	{
		@Override
		public void itemStateChanged(ItemEvent e)
		{
			myAlternativeBundleComboBox.setEnabled(myUseAlternativeBundleCheckBox.isSelected());
		}
	});
	super.initComponents();
}
 
开发者ID:consulo,项目名称:consulo-nodejs,代码行数:27,代码来源:NodeJSConfigurationPanelBase.java

示例8: createActions

import com.intellij.openapi.util.Conditions; //导入依赖的package包/类
@Override
@Nullable
protected ArrayList<AnAction> createActions(final boolean fromPopup) {
  final ArrayList<AnAction> actions = new ArrayList<AnAction>();
  DefaultActionGroup group = new DefaultActionGroup(ProjectBundle.message("add.new.jdk.text"), true);
  group.getTemplatePresentation().setIcon(IconUtil.getAddIcon());
  myProjectJdksModel.createAddActions(group, myTree, new Consumer<Sdk>() {
    @Override
    public void consume(final Sdk projectJdk) {
      addNode(new MyNode(new JdkConfigurable(((ProjectJdkImpl)projectJdk), myProjectJdksModel, TREE_UPDATER, myHistory, myProject), false), myRoot);
      selectNodeInTree(findNodeByObject(myRoot, projectJdk));
    }
  });
  actions.add(new MyActionGroupWrapper(group));
  actions.add(new MyDeleteAction(Conditions.<Object[]>alwaysTrue()));
  return actions;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:ProjectJdksConfigurable.java

示例9: createActions

import com.intellij.openapi.util.Conditions; //导入依赖的package包/类
@Override
@Nullable
protected ArrayList<AnAction> createActions(boolean fromPopup) {
    ArrayList<AnAction> result = new ArrayList<AnAction>();
    result.add(new AnAction("Add", "Add", IconUtil.getAddIcon()) {
        {
            registerCustomShortcutSet(CommonShortcuts.INSERT, myTree);
        }

        public void actionPerformed(AnActionEvent event) {
            final VirtualFile sdk = NuxeoSDKChooser.chooseNuxeoSDK(project);
            if (sdk == null)
                return;

            final String name = askForNuxeoSDKName("Register Nuxeo SDK", "");
            if (name == null)
                return;
            final NuxeoSDK nuxeoSDK = new NuxeoSDK(name, sdk.getPath());
            addNuxeoSDKNode(nuxeoSDK);
        }
    });
    result.add(new MyDeleteAction(forAll(Conditions.alwaysTrue())));
    return result;
}
 
开发者ID:troger,项目名称:nuxeo-intellij,代码行数:25,代码来源:NuxeoSDKsPanel.java

示例10: createEditor

import com.intellij.openapi.util.Conditions; //导入依赖的package包/类
@NotNull
@Override
protected JComponent createEditor()
{
	JPanel verticalLayout = new JPanel(new VerticalFlowLayout(0, 0));

	ProjectSdksModel model = new ProjectSdksModel();
	model.reset();

	myBundleBox = new SdkComboBox(model, Conditions.equalTo(myBundleType), true);
	verticalLayout.add(LabeledComponent.left(myBundleBox, J2EEBundle.message("label.run.configuration.properties.application.server")));

	JPanel openBrowserPanel = new JPanel();
	openBrowserPanel.setBorder(IdeBorderFactory.createTitledBorder("Open browser"));
	verticalLayout.add(openBrowserPanel);

	if(myBundleType.isJreCustomizable())
	{
		AlternativeJREPanel panel = new AlternativeJREPanel();
		verticalLayout.add(panel);
	}

	verticalLayout.add(mySettingsWrapper);

	return verticalLayout;
}
 
开发者ID:consulo,项目名称:consulo-javaee,代码行数:27,代码来源:JavaEEServerConfigurationEditor.java

示例11: inspectEx

import com.intellij.openapi.util.Conditions; //导入依赖的package包/类
@Nonnull
public static Map<String, List<ProblemDescriptor>> inspectEx(@Nonnull final List<LocalInspectionToolWrapper> toolWrappers,
                                                             @Nonnull final PsiFile file,
                                                             @Nonnull final InspectionManager iManager,
                                                             final boolean isOnTheFly,
                                                             boolean failFastOnAcquireReadAction,
                                                             @Nonnull final ProgressIndicator indicator) {
  if (toolWrappers.isEmpty()) return Collections.emptyMap();


  TextRange range = file.getTextRange();
  List<Divider.DividedElements> allDivided = new ArrayList<>();
  Divider.divideInsideAndOutsideAllRoots(file, range, range, Conditions.alwaysTrue(), new CommonProcessors.CollectProcessor<>(allDivided));

  List<PsiElement> elements = ContainerUtil.concat(
          (List<List<PsiElement>>)ContainerUtil.map(allDivided, d -> ContainerUtil.concat(d.inside, d.outside, d.parents)));

  return inspectElements(toolWrappers, file, iManager, isOnTheFly, failFastOnAcquireReadAction, indicator, elements,
                         calcElementDialectIds(elements));
}
 
开发者ID:consulo,项目名称:consulo,代码行数:21,代码来源:InspectionEngine.java

示例12: getContainedInBranchCondition

import com.intellij.openapi.util.Conditions; //导入依赖的package包/类
@Nonnull
public Condition<CommitId> getContainedInBranchCondition(@Nonnull final String branchName, @Nonnull final VirtualFile root) {
  LOG.assertTrue(EventQueue.isDispatchThread());

  DataPack dataPack = myLogData.getDataPack();
  if (dataPack == DataPack.EMPTY) return Conditions.alwaysFalse();

  PermanentGraph<Integer> graph = dataPack.getPermanentGraph();
  VcsLogRefs refs = dataPack.getRefsModel();

  ContainedInBranchCondition condition = myConditions.get(root);
  if (condition == null || !condition.getBranch().equals(branchName)) {
    VcsRef branchRef = ContainerUtil.find(refs.getBranches(),
                                          vcsRef -> vcsRef.getRoot().equals(root) && vcsRef.getName().equals(branchName));
    if (branchRef == null) return Conditions.alwaysFalse();
    condition = new ContainedInBranchCondition(graph.getContainedInBranchCondition(
      Collections.singleton(myLogData.getCommitIndex(branchRef.getCommitHash(), branchRef.getRoot()))), branchName);
    myConditions.put(root, condition);
  }
  return condition;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:22,代码来源:ContainingBranchesGetter.java

示例13: getStyle

import com.intellij.openapi.util.Conditions; //导入依赖的package包/类
@Nonnull
@Override
public VcsCommitStyle getStyle(@Nonnull VcsShortCommitDetails details, boolean isSelected) {
  if (isSelected || !myLogUi.isHighlighterEnabled(Factory.ID)) return VcsCommitStyle.DEFAULT;
  Condition<CommitId> condition = myConditions.get(details.getRoot());
  if (condition == null) {
    VcsLogProvider provider = myLogData.getLogProvider(details.getRoot());
    String currentBranch = provider.getCurrentBranch(details.getRoot());
    if (!HEAD.equals(mySingleFilteredBranch) && currentBranch != null && !(currentBranch.equals(mySingleFilteredBranch))) {
      condition = myLogData.getContainingBranchesGetter().getContainedInBranchCondition(currentBranch, details.getRoot());
      myConditions.put(details.getRoot(), condition);
    }
    else {
      condition = Conditions.alwaysFalse();
    }
  }
  if (condition != null && condition.value(new CommitId(details.getId(), details.getRoot()))) {
    return VcsCommitStyleFactory.background(CURRENT_BRANCH_BG);
  }
  return VcsCommitStyle.DEFAULT;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:22,代码来源:CurrentBranchHighlighter.java

示例14: getData

import com.intellij.openapi.util.Conditions; //导入依赖的package包/类
@Override
public Object getData(@Nonnull @NonNls Key<?> dataId) {
  if (CommonDataKeys.PROJECT == dataId) {
    return myProject;
  }
  else if (VcsDataKeys.VCS_VIRTUAL_FILE == dataId) {
    return myFile;
  }
  else if (VcsDataKeys.VCS_FILE_REVISION == dataId) {
    VcsFileRevision selectedObject = myList.getSelectedObject();
    return selectedObject instanceof CurrentRevision ? null : selectedObject;
  }
  else if (VcsDataKeys.VCS_FILE_REVISIONS == dataId) {
    List<VcsFileRevision> revisions = ContainerUtil.filter(myList.getSelectedObjects(), Conditions.notEqualTo(myLocalRevision));
    return ArrayUtil.toObjectArray(revisions, VcsFileRevision.class);
  }
  else if (VcsDataKeys.VCS == dataId) {
    return myActiveVcs.getKeyInstanceMethod();
  }
  else if (PlatformDataKeys.HELP_ID == dataId) {
    return myHelpId;
  }
  return null;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:25,代码来源:VcsSelectionHistoryDialog.java

示例15: createActions

import com.intellij.openapi.util.Conditions; //导入依赖的package包/类
@Override
@Nullable
protected ArrayList<AnAction> createActions(final boolean fromPopup) {
  final ArrayList<AnAction> actions = new ArrayList<AnAction>();
  DefaultActionGroup group = new DefaultActionGroup(ProjectBundle.message("add.action.name"), true);
  group.getTemplatePresentation().setIcon(IconUtil.getAddIcon());
  myProjectSdksModel.createAddActions(group, myTree, new Consumer<Sdk>() {
    @Override
    public void consume(final Sdk projectJdk) {
      addNode(new MyNode(new SdkConfigurable(((SdkImpl)projectJdk), myProjectSdksModel, TREE_UPDATER, myHistory, myProject), false), myRoot);
      selectNodeInTree(findNodeByObject(myRoot, projectJdk));
    }
  }, SdkListConfigurable.ADD_SDK_FILTER);
  actions.add(new MyActionGroupWrapper(group));
  actions.add(new MyDeleteAction(forAll(Conditions.alwaysTrue())));
  return actions;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:SdksConfigurable.java


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