Java 类com.intellij.util.BooleanFunction 实例源码

项目:educational-plugin    文件:PyStudyDirectoryProjectGenerator.java   
@Nullable
@Override
public BooleanFunction<PythonProjectGenerator> beforeProjectGenerated(@Nullable Sdk sdk) {
  return generator -> {
    final List<Integer> enrolledCoursesIds = myGenerator.getEnrolledCoursesIds();
    final Course course = myGenerator.getSelectedCourse();
    if (course == null || !(course instanceof RemoteCourse)) return true;
    if (((RemoteCourse)course).getId() > 0 && !enrolledCoursesIds.contains(((RemoteCourse)course).getId())) {
      ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> {
        ProgressManager.getInstance().getProgressIndicator().setIndeterminate(true);
        return StudyUtils.execCancelable(() -> EduStepicConnector.enrollToCourse(((RemoteCourse)course).getId(),
                                                                                 StudySettings.getInstance().getUser()));
      }, "Creating Course", true, ProjectManager.getInstance().getDefaultProject());
    }
    return true;
  };
}
项目:intellij-ce-playground    文件:TreeIntToIntMap.java   
public static UpdatableIntToIntMap newInstance(@NotNull final BooleanFunction<Integer> thisIsVisible, final int longSize) {
  if (longSize < 0) throw new NegativeArraySizeException("size < 0: " + longSize);

  if (longSize == 0) return IDIntToIntMap.EMPTY;

  int countLevels; // longSize -> countLevels: 1..2 -> 2; 3..4 -> 3;  5..8 -> 4
  if (longSize == 1) {
    countLevels = 2;
  }
  else {
    countLevels = countDigits(longSize - 1) + 1;
  }

  int[] emptyTree = new int[(1 << (countLevels - 1))];
  TreeIntToIntMap intToIntMap = new TreeIntToIntMap(thisIsVisible, longSize, countLevels, emptyTree);
  intToIntMap.update(0, longSize - 1);
  return intToIntMap;
}
项目:intellij-ce-playground    文件:ExternalSystemImportingTestCase.java   
protected void ignoreData(BooleanFunction<DataNode<?>> booleanFunction, final boolean ignored) {
  final ExternalProjectInfo externalProjectInfo = ProjectDataManager.getInstance().getExternalProjectData(
    myProject, getExternalSystemId(), getCurrentExternalProjectSettings().getExternalProjectPath());
  assertNotNull(externalProjectInfo);

  final DataNode<ProjectData> projectDataNode = externalProjectInfo.getExternalProjectStructure();
  assertNotNull(projectDataNode);

  final Collection<DataNode<?>> nodes = ExternalSystemApiUtil.findAllRecursively(projectDataNode, booleanFunction);
  for (DataNode<?> node : nodes) {
    ExternalSystemApiUtil.visit(node, new Consumer<DataNode<?>>() {
      @Override
      public void consume(DataNode dataNode) {
        dataNode.setIgnored(ignored);
      }
    });
  }
  ServiceManager.getService(ProjectDataManager.class).importData(projectDataNode, myProject, true);
}
项目:intellij-ce-playground    文件:PyCharmNewProjectStep.java   
@Override
public void consume(@Nullable ProjectSettingsStepBase base) {
  if (base == null) return;
  final DirectoryProjectGenerator generator = base.getProjectGenerator();
  final NullableConsumer<ProjectSettingsStepBase> callback = new GenerateProjectCallback();
  if (generator instanceof PythonProjectGenerator && base instanceof ProjectSpecificSettingsStep) {
    final BooleanFunction<PythonProjectGenerator> beforeProjectGenerated = ((PythonProjectGenerator)generator).
      beforeProjectGenerated(((ProjectSpecificSettingsStep)base).getSdk());
    if (beforeProjectGenerated != null) {
      final boolean result = beforeProjectGenerated.fun((PythonProjectGenerator)generator);
      if (result) {
        callback.consume(base);
      }
      else {
        Messages.showWarningDialog("Project can not be generated", "Error in Project Generation");
      }
    }
    else {
      callback.consume(base);
    }
  }
}
项目:consulo    文件:TreeIntToIntMap.java   
public static UpdatableIntToIntMap newInstance(@Nonnull final BooleanFunction<Integer> thisIsVisible, final int longSize) {
  if (longSize < 0) throw new NegativeArraySizeException("size < 0: " + longSize);

  if (longSize == 0) return IDIntToIntMap.EMPTY;

  int countLevels; // longSize -> countLevels: 1..2 -> 2; 3..4 -> 3;  5..8 -> 4
  if (longSize == 1) {
    countLevels = 2;
  }
  else {
    countLevels = countDigits(longSize - 1) + 1;
  }

  int[] emptyTree = new int[(1 << (countLevels - 1))];
  TreeIntToIntMap intToIntMap = new TreeIntToIntMap(thisIsVisible, longSize, countLevels, emptyTree);
  intToIntMap.update(0, longSize - 1);
  return intToIntMap;
}
项目:intellij-ce-playground    文件:ListIntToIntMap.java   
@NotNull
public static UpdatableIntToIntMap newInstance(final Flags visibleNodes) {
  return newInstance(new BooleanFunction<Integer>() {
    @Override
    public boolean fun(Integer integer) {
      return visibleNodes.get(integer);
    }
  }, visibleNodes.size());
}
项目:intellij-ce-playground    文件:ListIntToIntMap.java   
/**
 * @param blockSize memory usage is: longSize / blockSize;
 *                  getLongIndex access need: log(longSize) + blockSize
 *                  getShortIndex access need: blockSize
 */
