Java Code Examples for com.intellij.openapi.util.Conditions#alwaysTrue()

The following examples show how to use com.intellij.openapi.util.Conditions#alwaysTrue() . 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: GitStatusWidget.java    From GitToolBox with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
public ListPopup getPopupStep() {
  if (visible.get() && rootActions.update()) {
    String title = ResBundle.message("statusBar.status.menu.title");
    return new StatusActionGroupPopup(title, rootActions, myProject, Conditions.alwaysTrue());
  } else {
    return null;
  }
}
 
Example 2
Source File: CommandProcessorBase.java    From consulo with Apache License 2.0 5 votes vote down vote up
public FinalizableCommand takeNextCommand() {
  FinalizableCommand command = myList.remove(0);
  if (isEmpty()) {
    // memory leak otherwise
    myExpireCondition = Conditions.alwaysTrue();
  }
  return command;
}
 
Example 3
Source File: SdkComboBox.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static Condition<Sdk> getSdkFilter(@Nullable final Condition<SdkTypeId> filter) {
  return filter == null ? Conditions.<Sdk>alwaysTrue() : new Condition<Sdk>() {
    @Override
    public boolean value(Sdk sdk) {
      return filter.value(sdk.getSdkType());
    }
  };
}
 
Example 4
Source File: ReformatCodeAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static Condition<CharSequence> getFileTypeMaskPattern(@Nullable String mask) {
  try {
    return FindInProjectUtil.createFileMaskCondition(mask);
  } catch (PatternSyntaxException e) {
    LOG.info("Error while processing file mask: ", e);
    return Conditions.alwaysTrue();
  }
}
 
Example 5
Source File: ConsoleExecuteAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
public ConsoleExecuteAction(@Nonnull LanguageConsoleView consoleView,
                            @Nonnull ConsoleExecuteActionHandler executeActionHandler,
                            @Nonnull String emptyExecuteActionId,
                            @Nullable Condition<LanguageConsoleView> enabledCondition) {
  super(null, null, AllIcons.Actions.Execute);

  myConsoleView = consoleView;
  myExecuteActionHandler = executeActionHandler;
  myEnabledCondition = enabledCondition == null ? Conditions.<LanguageConsoleView>alwaysTrue() : enabledCondition;

  EmptyAction.setupAction(this, emptyExecuteActionId, null);
}
 
Example 6
Source File: FindInProjectUtil.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
public static Condition<CharSequence> createFileMaskCondition(@Nullable String filter) throws PatternSyntaxException {
  if (filter == null) {
    return Conditions.alwaysTrue();
  }

  String pattern = "";
  String negativePattern = "";
  final List<String> masks = StringUtil.split(filter, ",");

  for (String mask : masks) {
    mask = mask.trim();
    if (StringUtil.startsWith(mask, "!")) {
      negativePattern += (negativePattern.isEmpty() ? "" : "|") + "(" + PatternUtil.convertToRegex(mask.substring(1)) + ")";
    }
    else {
      pattern += (pattern.isEmpty() ? "" : "|") + "(" + PatternUtil.convertToRegex(mask) + ")";
    }
  }

  if (pattern.isEmpty()) pattern = PatternUtil.convertToRegex("*");
  final String finalPattern = pattern;
  final String finalNegativePattern = negativePattern;

  return new Condition<CharSequence>() {
    final Pattern regExp = Pattern.compile(finalPattern, Pattern.CASE_INSENSITIVE);
    final Pattern negativeRegExp = StringUtil.isEmpty(finalNegativePattern) ? null : Pattern.compile(finalNegativePattern, Pattern.CASE_INSENSITIVE);

    @Override
    public boolean value(CharSequence input) {
      return regExp.matcher(input).matches() && (negativeRegExp == null || !negativeRegExp.matcher(input).matches());
    }
  };
}
 
Example 7
Source File: Tree.java    From consulo with Apache License 2.0 4 votes vote down vote up
/**
 * @return    a strategy which determines if a wide selection should be drawn for a target row (it's number is
 *            {@link Condition#value(Object) given} as an argument to the strategy)
 */
@SuppressWarnings("unchecked")
@Nonnull
protected Condition<Integer> getWideSelectionBackgroundCondition() {
  return Conditions.alwaysTrue();
}
 
Example 8
Source File: FileReferenceSet.java    From consulo with Apache License 2.0 4 votes vote down vote up
protected Condition<PsiFileSystemItem> getReferenceCompletionFilter() {
  return Conditions.alwaysTrue();
}
 
Example 9
Source File: OpenUrlHyperlinkInfo.java    From consulo with Apache License 2.0 4 votes vote down vote up
public OpenUrlHyperlinkInfo(@Nonnull String url) {
  this(url, Conditions.<WebBrowser>alwaysTrue(), null);
}
 
Example 10
Source File: FilteringIterator.java    From consulo with Apache License 2.0 4 votes vote down vote up
public static <T> Condition<T> alwaysTrueCondition(Class<T> aClass) {
  return Conditions.alwaysTrue();
}
 
Example 11
Source File: ConsoleExecuteAction.java    From consulo with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("UnusedDeclaration")
public ConsoleExecuteAction(@Nonnull LanguageConsoleView console, @Nonnull BaseConsoleExecuteActionHandler executeActionHandler) {
  this(console, executeActionHandler, CONSOLE_EXECUTE_ACTION_ID, Conditions.<LanguageConsoleView>alwaysTrue());
}
 
Example 12
Source File: WideSelectionTreeUI.java    From consulo with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
public WideSelectionTreeUI() {
  this(true, Conditions.<Integer>alwaysTrue());
}