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


Java NotNullFunction.fun方法代码示例

本文整理汇总了Java中com.intellij.util.NotNullFunction.fun方法的典型用法代码示例。如果您正苦于以下问题:Java NotNullFunction.fun方法的具体用法?Java NotNullFunction.fun怎么用?Java NotNullFunction.fun使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.util.NotNullFunction的用法示例。


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

示例1: updateExtensionTabs

import com.intellij.util.NotNullFunction; //导入方法依赖的package包/类
private void updateExtensionTabs() {
  final ChangesViewContentEP[] contentEPs = myProject.getExtensions(ChangesViewContentEP.EP_NAME);
  for(ChangesViewContentEP ep: contentEPs) {
    final NotNullFunction<Project,Boolean> predicate = ep.newPredicateInstance(myProject);
    if (predicate == null) continue;
    Content epContent = findEPContent(ep);
    final Boolean predicateResult = predicate.fun(myProject);
    if (predicateResult.equals(Boolean.TRUE) && epContent == null) {
      addExtensionTab(ep);
    }
    else if (predicateResult.equals(Boolean.FALSE) && epContent != null) {
      if (!(epContent.getComponent() instanceof ContentStub)) {
        ep.getInstance(myProject).disposeContent();
      }
      myContentManager.removeContent(epContent, true);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:ChangesViewContentManager.java

示例2: getAllowedNamespaces

import com.intellij.util.NotNullFunction; //导入方法依赖的package包/类
/**
 * Consider using {@link DomService#getXmlFileHeader(com.intellij.psi.xml.XmlFile)} when implementing this.
 */
@SuppressWarnings({"MethodMayBeStatic"})
@NotNull
public List<String> getAllowedNamespaces(@NotNull String namespaceKey, @NotNull XmlFile file) {
  final NotNullFunction<XmlTag, List<String>> function = myNamespacePolicies.get(namespaceKey);
  if (function instanceof ConstantFunction) {
    return function.fun(null);
  }

  if (function != null) {
    final XmlDocument document = file.getDocument();
    if (document != null) {
      final XmlTag tag = document.getRootTag();
      if (tag != null) {
        return function.fun(tag);
      }
    }
  } else {
    return Collections.singletonList(namespaceKey);
  }
  return Collections.emptyList();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:DomFileDescription.java

示例3: findRunningConsole

import com.intellij.util.NotNullFunction; //导入方法依赖的package包/类
public static Collection<RunContentDescriptor> findRunningConsole(final Project project,
                                                                  @NotNull final NotNullFunction<RunContentDescriptor, Boolean> descriptorMatcher) {
  final ExecutionManager executionManager = ExecutionManager.getInstance(project);

  final RunContentDescriptor selectedContent = executionManager.getContentManager().getSelectedContent();
  if (selectedContent != null) {
    final ToolWindow toolWindow = ExecutionManager.getInstance(project).getContentManager().getToolWindowByDescriptor(selectedContent);
    if (toolWindow != null && toolWindow.isVisible()) {
      if (descriptorMatcher.fun(selectedContent)) {
        return Collections.singletonList(selectedContent);
      }
    }
  }

  final ArrayList<RunContentDescriptor> result = ContainerUtil.newArrayList();
  for (RunContentDescriptor runContentDescriptor : executionManager.getContentManager().getAllDescriptors()) {
    if (descriptorMatcher.fun(runContentDescriptor)) {
      result.add(runContentDescriptor);
    }
  }
  return result;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:ExecutionHelper.java

示例4: findRunningConsole

import com.intellij.util.NotNullFunction; //导入方法依赖的package包/类
public static Collection<RunContentDescriptor> findRunningConsole(final Project project,
                                                                  @Nonnull final NotNullFunction<RunContentDescriptor, Boolean> descriptorMatcher) {
  final ExecutionManager executionManager = ExecutionManager.getInstance(project);

  final RunContentDescriptor selectedContent = executionManager.getContentManager().getSelectedContent();
  if (selectedContent != null) {
    final ToolWindow toolWindow = ExecutionManager.getInstance(project).getContentManager().getToolWindowByDescriptor(selectedContent);
    if (toolWindow != null && toolWindow.isVisible()) {
      if (descriptorMatcher.fun(selectedContent)) {
        return Collections.singletonList(selectedContent);
      }
    }
  }

  final ArrayList<RunContentDescriptor> result = ContainerUtil.newArrayList();
  for (RunContentDescriptor runContentDescriptor : executionManager.getContentManager().getAllDescriptors()) {
    if (descriptorMatcher.fun(runContentDescriptor)) {
      result.add(runContentDescriptor);
    }
  }
  return result;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:23,代码来源:ExecutionHelper.java

示例5: moveDeclaration

import com.intellij.util.NotNullFunction; //导入方法依赖的package包/类
protected PsiElement moveDeclaration(PsiElementFactory elementFactory,
                                     String localName,
                                     V variable,
                                     PsiExpression initializer,
                                     NotNullFunction<PsiDeclarationStatement, PsiElement> action,
                                     Collection<PsiReference> references) {
  final PsiDeclarationStatement declaration = elementFactory.createVariableDeclarationStatement(localName, variable.getType(), initializer);
  final PsiElement newDeclaration = action.fun(declaration);
  retargetReferences(elementFactory, localName, references);
  return newDeclaration;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:BaseConvertToLocalQuickFix.java

示例6: isMarkedToReformat

import com.intellij.util.NotNullFunction; //导入方法依赖的package包/类
/**
 * Allows to answer if given node is configured to be reformatted.
 *
 * @param node node to check
 * @return <code>true</code> if given node is configured to be reformatted; <code>false</code> otherwise
 */
public static boolean isMarkedToReformat(final ASTNode node) {
  if (node.getCopyableUserData(REFORMAT_KEY) == null || !isSuspendedNodesReformattingAllowed()) {
    return false;
  }
  final NotNullFunction<ASTNode, Boolean> strategy = NODE_REFORMAT_STRATEGY.get();
  return strategy == null || strategy.fun(node);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:CodeEditUtil.java

示例7: calcPsiTargets

import com.intellij.util.NotNullFunction; //导入方法依赖的package包/类
private static <T> List<SmartPsiElementPointer> calcPsiTargets(Project project, Collection<? extends T> targets,
                                                               NotNullFunction<T, Collection<? extends PsiElement>> converter) {
  SmartPointerManager manager = SmartPointerManager.getInstance(project);
  Set<PsiElement> elements = new THashSet<PsiElement>();
  final List<SmartPsiElementPointer> list = new ArrayList<SmartPsiElementPointer>(targets.size());
  for (final T target : targets) {
    for (final PsiElement psiElement : converter.fun(target)) {
      if (elements.add(psiElement) && psiElement.isValid()) {
        list.add(manager.createSmartPsiElementPointer(psiElement));
      }
    }
  }
  return list;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:NavigationGutterIconBuilder.java

示例8: collectConsolesByDisplayName

import com.intellij.util.NotNullFunction; //导入方法依赖的package包/类
public static List<RunContentDescriptor> collectConsolesByDisplayName(final Project project,
                                                                      @NotNull NotNullFunction<String, Boolean> titleMatcher) {
  List<RunContentDescriptor> result = ContainerUtil.newArrayList();
  final ExecutionManager executionManager = ExecutionManager.getInstance(project);
  for (RunContentDescriptor runContentDescriptor : executionManager.getContentManager().getAllDescriptors()) {
    if (titleMatcher.fun(runContentDescriptor.getDisplayName())) {
      result.add(runContentDescriptor);
    }
  }
  return result;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:12,代码来源:ExecutionHelper.java

示例9: parseWithSoftElements

import com.intellij.util.NotNullFunction; //导入方法依赖的package包/类
@NotNull
protected static <T> Pair<PsiBuilder.Marker, T> parseWithSoftElements(NotNullFunction<CSharpBuilderWrapper, Pair<PsiBuilder.Marker, T>> func, CSharpBuilderWrapper builderWrapper, TokenSet softs)
{
	builderWrapper.enableSoftKeywords(softs);
	Pair<PsiBuilder.Marker, T> fun = func.fun(builderWrapper);
	builderWrapper.disableSoftKeywords(softs);
	return fun;
}
 
开发者ID:consulo,项目名称:consulo-csharp,代码行数:9,代码来源:SharedParsingHelpers.java

示例10: proxied

import com.intellij.util.NotNullFunction; //导入方法依赖的package包/类
public static <Psi extends PsiElement, Jam extends JamElement> JamInstantiator<Psi, Jam> proxied(final Class<Jam> jamClass) {
  final NotNullFunction<PsiElementRef,Jam> function = JamClassGenerator.getInstance().generateJamElementFactory(jamClass);
  return new JamInstantiator<Psi, Jam>() {
    @NotNull
    @Override
    public Jam instantiate(@NotNull PsiElementRef<Psi> psiPsiRef) {
      return function.fun(psiPsiRef);
    }
  };
}
 
开发者ID:consulo,项目名称:consulo-javaee,代码行数:11,代码来源:JamInstantiator.java

示例11: fixUnderdoneEdges

import com.intellij.util.NotNullFunction; //导入方法依赖的package包/类
private void fixUnderdoneEdges(@Nonnull NotNullFunction<CommitId, Integer> notLoadedCommitToId) {
  List<CommitId> commitIds = ContainerUtil.newArrayList(upAdjacentNodes.keySet());
  ContainerUtil.sort(commitIds, new Comparator<CommitId>() {
    @Override
    public int compare(@Nonnull CommitId o1, @Nonnull CommitId o2) {
      return Collections.min(upAdjacentNodes.get(o1)) - Collections.min(upAdjacentNodes.get(o2));
    }
  });
  for (CommitId notLoadCommit : commitIds) {
    int notLoadId = notLoadedCommitToId.fun(notLoadCommit);
    for (int upNodeIndex : upAdjacentNodes.get(notLoadCommit)) {
      fixUnderdoneEdgeForNotLoadCommit(upNodeIndex, notLoadId);
    }
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:16,代码来源:PermanentLinearGraphBuilder.java

示例12: isMarkedToReformat

import com.intellij.util.NotNullFunction; //导入方法依赖的package包/类
/**
 * Allows to answer if given node is configured to be reformatted.
 *
 * @param node node to check
 * @return {@code true} if given node is configured to be reformatted; {@code false} otherwise
 */
public static boolean isMarkedToReformat(final ASTNode node) {
  if (node.getCopyableUserData(REFORMAT_KEY) == null || !isSuspendedNodesReformattingAllowed()) {
    return false;
  }
  final NotNullFunction<ASTNode, Boolean> strategy = NODE_REFORMAT_STRATEGY.get();
  return strategy == null || strategy.fun(node);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:14,代码来源:CodeEditUtil.java

示例13: updateExtensionTabs

import com.intellij.util.NotNullFunction; //导入方法依赖的package包/类
private void updateExtensionTabs() {
  final ChangesViewContentEP[] contentEPs = myProject.getExtensions(ChangesViewContentEP.EP_NAME);
  for(ChangesViewContentEP ep: contentEPs) {
    final NotNullFunction<Project,Boolean> predicate = ep.newPredicateInstance(myProject);
    if (predicate == null) continue;
    Content epContent = findEPContent(ep);
    final Boolean predicateResult = predicate.fun(myProject);
    if (predicateResult.equals(Boolean.TRUE) && epContent == null) {
      addExtensionTab(ep);
    }
    else if (predicateResult.equals(Boolean.FALSE) && epContent != null) {
      myContentManager.removeContent(epContent, true);
    }
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:16,代码来源:ChangesViewContentManager.java

示例14: collectConsolesByDisplayName

import com.intellij.util.NotNullFunction; //导入方法依赖的package包/类
public static List<RunContentDescriptor> collectConsolesByDisplayName(final Project project, @Nonnull NotNullFunction<String, Boolean> titleMatcher) {
  List<RunContentDescriptor> result = ContainerUtil.newArrayList();
  final ExecutionManager executionManager = ExecutionManager.getInstance(project);
  for (RunContentDescriptor runContentDescriptor : executionManager.getContentManager().getAllDescriptors()) {
    if (titleMatcher.fun(runContentDescriptor.getDisplayName())) {
      result.add(runContentDescriptor);
    }
  }
  return result;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:11,代码来源:ExecutionHelper.java

示例15: getAllowedNamespaces

import com.intellij.util.NotNullFunction; //导入方法依赖的package包/类
/**
 * Consider using {@link DomService#getXmlFileHeader(com.intellij.psi.xml.XmlFile)} when implementing this.
 */
@SuppressWarnings({"MethodMayBeStatic"})
@NotNull
public List<String> getAllowedNamespaces(@NotNull String namespaceKey, @NotNull XmlFile file)
{
	final NotNullFunction<XmlTag, List<String>> function = myNamespacePolicies.get(namespaceKey);
	if(function instanceof ConstantFunction)
	{
		return function.fun(null);
	}

	if(function != null)
	{
		final XmlDocument document = file.getDocument();
		if(document != null)
		{
			final XmlTag tag = document.getRootTag();
			if(tag != null)
			{
				return function.fun(tag);
			}
		}
	}
	else
	{
		return Collections.singletonList(namespaceKey);
	}
	return Collections.emptyList();
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:32,代码来源:DomFileDescription.java


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