@NotNull
public static UpdatableIntToIntMap newInstance(@NotNull final BooleanFunction<Integer> thisIsVisible, final int longSize, int blockSize) {
  if (longSize < 0) throw new NegativeArraySizeException("size < 0: " + longSize);

  if (longSize == 0) return IDIntToIntMap.EMPTY;

  int sumSize = (longSize - 1) / blockSize + 1;
  ListIntToIntMap listIntToIntMap = new ListIntToIntMap(thisIsVisible, longSize, blockSize, new int[sumSize]);
  listIntToIntMap.update(0, longSize - 1);
  return listIntToIntMap;
}
项目:intellij-ce-playground    文件:UpdatableIntToIntMapTest.java   
public Tester getTest(int longSize, String initVisibility) {
  final Set<Integer> visibleNodes = parseSet(initVisibility);
  UpdatableIntToIntMap updatableIntToIntMap = createUpdatableIntToIntMap(new BooleanFunction<Integer>() {
    @Override
    public boolean fun(Integer integer) {
      return visibleNodes.contains(integer);
    }
  }, longSize);
  Tester tester = new Tester(updatableIntToIntMap, visibleNodes);

  assertEquals(initVisibility, tester.mapToString());
  return tester;
}
项目:intellij-ce-playground    文件:AbstractPopup.java   
@Override
public boolean dispatchKeyEvent(@NotNull KeyEvent e) {
  BooleanFunction<KeyEvent> handler = myKeyEventHandler;
  if (handler != null) {
    return handler.fun(e);
  }
  else {
    if (isCloseRequest(e) && myCancelKeyEnabled) {
      cancel(e);
      return true;
    }
  }
  return false;
}
项目:tools-idea    文件:ExternalSystemApiUtil.java   
@SuppressWarnings("unchecked")
@Nullable
public static <T> DataNode<T> find(@NotNull DataNode<?> node, @NotNull Key<T> key, BooleanFunction<DataNode<T>> predicate) {
  for (DataNode<?> child : node.getChildren()) {
    if (key.equals(child.getKey()) && predicate.fun((DataNode<T>)child)) {
      return (DataNode<T>)child;
    }
  }
  return null;
}
项目:tools-idea    文件:LibraryDependencyDataService.java   
private void importMissingProjectLibraries(@NotNull Module module,
                                           @NotNull Collection<DataNode<LibraryDependencyData>> nodesToImport,
                                           boolean synchronous)
{
  LibraryTable libraryTable = myPlatformFacade.getProjectLibraryTable(module.getProject());
  List<DataNode<LibraryData>> librariesToImport = ContainerUtilRt.newArrayList();
  for (DataNode<LibraryDependencyData> dataNode : nodesToImport) {
    final LibraryDependencyData dependencyData = dataNode.getData();
    if (dependencyData.getLevel() != LibraryLevel.PROJECT) {
      continue;
    }
    final Library library = libraryTable.getLibraryByName(dependencyData.getName());
    if (library == null) {
      DataNode<ProjectData> projectNode = dataNode.getDataNode(ProjectKeys.PROJECT);
      if (projectNode != null) {
        DataNode<LibraryData> libraryNode =
          ExternalSystemApiUtil.find(projectNode, ProjectKeys.LIBRARY, new BooleanFunction<DataNode<LibraryData>>() {
            @Override
            public boolean fun(DataNode<LibraryData> node) {
              return node.getData().equals(dependencyData.getTarget());
            }
          });
        if (libraryNode != null) {
          librariesToImport.add(libraryNode);
        }
      }
    }
  }
  if (!librariesToImport.isEmpty()) {
    myLibraryManager.importData(librariesToImport, module.getProject(), synchronous);
  }
}
项目:tools-idea    文件:AbstractPopup.java   
@Override
public boolean dispatchKeyEvent(@NotNull KeyEvent e) {
  BooleanFunction<KeyEvent> handler = myKeyEventHandler;
  if (handler != null) {
    return handler.fun(e);
  }
  else {
    if (isCloseRequest(e) && myCancelKeyEnabled) {
      cancel(e);
      return true;
    }
  }
  return false;
}
项目:consulo    文件:LibraryDependencyDataService.java   
private void importMissingProjectLibraries(@Nonnull Module module,
                                           @Nonnull Collection<DataNode<LibraryDependencyData>> nodesToImport,
                                           boolean synchronous)
{
  LibraryTable libraryTable = ProjectLibraryTable.getInstance(module.getProject());
  List<DataNode<LibraryData>> librariesToImport = ContainerUtilRt.newArrayList();
  for (DataNode<LibraryDependencyData> dataNode : nodesToImport) {
    final LibraryDependencyData dependencyData = dataNode.getData();
    if (dependencyData.getLevel() != LibraryLevel.PROJECT) {
      continue;
    }
    final Library library = libraryTable.getLibraryByName(dependencyData.getInternalName());
    if (library == null) {
      DataNode<ProjectData> projectNode = dataNode.getDataNode(ProjectKeys.PROJECT);
      if (projectNode != null) {
        DataNode<LibraryData> libraryNode =
          ExternalSystemApiUtil.find(projectNode, ProjectKeys.LIBRARY, new BooleanFunction<DataNode<LibraryData>>() {
            @Override
            public boolean fun(DataNode<LibraryData> node) {
              return node.getData().equals(dependencyData.getTarget());
            }
          });
        if (libraryNode != null) {
          librariesToImport.add(libraryNode);
        }
      }
    }
  }
  if (!librariesToImport.isEmpty()) {
    myLibraryManager.importData(librariesToImport, module.getProject(), synchronous);
  }
}
项目:consulo    文件:AbstractPopup.java   
@Override
public boolean dispatchKeyEvent(@Nonnull KeyEvent e) {
  BooleanFunction<KeyEvent> handler = myKeyEventHandler;
  if (handler != null) {
    return handler.fun(e);
  }
  else {
    if (isCloseRequest(e) && myCancelKeyEnabled && !mySpeedSearch.isHoldingFilter()) {
      cancel(e);
      return true;
    }
  }
  return false;
}
项目:consulo    文件:UpdatableIntToIntMapTest.java   
public Tester getTest(int longSize, String initVisibility) {
  final Set<Integer> visibleNodes = parseSet(initVisibility);
  UpdatableIntToIntMap updatableIntToIntMap = createUpdatableIntToIntMap(new BooleanFunction<Integer>() {
    @Override
    public boolean fun(Integer integer) {
      return visibleNodes.contains(integer);
    }
  }, longSize);
  Tester tester = new Tester(updatableIntToIntMap, visibleNodes);

  assertEquals(initVisibility, tester.mapToString());
  return tester;
}
项目:consulo    文件:ListIntToIntMap.java   
@Nonnull
public static UpdatableIntToIntMap newInstance(final Flags visibleNodes) {
  return newInstance(new BooleanFunction<Integer>() {
    @Override
    public boolean fun(Integer integer) {
      return visibleNodes.get(integer);
    }
  }, visibleNodes.size());
}
项目:consulo    文件:ListIntToIntMap.java   
/**
 * @param blockSize memory usage is: longSize / blockSize;
 *                  getLongIndex access need: log(longSize) + blockSize
 *                  getShortIndex access need: blockSize
 */
