String computedSearchString = searchString.replaceAll( "\\*", "[\\\\S]*" ); //$NON-NLS-1$ //$NON-NLS-2$
computedSearchString = computedSearchString.replaceAll( "\\?", "[\\\\S]" ); //$NON-NLS-1$ //$NON-NLS-2$
Pattern pattern = Pattern.compile( computedSearchString, Pattern.CASE_INSENSITIVE );
SchemaHandler schemaHandler = Activator.getDefault().getSchemaHandler();
if ( schemaHandler != null )
{
List<SearchInEnum> searchScope = new ArrayList<SearchInEnum>( Arrays.asList( searchIn ) );
if ( ( scope == PluginConstants.PREFS_SEARCH_PAGE_SCOPE_AT_AND_OC )
|| ( scope == PluginConstants.PREFS_SEARCH_PAGE_SCOPE_AT_ONLY ) )
{
// Looping on attribute types
List<AttributeType> attributeTypes = schemaHandler.getAttributeTypes();
for ( AttributeType at : attributeTypes )
{
// Aliases
if ( searchScope.contains( SearchInEnum.ALIASES ) )
{
if ( checkList( pattern, at.getNames() ) )
{
searchResults.add( at );
continue;
}
}
// OID
if ( searchScope.contains( SearchInEnum.OID ) )
{
if ( checkString( pattern, at.getOid() ) )
{
searchResults.add( at );
continue;
}
}
// Description
if ( searchScope.contains( SearchInEnum.DESCRIPTION ) )
{
if ( checkString( pattern, at.getDescription() ) )
{
searchResults.add( at );
continue;
}
}
// Superior
if ( searchScope.contains( SearchInEnum.SUPERIOR ) )
{
if ( checkString( pattern, at.getSuperiorOid() ) )
{
searchResults.add( at );
continue;
}
}
// Syntax
if ( searchScope.contains( SearchInEnum.SYNTAX ) )
{
if ( checkString( pattern, at.getSyntaxOid() ) )
{
searchResults.add( at );
continue;
}
}
// Matching Rules
if ( searchScope.contains( SearchInEnum.MATCHING_RULES ) )
{
// Equality
if ( checkString( pattern, at.getEqualityOid() ) )
{
searchResults.add( at );
continue;
}
// Ordering
if ( checkString( pattern, at.getOrderingOid() ) )
{
searchResults.add( at );
continue;
}
// Substring
if ( checkString( pattern, at.getSubstringOid() ) )
{
searchResults.add( at );
continue;
}
}
}
}
if ( ( scope == PluginConstants.PREFS_SEARCH_PAGE_SCOPE_AT_AND_OC )
|| ( scope == PluginConstants.PREFS_SEARCH_PAGE_SCOPE_OC_ONLY ) )
{
// Looping on object classes
List<ObjectClass> objectClasses = schemaHandler.getObjectClasses();
for ( ObjectClass oc : objectClasses )
{
// Aliases
if ( searchScope.contains( SearchInEnum.ALIASES ) )
{