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


Java NotNullFunction类代码示例

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


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

示例1: applyChanges

import com.intellij.util.NotNullFunction; //导入依赖的package包/类
protected PsiElement applyChanges(@NotNull final Project project,
                                  @NotNull final String localName,
                                  @Nullable final PsiExpression initializer,
                                  @NotNull final V variable,
                                  @NotNull final Collection<PsiReference> references,
                                  final boolean delete, @NotNull final NotNullFunction<PsiDeclarationStatement, PsiElement> action) {
  final PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(project);

  return ApplicationManager.getApplication().runWriteAction(
    new Computable<PsiElement>() {
      @Override
      public PsiElement compute() {
        final PsiElement newDeclaration = moveDeclaration(elementFactory, localName, variable, initializer, action, references);
        if (delete) {
          beforeDelete(project, variable, newDeclaration);
          variable.normalizeDeclaration();
          variable.delete();
        }
        return newDeclaration;
      }
    }
  );
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:BaseConvertToLocalQuickFix.java

示例2: buildPermanentGraph

import com.intellij.util.NotNullFunction; //导入依赖的package包/类
@NotNull
private static PermanentGraph<Integer> buildPermanentGraph(@NotNull List<? extends GraphCommit<Integer>> commits,
                                                           @NotNull RefsModel refsModel,
                                                           @NotNull final VcsLogHashMap hashMap,
                                                           @NotNull Map<VirtualFile, VcsLogProvider> providers) {
  if (commits.isEmpty()) {
    return EmptyPermanentGraph.getInstance();
  }
  NotNullFunction<Integer, Hash> hashGetter = new NotNullFunction<Integer, Hash>() {
    @NotNull
    @Override
    public Hash fun(Integer commitIndex) {
      return hashMap.getHash(commitIndex);
    }
  };
  GraphColorManagerImpl colorManager = new GraphColorManagerImpl(refsModel, hashGetter, getRefManagerMap(providers));
  Set<Integer> branches = getBranchCommitHashIndexes(refsModel.getAllRefs(), hashMap);
  StopWatch sw = StopWatch.start("building graph");
  PermanentGraphImpl<Integer> permanentGraph = PermanentGraphImpl.newInstance(commits, colorManager, branches);
  sw.report();
  return permanentGraph;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:DataPack.java

示例3: doTest

import com.intellij.util.NotNullFunction; //导入依赖的package包/类
private void doTest(@NotNull Collection<FileType> fileTypes) throws CollectUsagesException {
  final Set<UsageDescriptor> usages = new FileTypeUsagesCollector().getProjectUsages(getProject());
  for (UsageDescriptor usage : usages) {
    assertEquals(1, usage.getValue());
  }
  assertEquals(
    ContainerUtil.map2Set(fileTypes, new NotNullFunction<FileType, String>() {
      @NotNull
      @Override
      public String fun(FileType fileType) {
        return fileType.getName();
      }
    }),
    ContainerUtil.map2Set(usages, new NotNullFunction<UsageDescriptor, String>() {
      @NotNull
      @Override
      public String fun(UsageDescriptor usageDescriptor) {
        return usageDescriptor.getKey();
      }
    })
  );
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:FileTypeUsagesCollectorTest.java

示例4: iterateAllCaches

import com.intellij.util.NotNullFunction; //导入依赖的package包/类
public void iterateAllCaches(final NotNullFunction<ChangesCacheFile, Boolean> consumer) {
  final AbstractVcs[] vcses = myPlManager.getAllActiveVcss();
  for (AbstractVcs vcs : vcses) {
    final CommittedChangesProvider provider = vcs.getCommittedChangesProvider();
    if (provider instanceof CachingCommittedChangesProvider) {
      final Map<VirtualFile, RepositoryLocation> map = getAllRootsUnderVcs(vcs);
      for (VirtualFile root : map.keySet()) {
        final RepositoryLocation location = map.get(root);
        final ChangesCacheFile cacheFile = getCacheFile(vcs, root, location);
        if (Boolean.TRUE.equals(consumer.fun(cacheFile))) {
          return;
        }
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:CachesHolder.java

示例5: hasCachesWithEmptiness

import com.intellij.util.NotNullFunction; //导入依赖的package包/类
private boolean hasCachesWithEmptiness(final boolean emptiness) {
  final Ref<Boolean> resultRef = new Ref<Boolean>(Boolean.FALSE);
  myCachesHolder.iterateAllCaches(new NotNullFunction<ChangesCacheFile, Boolean>() {
    @Override
    @NotNull
    public Boolean fun(final ChangesCacheFile changesCacheFile) {
      try {
        if (changesCacheFile.isEmpty() == emptiness) {
          resultRef.set(true);
          return true;
        }
      }
      catch (IOException e) {
        LOG.info(e);
      }
      return false;
    }
  });
  return resultRef.get();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:CommittedChangesCache.java

示例6: 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

示例7: getConsoles

import com.intellij.util.NotNullFunction; //导入依赖的package包/类
private static Collection<RunContentDescriptor> getConsoles(Project project) {
  PythonConsoleToolWindow toolWindow = PythonConsoleToolWindow.getInstance(project);

  if (toolWindow != null && toolWindow.getToolWindow().isVisible()) {
    RunContentDescriptor selectedContentDescriptor = toolWindow.getSelectedContentDescriptor();
    return selectedContentDescriptor != null ? Lists.newArrayList(selectedContentDescriptor) : Lists.<RunContentDescriptor>newArrayList();
  }

  Collection<RunContentDescriptor> descriptors =
    ExecutionHelper.findRunningConsole(project, new NotNullFunction<RunContentDescriptor, Boolean>() {
      @NotNull
      @Override
      public Boolean fun(RunContentDescriptor dom) {
        return dom.getExecutionConsole() instanceof PyCodeExecutor && isAlive(dom);
      }
    });

  if (descriptors.isEmpty() && toolWindow != null) {
    return toolWindow.getConsoleContentDescriptors();
  }
  else {
    return descriptors;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:PyExecuteSelectionAction.java

示例8: createPointersThunk

import com.intellij.util.NotNullFunction; //导入依赖的package包/类
private static <T> NotNullLazyValue<List<SmartPsiElementPointer>> createPointersThunk(boolean lazy,
                                                                                      final Project project,
                                                                                      final Factory<Collection<T>> targets,
                                                                                      final NotNullFunction<T, Collection<? extends PsiElement>> converter) {
  if (!lazy) {
    return NotNullLazyValue.createConstantValue(calcPsiTargets(project, targets.create(), converter));
  }

  return new NotNullLazyValue<List<SmartPsiElementPointer>>() {
    @Override
    @NotNull
    public List<SmartPsiElementPointer> compute() {
      return calcPsiTargets(project, targets.create(), converter);
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:NavigationGutterIconBuilder.java

示例9: 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

示例10: logClassPathOnce

import com.intellij.util.NotNullFunction; //导入依赖的package包/类
private void logClassPathOnce(@NotNull Project project) {
  List<VirtualFile> files = GradleBuildClasspathManager.getInstance(project).getAllClasspathEntries();
  if (ContainerUtil.equalsIdentity(files, myLastClassPath)) {
    return;
  }
  myLastClassPath = files;

  List<String> paths = ContainerUtil.map(files, new NotNullFunction<VirtualFile, String>() {
    @NotNull
    @Override
    public String fun(VirtualFile vf) {
      return vf.getPath();
    }
  });
  String classPath = Joiner.on(':').join(paths);
  LOG.info(String.format("Android DSL resolver classpath (project %1$s): %2$s", project.getName(), classPath));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:AndroidDslContributor.java

示例11: setRepositoryURLs

import com.intellij.util.NotNullFunction; //导入依赖的package包/类
public void setRepositoryURLs(SVNURL[] urls,
                              final boolean showFiles,
                              @Nullable NotNullFunction<RepositoryBrowserComponent, Expander> defaultExpanderFactory,
                              boolean expandFirst) {
  RepositoryTreeModel model = new RepositoryTreeModel(myVCS, showFiles, this);

  if (defaultExpanderFactory != null) {
    model.setDefaultExpanderFactory(defaultExpanderFactory);
  }

  model.setRoots(urls);
  Disposer.register(this, model);
  myRepositoryTree.setModel(model);

  if (expandFirst) {
    myRepositoryTree.expandRow(0);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:RepositoryBrowserComponent.java

示例12: createRevisionLazily

import com.intellij.util.NotNullFunction; //导入依赖的package包/类
public SvnRepositoryContentRevision createRevisionLazily(final String path, final boolean isBeforeRevision) {
  final boolean knownAsDirectory = myKnownAsDirectories.contains(path);
  final FilePath localPath = getLocalPath(path, new NotNullFunction<File, Boolean>() {
    @NotNull
    public Boolean fun(final File file) {
      if (knownAsDirectory) return Boolean.TRUE;
      // list will be next
      myWithoutDirStatus.add(new Pair<Integer, Boolean>(myList.size(), isBeforeRevision));
      return Boolean.FALSE;
    }
  });
  long revision = getRevision(isBeforeRevision);
  return localPath == null
         ? SvnRepositoryContentRevision.createForRemotePath(myVcs, myRepositoryRoot, path, knownAsDirectory, revision)
         : SvnRepositoryContentRevision.create(myVcs, myRepositoryRoot, path, localPath, revision);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:SvnChangeList.java

示例13: SvnMergeInfoRootPanelManual

import com.intellij.util.NotNullFunction; //导入依赖的package包/类
public SvnMergeInfoRootPanelManual(@NotNull Project project,
                                   @NotNull NotNullFunction<WCInfoWithBranches, WCInfoWithBranches> refresher,
                                   @NotNull Runnable listener,
                                   boolean onlyOneRoot,
                                   @NotNull WCInfoWithBranches info) {
  myOnlyOneRoot = onlyOneRoot;
  myInfo = info;
  myProject = project;
  myRefresher = refresher;
  myListener = listener;
  myBranchToLocal = ContainerUtil.newHashMap();

  init();
  myInclude.setVisible(!onlyOneRoot);
  initWithData();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:SvnMergeInfoRootPanelManual.java

示例14: findRunningConsoleByCmdLine

import com.intellij.util.NotNullFunction; //导入依赖的package包/类
/** @deprecated use lookup by user data (to remove in IDEA 13) */
public static Collection<RunContentDescriptor> findRunningConsoleByCmdLine(final Project project,
                                                                           @NotNull final NotNullFunction<String, Boolean> cmdLineMatcher) {
  return findRunningConsole(project, new NotNullFunction<RunContentDescriptor, Boolean>() {
    @NotNull
    @Override
    public Boolean fun(RunContentDescriptor selectedContent) {
      final ProcessHandler processHandler = selectedContent.getProcessHandler();
      if (processHandler instanceof OSProcessHandler && !processHandler.isProcessTerminated()) {
        final String commandLine = ((OSProcessHandler)processHandler).getCommandLine();
        return cmdLineMatcher.fun(commandLine);
      }
      return false;
    }
  });
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:ExecutionHelper.java

示例15: 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


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