Java Code Examples for com.intellij.openapi.util.Condition#FALSE

The following examples show how to use com.intellij.openapi.util.Condition#FALSE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FilteredTraverserBase.java    From consulo with Apache License 2.0 6 votes vote down vote up
private Condition<? super T> buildExpandConditionForChildren(T parent) {
  // implements: or2(forceExpandAndSkip, not(childFilter));
  // and handles JBIterable.StatefulTransform and EdgeFilter conditions
  Cond copy = null;
  boolean invert = true;
  Cond c = regard;
  while (c != null) {
    Condition impl = JBIterable.Stateful.copy(c.impl);
    if (impl != (invert ? Condition.TRUE : Condition.FALSE)) {
      copy = new Cond<Object>(invert ? not(impl) : impl, copy);
      if (impl instanceof EdgeFilter) {
        ((EdgeFilter)impl).edgeSource = parent;
      }
    }
    if (c.next == null) {
      c = invert ? forceDisregard : null;
      invert = false;
    }
    else {
      c = c.next;
    }
  }
  return copy == null ? Condition.FALSE : copy.OR;
}
 
Example 2
Source File: PostfixLiveTemplate.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static Condition<PostfixTemplate> createIsApplicationTemplateFunction(@Nonnull final PostfixTemplateProvider provider,
                                                                              @Nonnull String key,
                                                                              @Nonnull PsiFile file,
                                                                              @Nonnull Editor editor) {
  int currentOffset = editor.getCaretModel().getOffset();
  final int newOffset = currentOffset - key.length();
  CharSequence fileContent = editor.getDocument().getCharsSequence();
  StringBuilder fileContentWithoutKey = new StringBuilder();
  fileContentWithoutKey.append(fileContent.subSequence(0, newOffset));
  fileContentWithoutKey.append(fileContent.subSequence(currentOffset, fileContent.length()));
  PsiFile copyFile = copyFile(file, fileContentWithoutKey);
  Document copyDocument = copyFile.getViewProvider().getDocument();
  if (copyDocument == null) {
    //noinspection unchecked
    return Condition.FALSE;
  }

  copyFile = provider.preCheck(copyFile, editor, newOffset);
  copyDocument = copyFile.getViewProvider().getDocument();
  if (copyDocument == null) {
    //noinspection unchecked
    return Condition.FALSE;
  }

  final PsiElement context = CustomTemplateCallback.getContext(copyFile, positiveOffset(newOffset));
  final Document finalCopyDocument = copyDocument;
  return new Condition<PostfixTemplate>() {
    @Override
    public boolean value(PostfixTemplate template) {
      return template != null && template.isEnabled(provider) && template.isApplicable(context, finalCopyDocument, newOffset);
    }
  };
}
 
Example 3
Source File: GeneralTestEventsProcessor.java    From consulo with Apache License 2.0 4 votes vote down vote up
public Condition getDisposedCondition() {
  return Condition.FALSE;
}
 
Example 4
Source File: MockProject.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public Condition getDisposed() {
  return Condition.FALSE;
}