@Nonnull
public static UpdatableIntToIntMap newInstance(@Nonnull final BooleanFunction<Integer> thisIsVisible, final int longSize, int blockSize) {
  if (longSize < 0) throw new NegativeArraySizeException("size < 0: " + longSize);

  if (longSize == 0) return IDIntToIntMap.EMPTY;

  int sumSize = (longSize - 1) / blockSize + 1;
  ListIntToIntMap listIntToIntMap = new ListIntToIntMap(thisIsVisible, longSize, blockSize, new int[sumSize]);
  listIntToIntMap.update(0, longSize - 1);
  return listIntToIntMap;
}
项目:educational-plugin    文件:PyStudyDirectoryProjectGenerator.java   
@Override
public boolean beforeProjectGenerated() {
  BooleanFunction<PythonProjectGenerator> function = beforeProjectGenerated(null);
  return function != null && function.fun(this);
}
项目:intellij-ce-playground    文件:ListIntToIntMap.java   
@NotNull
public static UpdatableIntToIntMap newInstance(@NotNull final BooleanFunction<Integer> thisIsVisible, final int longSize) {
  return newInstance(thisIsVisible, longSize, DEFAULT_BLOCK_SIZE);
}
项目:intellij-ce-playground    文件:ListIntToIntMap.java   
private ListIntToIntMap(@NotNull BooleanFunction<Integer> thisIsVisible, int longSize, int blockSize, int[] subSumOfBlocks) {
  myLongSize = longSize;
  myThisIsVisible = thisIsVisible;
  myBlockSize = blockSize;
  mySubSumOfBlocks = subSumOfBlocks;
}
项目:intellij-ce-playground    文件:TreeIntToIntMap.java   
private TreeIntToIntMap(@NotNull BooleanFunction<Integer> thisIsVisible, int longSize, int countLevels, int[] tree) {
  myThisIsVisible = thisIsVisible;
  myLongSize = longSize;
  myCountLevels = countLevels;
  myTree = tree;
}
项目:intellij-ce-playground    文件:TreeIntToIntMapTest.java   
@Override
protected UpdatableIntToIntMap createUpdatableIntToIntMap(@NotNull BooleanFunction<Integer> thisIsVisible, int longSize) {
  return TreeIntToIntMap.newInstance(thisIsVisible, longSize);
}
项目:intellij-ce-playground    文件:ListIntToIntMapTest.java   
@Override
protected UpdatableIntToIntMap createUpdatableIntToIntMap(@NotNull BooleanFunction<Integer> thisIsVisible, int longSize) {
  return ListIntToIntMap.newInstance(thisIsVisible, longSize, 3);
}
项目:intellij-ce-playground    文件:ComponentPopupBuilderImpl.java   
@NotNull
@Override
public ComponentPopupBuilder setKeyEventHandler(@NotNull BooleanFunction<KeyEvent> handler) {
  myKeyEventHandler = handler;
  return this;
}
项目:intellij-ce-playground    文件:ChooseByNameBase.java   
protected void showTextFieldPanel() {
  final JLayeredPane layeredPane = getLayeredPane();
  final Dimension preferredTextFieldPanelSize = myTextFieldPanel.getPreferredSize();
  final int x = (layeredPane.getWidth() - preferredTextFieldPanelSize.width) / 2;
  final int paneHeight = layeredPane.getHeight();
  final int y = paneHeight / 3 - preferredTextFieldPanelSize.height / 2;

  VISIBLE_LIST_SIZE_LIMIT = Math.max
    (10, (paneHeight - (y + preferredTextFieldPanelSize.height)) / (preferredTextFieldPanelSize.height / 2) - 1);

  ComponentPopupBuilder builder = JBPopupFactory.getInstance().createComponentPopupBuilder(myTextFieldPanel, myTextField);
  builder.setLocateWithinScreenBounds(false);
  builder.setKeyEventHandler(new BooleanFunction<KeyEvent>() {
    @Override
    public boolean fun(KeyEvent event) {
      if (myTextPopup == null || !AbstractPopup.isCloseRequest(event) || !myTextPopup.isCancelKeyEnabled()) {
        return false;
      }

      IdeFocusManager focusManager = IdeFocusManager.getInstance(myProject);
      if (isDescendingFromTemporarilyFocusableToolWindow(focusManager.getFocusOwner())) {
        focusManager.requestFocus(myTextField, true);
        return false;
      }
      else {
        myTextPopup.cancel(event);
        return true;
      }
    }
  }).setCancelCallback(new Computable<Boolean>() {
    @Override
    public Boolean compute() {
      myTextPopup = null;
      close(false);
      return Boolean.TRUE;
    }
  }).setFocusable(true).setRequestFocus(true).setModalContext(false).setCancelOnClickOutside(false);

  Point point = new Point(x, y);
  SwingUtilities.convertPointToScreen(point, layeredPane);
  Rectangle bounds = new Rectangle(point, new Dimension(preferredTextFieldPanelSize.width + 20, preferredTextFieldPanelSize.height));
  myTextPopup = builder.createPopup();
  myTextPopup.setSize(bounds.getSize());
  myTextPopup.setLocation(bounds.getLocation());

  MnemonicHelper.init(myTextFieldPanel);
  if (myProject != null && !myProject.isDefault()) {
    DaemonCodeAnalyzer.getInstance(myProject).disableUpdateByTimer(myTextPopup);
  }

  Disposer.register(myTextPopup, new Disposable() {
    @Override
    public void dispose() {
      cancelListUpdater();
    }
  });
  myTextPopup.show(layeredPane);
  if (myTextPopup instanceof AbstractPopup) {
    Window window = ((AbstractPopup)myTextPopup).getPopupWindow();
    if (window instanceof JDialog) {
      ((JDialog)window).getRootPane().putClientProperty(WindowAction.NO_WINDOW_ACTIONS, Boolean.TRUE);
    }
  }
}
项目:intellij-ce-playground    文件:PythonProjectGenerator.java   
@Nullable
public BooleanFunction<PythonProjectGenerator> beforeProjectGenerated(@NotNull final Sdk sdk) {
  return null;
}
项目:tools-idea    文件:ComponentPopupBuilderImpl.java   
@NotNull
@Override
public ComponentPopupBuilder setKeyEventHandler(@NotNull BooleanFunction<KeyEvent> handler) {
  myKeyEventHandler = handler; 
  return this;
}
项目:tools-idea    文件:GradleProjectResolver.java   
@NotNull
private static LibraryDependencyData buildDependency(@NotNull DataNode<ModuleData> ownerModule,
                                                     @NotNull IdeaSingleEntryLibraryDependency dependency,
                                                     @NotNull DataNode<ProjectData> ideProject)
  throws IllegalStateException
{
  File binaryPath = dependency.getFile();
  if (binaryPath == null) {
    throw new IllegalStateException(String.format(
      "Can't parse external library dependency '%s'. Reason: it doesn't specify path to the binaries", dependency
    ));
  }

  // Gradle API doesn't provide library name at the moment.
  String libraryName = FileUtil.getNameWithoutExtension(binaryPath);

  // Gradle API doesn't explicitly provide information about unresolved libraries (http://issues.gradle.org/browse/GRADLE-1995).
  // That's why we use this dirty hack here.
  boolean unresolved = libraryName.startsWith(UNRESOLVED_DEPENDENCY_PREFIX);
  if (unresolved) {
    // Gradle uses names like 'unresolved dependency - commons-collections commons-collections 3.2' for unresolved dependencies.
    libraryName = binaryPath.getName().substring(UNRESOLVED_DEPENDENCY_PREFIX.length());
    int i = libraryName.indexOf(' ');
    if (i >= 0) {
      i = CharArrayUtil.shiftForward(libraryName, i + 1, " ");
    }

    if (i >= 0 && i < libraryName.length()) {
      int dependencyNameIndex = i;
      i = libraryName.indexOf(' ', dependencyNameIndex);
      if (i > 0) {
        libraryName = String.format("%s-%s", libraryName.substring(dependencyNameIndex, i), libraryName.substring(i + 1));
      }
    }
  }

  final LibraryData library = new LibraryData(GradleConstants.SYSTEM_ID, libraryName, unresolved);
  if (!unresolved) {
    library.addPath(LibraryPathType.BINARY, binaryPath.getAbsolutePath());
  }

  File sourcePath = dependency.getSource();
  if (!unresolved && sourcePath != null) {
    library.addPath(LibraryPathType.SOURCE, sourcePath.getAbsolutePath());
  }

  File javadocPath = dependency.getJavadoc();
  if (!unresolved && javadocPath != null) {
    library.addPath(LibraryPathType.DOC, javadocPath.getAbsolutePath());
  }

  DataNode<LibraryData> libraryData =
    ExternalSystemApiUtil.find(ideProject, ProjectKeys.LIBRARY, new BooleanFunction<DataNode<LibraryData>>() {
      @Override
      public boolean fun(DataNode<LibraryData> node) {
        return library.equals(node.getData());
      }
    });
  if (libraryData == null) {
    libraryData = ideProject.createChild(ProjectKeys.LIBRARY, library);
  }

  return new LibraryDependencyData(ownerModule.getData(), libraryData.getData(), LibraryLevel.PROJECT);
}
项目:consulo    文件:ComponentPopupBuilderImpl.java   
@Nonnull
@Override
public ComponentPopupBuilder setKeyEventHandler(@Nonnull BooleanFunction<KeyEvent> handler) {
  myKeyEventHandler = handler;
  return this;
}
项目:consulo    文件:TreeIntToIntMapTest.java   
@Override
protected UpdatableIntToIntMap createUpdatableIntToIntMap(@Nonnull BooleanFunction<Integer> thisIsVisible, int longSize) {
  return TreeIntToIntMap.newInstance(thisIsVisible, longSize);
}
项目:consulo    文件:ListIntToIntMapTest.java   
@Override
protected UpdatableIntToIntMap createUpdatableIntToIntMap(@Nonnull BooleanFunction<Integer> thisIsVisible, int longSize) {
  return ListIntToIntMap.newInstance(thisIsVisible, longSize, 3);
}
项目:consulo    文件:ListIntToIntMap.java   
@Nonnull
public static UpdatableIntToIntMap newInstance(@Nonnull final BooleanFunction<Integer> thisIsVisible, final int longSize) {
  return newInstance(thisIsVisible, longSize, DEFAULT_BLOCK_SIZE);
}
项目:consulo    文件:ListIntToIntMap.java   
private ListIntToIntMap(@Nonnull BooleanFunction<Integer> thisIsVisible, int longSize, int blockSize, int[] subSumOfBlocks) {
  myLongSize = longSize;
  myThisIsVisible = thisIsVisible;
  myBlockSize = blockSize;
  mySubSumOfBlocks = subSumOfBlocks;
}
项目:consulo    文件:TreeIntToIntMap.java   
private TreeIntToIntMap(@Nonnull BooleanFunction<Integer> thisIsVisible, int longSize, int countLevels, int[] tree) {
  myThisIsVisible = thisIsVisible;
  myLongSize = longSize;
  myCountLevels = countLevels;
  myTree = tree;
}
项目:consulo    文件:ChooseByNameBase.java   
protected void showTextFieldPanel() {
  final JLayeredPane layeredPane = getLayeredPane();
  final Dimension preferredTextFieldPanelSize = myTextFieldPanel.getPreferredSize();
  final int x = (layeredPane.getWidth() - preferredTextFieldPanelSize.width) / 2;
  final int paneHeight = layeredPane.getHeight();
  final int y = paneHeight / 3 - preferredTextFieldPanelSize.height / 2;

  VISIBLE_LIST_SIZE_LIMIT = Math.max
          (10, (paneHeight - (y + preferredTextFieldPanelSize.height)) / (preferredTextFieldPanelSize.height / 2) - 1);

  ComponentPopupBuilder builder = JBPopupFactory.getInstance().createComponentPopupBuilder(myTextFieldPanel, myTextField);
  builder.setLocateWithinScreenBounds(false);
  builder.setKeyEventHandler(new BooleanFunction<KeyEvent>() {
    @Override
    public boolean fun(KeyEvent event) {
      if (myTextPopup == null || !AbstractPopup.isCloseRequest(event) || !myTextPopup.isCancelKeyEnabled()) {
        return false;
      }

      IdeFocusManager focusManager = IdeFocusManager.getInstance(myProject);
      if (isDescendingFromTemporarilyFocusableToolWindow(focusManager.getFocusOwner())) {
        focusManager.requestFocus(myTextField, true);
        return false;
      }
      else {
        myTextPopup.cancel(event);
        return true;
      }
    }
  }).setCancelCallback(new Computable<Boolean>() {
    @Override
    public Boolean compute() {
      myTextPopup = null;
      close(false);
      return Boolean.TRUE;
    }
  }).setFocusable(true).setRequestFocus(true).setModalContext(false).setCancelOnClickOutside(false);

  Point point = new Point(x, y);
  SwingUtilities.convertPointToScreen(point, layeredPane);
  Rectangle bounds = new Rectangle(point, new Dimension(preferredTextFieldPanelSize.width + 20, preferredTextFieldPanelSize.height));
  myTextPopup = builder.createPopup();
  myTextPopup.setSize(bounds.getSize());
  myTextPopup.setLocation(bounds.getLocation());

  MnemonicHelper.init(myTextFieldPanel);
  if (myProject != null && !myProject.isDefault()) {
    DaemonCodeAnalyzer.getInstance(myProject).disableUpdateByTimer(myTextPopup);
  }

  Disposer.register(myTextPopup, new Disposable() {
    @Override
    public void dispose() {
      cancelListUpdater();
    }
  });
  myTextPopup.show(layeredPane);
  if (myTextPopup instanceof AbstractPopup) {
    Window window = ((AbstractPopup)myTextPopup).getPopupWindow();
    if (window instanceof JDialog) {
      ((JDialog)window).getRootPane().putClientProperty(WindowAction.NO_WINDOW_ACTIONS, Boolean.TRUE);
    }
  }
}
项目:intellij-ce-playground    文件:ComponentPopupBuilder.java   
/**
 * Allows to define custom strategy for processing {@link JBPopup#dispatchKeyEvent(KeyEvent)}.
 */
