Exemplo n.º 1
0
    protected boolean isNameMatches(
        SearchPattern searchPattern, IEObjectDescription eObjectDescription) {
      String qualifiedName = qualifiedNameConverter.toString(eObjectDescription.getQualifiedName());
      if (qualifiedName == null) return false;

      if (searchPattern.matches(qualifiedName)) return true;

      int index = qualifiedName.lastIndexOf("::");
      if (index != -1 && searchPattern.matches(qualifiedName.substring(index + 1))) return true;

      return false;
    }
Exemplo n.º 2
0
    protected Predicate<IEObjectDescription> getSearchPredicate(
        final String stringPattern, final Collection<EClass> acceptedClasses) {
      final SearchPattern searchPattern = new SearchPattern();
      searchPattern.setPattern(stringPattern);

      return new Predicate<IEObjectDescription>() {
        public boolean apply(IEObjectDescription input) {
          if (isNameMatches(searchPattern, input) && isClassAccepted(input, acceptedClasses)) {
            return true;
          }
          return false;
        }
      };
    }