本文整理汇总了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);
}
}
}
示例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();
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
};
}
示例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);
}
}
}
示例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);
}
示例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);
}
}
}
示例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;
}
示例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();
}