@NotNull
ComponentPopupBuilder setKeyEventHandler(@NotNull BooleanFunction<KeyEvent> handler);
项目:tools-idea    文件:ComponentPopupBuilder.java   
/**
 * Allows to define custom strategy for processing {@link JBPopup#dispatchKeyEvent(KeyEvent)}
 * 
 * @param handler  strategy to use
 * @return         <code>this</code>
 */
@NotNull
ComponentPopupBuilder setKeyEventHandler(@NotNull BooleanFunction<KeyEvent> handler);
项目:consulo    文件:ComponentPopupBuilder.java   
/**
 * Allows to define custom strategy for processing {@link JBPopup#dispatchKeyEvent(KeyEvent)}.
 */
@Nonnull
ComponentPopupBuilder setKeyEventHandler(@Nonnull BooleanFunction<KeyEvent> handler);
项目:intellij-ce-playground    文件:UpdatableIntToIntMapTest.java   
protected abstract UpdatableIntToIntMap createUpdatableIntToIntMap(@NotNull BooleanFunction<Integer> thisIsVisible, int longSize);
项目:consulo    文件:UpdatableIntToIntMapTest.java   
protected abstract UpdatableIntToIntMap createUpdatableIntToIntMap(@Nonnull BooleanFunction<Integer> thisIsVisible, int longSize);